Commit 08a6b167 authored by ymir's avatar ymir

review UT & build script

parent c0584a10
Pipeline #105003 passed with stages
in 7 minutes and 13 seconds
......@@ -10,11 +10,11 @@ test: # this block can be copied/past/renamed if you split tests on different bl
stage: test
script:
# install requirements
- apt-get install -y python3 python3-pip pylint python3-numpy python3-psutil
- apt-get install -y pylint python3 python3-pip python3-numpy python3-psutil
# - pip3 install --upgrade pip
- pip3 install --extra-index-url http://91.121.9.53:81/archive --trusted-host 91.121.9.53 pythoncommontools neuralnetworkcommon
# setup, minimal UT
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53:/home/${SSH_USER_NAME}/shared/configuration/neuralnetworktrainercli/UT.neuralnetworktrainercli.conf neuralnetworktrainercli/conf/neuralnetworktrainercli.conf
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53:/home/${SSH_USER_NAME}/shared/configuration/neuralnetworktrainercli/ut.neuralnetworktrainercli.conf neuralnetworktrainercli/conf/neuralnetworktrainercli.conf
- python3 setup.py build
- python3 setup.py install
- cd neuralnetworktrainercli
......@@ -22,7 +22,7 @@ test: # this block can be copied/past/renamed if you split tests on different bl
- cd ..
# code quality
- pylint --output-format=parseable neuralnetworktrainercli test > code_quality_report.txt || echo 0
- sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 mkdir -p /home/${SSH_USER_NAME}/docker/continuous_integration/apache_pip/html/pylint/neuralnetworktrainercli/${CI_BUILD_REF_NAME}
- sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 mkdir -p /home/${SSH_USER_NAME}/docker/apache_php/ci/html/pylint/neuralnetworktrainercli/${CI_BUILD_REF_NAME}
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} code_quality_report.txt ${SSH_USER_NAME}@91.121.9.53:/home/${SSH_USER_NAME}/docker/continuous_integration/apache_pip/html/pylint/neuralnetworktrainercli/${CI_BUILD_REF_NAME}
# TODO : documentation
build: # this block can be copied/past/renamed if you split builds on different blocks
......@@ -36,20 +36,12 @@ deploy_development:
stage: deploy
script:
# edit & send docker file
- sed -i s/"{SSH_USER_PASS}"/${SSH_USER_PASS}/g install.sh
- sed -i s/"{SSH_PORT}"/${SSH_PORT}/g install.sh
- sed -i s/"{SSH_USER_NAME}"/${SSH_USER_NAME}/g install.sh
- sed -i s/"{CI_BUILD_REF_NAME}"/${CI_BUILD_REF_NAME}/g install.sh
- sed -i s/"{ENVIRONMENT}"/DEV/g install.sh
- sed -i s/"{ENV}"/"dev"/g install/host.sh
- sed -i s/"{SSH_USER_NAME}"/"${SSH_USER_NAME}"/g install/host.sh
# copy install script
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} install.sh ${SSH_USER_NAME}@91.121.9.53:/tmp/install.sh
- sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker cp /tmp/install.sh ymirfrostgiant_dev_console:/tmp/install.sh
# start container & run install
- sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker start ymirfrostgiant_dev_console
- sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker exec -t ymirfrostgiant_dev_console bash /tmp/install.sh
# remove install script
- sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker exec -t ymirfrostgiant_dev_console rm /tmp/install.sh
- sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 rm -R /tmp/install.sh
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} -r install/*.sh ${SSH_USER_NAME}@91.121.9.53:/tmp
# run install
- sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 bash /tmp/host.sh
environment:
name: development
only:
......
#!/usr/bin/env bash
# coding=utf-8
set -xe
# THIS SCRIPT IS FOR FOR THE CONSOLE CONTAINER
# upgrade system
apt-get update -y ; apt-get upgrade -y -q ; apt-get dist-upgrade -y -q ; apt-get -y -q autoclean ; apt-get -y -q autoremove
# install required system
apt-get install -y python3 python3-pip python3-numpy python3-psutil
# (un/re)install existing project & dependencies
pip3 uninstall -y neuralnetworktrainercli || echo 0
rm -Rf /root/.cache/pip/
# 91.121.9.53 = yggdrasil
pip3 install --extra-index-url http://91.121.9.53:81/archive --trusted-host 91.121.9.53 pythoncommontools neuralnetworkcommon neuralnetworktrainercli
# copy configuration file
mkdir -p /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/conf
mv /tmp/neuralnetworktrainercli.conf /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/conf
# add proxy configuration
LINE_NUMBER=`cat /etc/apache2/apache2.conf | grep /neuralnetwork/trainer | wc -l`
if [[ ${LINE_NUMBER} -eq 0 ]]; then
echo ProxyPass "/neuralnetwork/trainer" "http://localhost:5000/neuralnetwork/trainer" >> /etc/apache2/apache2.conf
service apache2 restart
fi
#!/usr/bin/env bash
# coding=utf-8
set -xe
# THIS SCRIPT IS FOR FOR THE HOST (DOCKER MANAGER)
# copy guest script & configuration
docker cp /tmp/console.sh ymirfrostgiant_{ENV}_console:/tmp/console.sh
docker cp /home/{SSH_USER_NAME}/shared/configuration/neuralnetworktrainercli/{ENV}.neuralnetworktrainercli.conf ymirfrostgiant_{ENV}_console:/tmp/neuralnetworktrainercli.conf
# start container & run install
docker start ymirfrostgiant_{ENV}_console
docker exec -t ymirfrostgiant_{ENV}_console bash -c "bash /tmp/console.sh;rm /tmp/console.sh"
rm /tmp/*.sh
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment