From 6b94c30628429e700a7cb076f8fa4aa1602c7a1a Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Thu, 11 Jun 2026 17:07:57 +0800 Subject: [PATCH] =?UTF-8?q?chore(ci):=20=E7=A7=BB=E9=99=A4=20DEPLOY=20?= =?UTF-8?q?=E5=92=8C=20NO=5FCACHE=20=E5=8F=82=E6=95=B0=EF=BC=8C=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E5=90=8E=E5=BF=85=E7=84=B6=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- Jenkinsfile.ops-web | 8 +------- Jenkinsfile.tenant-web | 8 +------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile.ops-web b/Jenkinsfile.ops-web index 80cf318..4228709 100644 --- a/Jenkinsfile.ops-web +++ b/Jenkinsfile.ops-web @@ -3,8 +3,6 @@ pipeline { parameters { string(name: 'IMAGE_TAG', defaultValue: 'latest', description: '镜像 Tag') - booleanParam(name: 'DEPLOY', defaultValue: true, description: '构建后是否自动部署') - booleanParam(name: 'NO_CACHE', defaultValue: false, description: '禁用 Docker 构建缓存(缓存错误时使用)') } environment { @@ -44,15 +42,12 @@ pipeline { withCredentials([string(credentialsId: 'ACR_PASSWORD', variable: 'ACR_PASS')]) { script { def fullImage = "${env.ACR_REGISTRY}/${env.ACR_NAMESPACE}/${env.IMAGE_NAME}:${params.IMAGE_TAG}" - def cacheArgs = params.NO_CACHE - ? '--no-cache' - : "--build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ${fullImage}" def gitCommit = env.GIT_COMMIT ?: 'unknown' bat """ docker login ${env.ACR_REGISTRY} -u ${env.ACR_USERNAME} -p %ACR_PASS% if %errorlevel% neq 0 exit /b 1 docker pull --platform=linux/amd64 ${fullImage} || echo Pull failed, will build fresh - docker build --platform=linux/amd64 -f ${env.DOCKERFILE} ${env.BUILD_ARGS} --build-arg GIT_COMMIT=${gitCommit} ${cacheArgs} -t ${fullImage} . + docker build --platform=linux/amd64 -f ${env.DOCKERFILE} ${env.BUILD_ARGS} --build-arg GIT_COMMIT=${gitCommit} --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ${fullImage} -t ${fullImage} . if %errorlevel% neq 0 exit /b 1 docker push ${fullImage} if %errorlevel% neq 0 exit /b 1 @@ -65,7 +60,6 @@ pipeline { } stage('Deploy to Production') { - when { expression { return params.DEPLOY } } steps { lock('prod-deploy') { withCredentials([sshUserPrivateKey(credentialsId: 'PROD_SSH_KEY', keyFileVariable: 'SSH_KEY')]) { diff --git a/Jenkinsfile.tenant-web b/Jenkinsfile.tenant-web index 304dbcc..efbda53 100644 --- a/Jenkinsfile.tenant-web +++ b/Jenkinsfile.tenant-web @@ -3,8 +3,6 @@ pipeline { parameters { string(name: 'IMAGE_TAG', defaultValue: 'latest', description: '镜像 Tag') - booleanParam(name: 'DEPLOY', defaultValue: true, description: '构建后是否自动部署') - booleanParam(name: 'NO_CACHE', defaultValue: false, description: '禁用 Docker 构建缓存(缓存错误时使用)') } environment { @@ -44,15 +42,12 @@ pipeline { withCredentials([string(credentialsId: 'ACR_PASSWORD', variable: 'ACR_PASS')]) { script { def fullImage = "${env.ACR_REGISTRY}/${env.ACR_NAMESPACE}/${env.IMAGE_NAME}:${params.IMAGE_TAG}" - def cacheArgs = params.NO_CACHE - ? '--no-cache' - : "--build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ${fullImage}" def gitCommit = env.GIT_COMMIT ?: 'unknown' bat """ docker login ${env.ACR_REGISTRY} -u ${env.ACR_USERNAME} -p %ACR_PASS% if %errorlevel% neq 0 exit /b 1 docker pull --platform=linux/amd64 ${fullImage} || echo Pull failed, will build fresh - docker build --platform=linux/amd64 -f ${env.DOCKERFILE} ${env.BUILD_ARGS} --build-arg GIT_COMMIT=${gitCommit} ${cacheArgs} -t ${fullImage} . + docker build --platform=linux/amd64 -f ${env.DOCKERFILE} ${env.BUILD_ARGS} --build-arg GIT_COMMIT=${gitCommit} --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ${fullImage} -t ${fullImage} . if %errorlevel% neq 0 exit /b 1 docker push ${fullImage} if %errorlevel% neq 0 exit /b 1 @@ -65,7 +60,6 @@ pipeline { } stage('Deploy to Production') { - when { expression { return params.DEPLOY } } steps { lock('prod-deploy') { withCredentials([sshUserPrivateKey(credentialsId: 'PROD_SSH_KEY', keyFileVariable: 'SSH_KEY')]) {