diff --git a/Jenkinsfile b/Jenkinsfile index 360b549..9861249 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,11 +54,15 @@ pipeline { stage('Build & Tag') { steps { withCredentials([string(credentialsId: GITEA_ID, variable: 'GITEA_TOKEN')]) { - def fullImageName = "${DOCKER_HUB_USERNAME}/${IMAGE_NAME}" - sh "docker build --build-arg GITEA_TOKEN=${GITEA_TOKEN} -t ${fullImageName}:${IMAGE_TAG} ." - - if (SECONDARY_TAG) { - sh "docker tag ${fullImageName}:${IMAGE_TAG} ${fullImageName}:${SECONDARY_TAG}" + // Logic and variable definitions go inside 'script' + script { + def fullImageName = "${DOCKER_HUB_USERNAME}/${IMAGE_NAME}" + + sh "docker build --build-arg GITEA_TOKEN=${GITEA_TOKEN} -t ${fullImageName}:${IMAGE_TAG} ." + + if (SECONDARY_TAG) { + sh "docker tag ${fullImageName}:${IMAGE_TAG} ${fullImageName}:${SECONDARY_TAG}" + } } } }