From 002f81bbb4beed0986af0440de2a8ec5b75c1ef3 Mon Sep 17 00:00:00 2001 From: Cizz22 Date: Mon, 13 Jan 2025 13:54:48 +0700 Subject: [PATCH] test ci#2 --- Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index edb88d7..8f94881 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,10 +37,9 @@ pipeline { steps { script { // Build with commit hash tag - def commitHash = 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}:${commitHash} + docker tag ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:latest ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:${GIT_COMMIT_HASH} """ } } @@ -50,7 +49,7 @@ pipeline { steps { sh """ # Push both tags - docker push ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:${commitHash} + docker push ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:${GIT_COMMIT_HASH} docker push ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:latest """ }