From d7e2728ff79d6b88b59b896b1a5394b5d29dc148 Mon Sep 17 00:00:00 2001 From: joe Date: Thu, 11 Mar 2021 15:01:59 +0800 Subject: [PATCH] add final stage --- Jenkinsfile | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b9ab81d..c478fa0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,18 +1,18 @@ pipeline { agent none - environment { - PATH = "$PATH:/usr/local/bin" + options { + skipStagesAfterUnstable() } stages { - stage('Build') { + stage('Build') { agent { docker { image 'python:2-alpine' } } steps { - sh 'python -m py_compile sources/add2vals.py sources/calc.py' - stash(name: 'compiled-results', includes: 'sources/*.py*') + sh 'python -m py_compile sources/add2vals.py sources/calc.py' + stash(name: 'compiled-results', includes: 'sources/*.py*') } } stage('Test') { @@ -30,5 +30,24 @@ pipeline { } } } + stage('Deliver') { + agent any + environment { + VOLUME = '$(pwd)/sources:/src' + IMAGE = 'cdrx/pyinstaller-linux:python2' + } + steps { + dir(path: env.BUILD_ID) { + unstash(name: 'compiled-results') + sh "docker run --rm -v ${VOLUME} ${IMAGE} 'pyinstaller -F add2vals.py'" + } + } + post { + success { + archiveArtifacts "${env.BUILD_ID}/sources/dist/add2vals" + sh "docker run --rm -v ${VOLUME} ${IMAGE} 'rm -rf build dist'" + } + } + } } -} +} \ No newline at end of file