test ci#2

main
Cizz22 1 year ago
parent 321304276e
commit 002f81bbb4

5
Jenkinsfile vendored

@ -37,10 +37,9 @@ pipeline {
steps { steps {
script { script {
// Build with commit hash tag // Build with commit hash tag
def commitHash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
sh """ sh """
docker build -t ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:latest . 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 { steps {
sh """ sh """
# Push both tags # 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 docker push ${DOCKER_HUB_USERNAME}/${IMAGE_NAME}:latest
""" """
} }

Loading…
Cancel
Save