Commit 29a4bafd authored by ymir's avatar ymir

script CD development

parent 06991b08
Pipeline #62078 passed with stages
in 2 minutes and 51 seconds
stages:
- test
- build
# - deploy
- deploy
before_script:
- apt-get update -y
- apt-get install -y openssh-client sshpass
......@@ -31,34 +31,32 @@ build: # this block can be copied/past/renamed if you split builds on different
# tarball
- tar -czf neuralnetworktrainercli-${CI_BUILD_REF_NAME}.tar.gz neuralnetworktrainercli setup.py
- 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/archive/neuralnetworktrainercli
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} neuralnetworktrainercli-*.tar.gz ${SSH_USER_NAME}@91.121.9.53:/home/${SSH_USER_NAME}/docker/continuous_integration/apache_pip/html/archive/neuralnetworktrainercli
#deploy_development:
# stage: deploy
# script:
## remove existing container
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker stop gitlabcicd_dev_neuralnetworktrainercli || echo 0
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker rm gitlabcicd_dev_neuralnetworktrainercli || echo 0
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker rmi gitlabcicd/dev_neuralnetworktrainercli || echo 0
## create log file/folder
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 mkdir -p /home/${SSH_USER_NAME}/shared/log/neuralnetworktrainercli
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 touch /home/${SSH_USER_NAME}/shared/log/neuralnetworktrainercli/DEV.neuralnetworktrainercli.log
## edit & send docker file
# - sed -i s/"{SSH_USER_PASS}"/${SSH_USER_PASS}/g Dockerfile
# - sed -i s/"{SSH_PORT}"/${SSH_PORT}/g Dockerfile
# - sed -i s/"{SSH_USER_NAME}"/${SSH_USER_NAME}/g Dockerfile
# - sed -i s/"{ENVIRONMENT}"/DEV/g Dockerfile
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 mkdir -p /tmp/neuralnetworktrainercli
# - sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} Dockerfile ${SSH_USER_NAME}@91.121.9.53:/tmp/neuralnetworktrainercli
## create container
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 "cd /tmp/neuralnetworktrainercli;docker build -t "gitlabcicd/dev_neuralnetworktrainercli" ."
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker create --name gitlabcicd_dev_neuralnetworktrainercli -v /home/${SSH_USER_NAME}/shared/configuration/neuralnetworktrainercli/DEV.neuralnetworktrainercli.conf:/usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/conf/neuralnetworktrainercli.conf -v /home/${SSH_USER_NAME}/shared/log/neuralnetworktrainercli/DEV.neuralnetworktrainercli.log:/usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/log/neuralnetworktrainercli.log -p 5001:5000 gitlabcicd/dev_neuralnetworktrainercli
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker start gitlabcicd_dev_neuralnetworktrainercli
## remove docker file
# - sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 rm -R /tmp/neuralnetworktrainercli
# environment:
# name: development
# only:
# - development
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} neuralnetworktrainercli-${CI_BUILD_REF_NAME}.tar.gz ${SSH_USER_NAME}@91.121.9.53:/home/${SSH_USER_NAME}/docker/continuous_integration/apache_pip/html/archive/neuralnetworktrainercli
deploy_development:
stage: deploy
script:
# un-install existing command line tool
- pip3 uninstall -y pythoncommontools neuralnetworkcommon neuralnetworktrainercli || echo 0
# install command line tool & dependencies
- apt-get install -y python3 python3-pip python3-psutil python3-numpy python3-requests
- pip3 install --extra-index-url http://91.121.9.53:81/archive --trusted-host 91.121.9.53 pythoncommontools neuralnetworkcommon neuralnetworktrainercli
# set-up configuration
- mkdir -p /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/conf
- mkdir -p /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/help
- export SSHPASS=${SSH_USER_PASS}
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53:/home/${SSH_USER_NAME}/shared/configuration/neuralnetworktrainercli/DEV.neuralnetworktrainercli.conf /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/conf/neuralnetworktrainercli.conf
- sshpass -e scp -o stricthostkeychecking=no -P ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53:/home/${SSH_USER_NAME}/docker/continuous_integration/apache_pip/html/archive/neuralnetworktrainercli/neuralnetworktrainercli-${CI_BUILD_REF_NAME}.tar.gz /tmp
- unset SSHPASS
- tar -xzvf /tmp/neuralnetworktrainercli-${CI_BUILD_REF_NAME}.tar.gz -C /tmp
- cp /tmp/neuralnetworktrainercli/help/neuralnetworktrainercli.sh help
- rm -Rf /tmp/neuralnetworktrainercli* setup.py
# make program executable
- chmod +x /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/neuralnetworktrainercli.py
- ln -s /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/neuralnetworktrainercli.py /usr/local/bin/neuralnetworktrainercli
environment:
name: development
only:
- development
#deploy_staging:
# stage: deploy
# script:
......
......@@ -123,4 +123,6 @@ python3 neuralnetworktrainercli.py delete perceptron
rm -f ${TRAININGSESSION_ARCHIVE}
rm -f ${TRAININGSET_ARCHIVE}
rm -f ${PERCEPTRON_ARCHIVE}
#-------------------------------------------------------------
\ No newline at end of file
#-------------------------------------------------------------
# to adapt configuration, please edit this file : neuralnetworktrainercli.conf
#-------------------------------------------------------------
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