diff --git a/Jenkinsfile b/Jenkinsfile index 279d3f9..1ad72f1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,6 +9,7 @@ pipeline { // Replace with your image name IMAGE_NAME = 'oh-service' // Variable for Git commit hash + GIT_COMMIT_HASH = '' } stages { @@ -35,7 +36,7 @@ pipeline { steps { script { // Build with commit hash tag - APP_GIT_HASH = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim() + GIT_COMMIT_HASH = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim() sh ''' docker build -t ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:latest . docker tag ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:latest ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:${APP_GIT_HASH} @@ -46,7 +47,7 @@ pipeline { stage('Push to Docker Hub') { steps { - APP_GIT_HASH = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim() + GIT_COMMIT_HASH = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim() sh ''' # Push both tags docker push ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:${APP_GIT_HASH}