更改构建镜像流水线为v2

This commit is contained in:
dxin
2025-12-03 15:31:02 +08:00
parent 101292aecf
commit b88aa2803d
16 changed files with 3459 additions and 20 deletions

View File

@@ -131,7 +131,7 @@ pipeline {
}
}
}
stage('登录容器仓库') {
stage('登录仓库') {
steps {
withCredentials([usernamePassword(
credentialsId: env.CREDENTIALS_ID,
@@ -144,7 +144,7 @@ pipeline {
}
}
}
stage('构建容器镜像') {
stage('构建镜像') {
steps {
script {
// 构建镜像,添加标签信息
@@ -162,7 +162,7 @@ pipeline {
}
}
}
stage('推送镜像到仓库') {
stage('推送镜像') {
steps {
script {
sh "docker push ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG}"
@@ -175,7 +175,7 @@ pipeline {
post {
always {
script {
def keepCount = 2
def keepCount = 3
echo "开始清理本地旧镜像,仅保留最近 ${keepCount} 个构建版本"
def imagePrefix = "${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}"