fix: 修复标签生成逻辑,将分支名中的斜杠替换为连字符

This commit is contained in:
lzh
2026-01-15 16:55:44 +08:00
parent 683b99be21
commit 5d0074cc7c

4
Jenkinsfile vendored
View File

@@ -80,7 +80,9 @@ pipeline {
returnStdout: true
).trim()
env.IMAGE_TAG = "${env.BRANCH_NAME}-${env.BUILD_NUMBER}-${shortCommit}"
// 清理分支名:将斜杠替换为连字符,确保 Docker 标签格式有效
def sanitizedBranchName = env.BRANCH_NAME.replaceAll('/', '-')
env.IMAGE_TAG = "${sanitizedBranchName}-${env.BUILD_NUMBER}-${shortCommit}"
env.PREVIOUS_IMAGE_TAG = getPreviousImageTag()
env.GIT_COMMIT_MSG = sh(
script: 'git log -1 --pretty=%B',