diff --git a/Jenkinsfile b/Jenkinsfile index d8662c1fc369bfa984de3e8477ae33c0d94c95f1..5010a4281ec9a2b3a19eb162833295a09df37b08 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,9 @@ pipeline { stage("clone") { steps { dir(FOLDER) { - scmObj = checkout scm + script { + scmObj = checkout scm + } } } } @@ -37,7 +39,7 @@ pipeline { stage("image") { environment { - IMAGE_TAG = scmObj.GIT_COMMIT + IMAGE_TAG = getCurrentCommit(scmObj) } steps { container('tools'){ @@ -53,7 +55,7 @@ pipeline { stage("push-image") { environment { DOCKER_CREDS = credentials('docker-surenpi') - IMAGE_TAG = scmObj.GIT_COMMIT + IMAGE_TAG = getCurrentCommit(scmObj) } steps { container('tools') { @@ -66,4 +68,8 @@ pipeline { } } } -} \ No newline at end of file +} + +def getCurrentCommit(scmObj) { + return scmObj.GIT_COMMIT +}