Commit c00a296d authored by ymir's avatar ymir

script CD development

parent 29a4bafd
Pipeline #62216 passed with stages
in 3 minutes and 6 seconds
......@@ -35,24 +35,21 @@ build: # this block can be copied/past/renamed if you split builds on different
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
# 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
# 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_bare_ubuntu_test:/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_bare_ubuntu_test
- sshpass -e ssh -o stricthostkeychecking=no -p ${SSH_PORT} ${SSH_USER_NAME}@91.121.9.53 docker exec -t ymirfrostgiant_bare_ubuntu_test 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_bare_ubuntu_test 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
environment:
name: development
only:
......
#!/usr/bin/env bash
# coding=utf-8
set -xe
# un-install existing command line tool
pip3 uninstall -y pythoncommontools neuralnetworkcommon neuralnetworktrainercli || echo 0
# install command line tool & dependencies
apt-get install -y openssh-client sshpass 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/{ENVIRONMENT}.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 /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/help
rm -Rf /tmp/neuralnetworktrainercli* /tmp/setup.py
# make program executable
chmod +x /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/neuralnetworktrainercli.py
ln -fs /usr/local/lib/python3.6/dist-packages/neuralnetworktrainercli/neuralnetworktrainercli.py /usr/local/bin/neuralnetworktrainercli
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