diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 9eb2764..cb8bb0f 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,7 +1,7 @@ def remote = [:] remote.name = 'remote' -remote.host = 'localhost' -remote.user = 'simon' +remote.host = env.DEPLOY_HOST +remote.user = env.DEPLOY_USER remote.identityFile = '/var/lib/jenkins/.ssh/id_rsa' remote.knownHosts = '/var/lib/jenkins/.ssh/known_hosts' @@ -11,7 +11,6 @@ pipeline { stage('Build') { steps { sh './jenkins/build.sh' - stash includes: 'env/', name: 'env' } } stage('Test') { @@ -21,9 +20,9 @@ pipeline { } stage('Deploy') { steps { - sshPut remote: remote, from: 'env', into: 'task_tracker_drone' sshPut remote: remote, from: 'jenkins/deploy.sh', into: 'task_tracker_drone/deploy.sh' sshPut remote: remote, from: 'src', into: 'task_tracker_drone' + sshPut remote: remote, from: 'requirements.txt', into: 'task_tracker_drone' sshCommand remote: remote, command: 'chmod +x task_tracker_drone/deploy.sh && ./task_tracker_drone/deploy.sh' } } diff --git a/jenkins/build.sh b/jenkins/build.sh index 6db37cf..56a4e9c 100755 --- a/jenkins/build.sh +++ b/jenkins/build.sh @@ -3,7 +3,5 @@ virtualenv env --download --clear -p python3.7 source env/bin/activate python --version - pip install -r requirements.txt deactivate - diff --git a/jenkins/deploy.sh b/jenkins/deploy.sh index b7957e7..e3025a2 100755 --- a/jenkins/deploy.sh +++ b/jenkins/deploy.sh @@ -2,8 +2,15 @@ export DRONEROOT="task_tracker_drone" +cd ${DRONEROOT} +virtualenv env --download --clear -p python3.7 +source env/bin/activate +python --version +pip install -r requirements.txt +deactivate + screen -S tt_drone -X quit echo "starting drone" -screen -S tt_drone -d -m bash -c "cd ${DRONEROOT} && source env/bin/activate && python src/drone.py" +screen -S tt_drone -d -m bash -c "source env/bin/activate && python src/drone.py" sleep 1 screen -list