From 5bd6d5643672c3aca09661641aa63f121209ecd7 Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Sat, 25 Apr 2026 06:50:01 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20switch=20sh=20to=20bat=20=E2=80=94=20Wind?= =?UTF-8?q?ows=20Jenkins=20has=20no=20sh=20in=20process=20PATH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docker and ssh are both natively available on Windows. Credential vars (%ACR_PASS%, %SSH_KEY%) use bat syntax; Groovy vars use GString. Co-Authored-By: Claude Sonnet 4.6 --- Jenkinsfile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3479e70..6ab9587 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,8 +26,8 @@ pipeline { withCredentials([string(credentialsId: 'ACR_PASSWORD', variable: 'ACR_PASS')]) { script { def imageName = "${ACR_REGISTRY}/${ACR_NAMESPACE}/${params.SERVICE}:${params.IMAGE_TAG}" - sh """ - docker login ${ACR_REGISTRY} -u ${ACR_USERNAME} -p \${ACR_PASS} + bat """ + docker login ${ACR_REGISTRY} -u ${ACR_USERNAME} -p %ACR_PASS% docker build --build-arg SERVICE_MODULE=${params.SERVICE} -t ${imageName} . docker push ${imageName} docker rmi ${imageName} @@ -44,11 +44,8 @@ pipeline { script { def svcName = params.SERVICE.replace('-service', '') def imageName = "${ACR_REGISTRY}/${ACR_NAMESPACE}/${params.SERVICE}:${params.IMAGE_TAG}" - sh """ - ssh -i \${SSH_KEY} -o StrictHostKeyChecking=no ${PROD_USER}@${PROD_HOST} \ - "docker pull ${imageName} && \ - docker compose -f ${COMPOSE_FILE} up -d --no-deps ${svcName} && \ - docker image prune -f" + bat """ + ssh -i "%SSH_KEY%" -o StrictHostKeyChecking=no ${PROD_USER}@${PROD_HOST} "docker pull ${imageName} && docker compose -f ${COMPOSE_FILE} up -d --no-deps ${svcName} && docker image prune -f" """ } }