build: 转义 Jenkinsfile 中的变量引用

This commit is contained in:
BugKing 2020-12-18 13:39:56 +08:00
parent 18e32230d0
commit f4430b16bc
1 changed files with 3 additions and 3 deletions

6
Jenkinsfile vendored
View File

@ -19,9 +19,9 @@ pipeline {
} }
stage('Docker build & push') { stage('Docker build & push') {
steps { steps {
sh "docker build --build-arg MS_VERSION=${TAG_NAME:-$BRANCH_NAME}-b${BUILD_NUMBER} -t ${IMAGE_NAME}:${TAG_NAME:-$BRANCH_NAME} ." sh "docker build --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-b\${BUILD_NUMBER} -t ${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME} ."
sh "docker tag ${IMAGE_NAME}:${TAG_NAME:-$BRANCH_NAME} ${IMAGE_FREFIX}/${IMAGE_NAME}:${TAG_NAME:-$BRANCH_NAME}" sh "docker tag ${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME} ${IMAGE_FREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME}"
sh "docker push ${IMAGE_FREFIX}/${IMAGE_NAME}:${TAG_NAME:-$BRANCH_NAME}" sh "docker push ${IMAGE_FREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME}"
} }
} }
} }