From 46f87632e6ff51bd567135016ad5c133ccbe0697 Mon Sep 17 00:00:00 2001 From: ehl-jf Date: Tue, 19 May 2026 10:35:24 +0200 Subject: [PATCH] JGC-490 - Skip Chocolatey publish when version already exists Treat the "already exists" response from `choco push` as success so the v2-jf phase doesn't re-fail on rerun and the outer retry loop only kicks in for genuine transient failures. Mirrors the existing npm/rbc guards. --- Jenkinsfile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 10b67f56b..6dcc11453 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -556,7 +556,17 @@ def publishChocoPackage(version, jfrogCliRepoDir, architecture) { cp $jfrogCliRepoDir/${cliExecutableName}.exe $jfrogCliRepoDir/build/chocolatey/$identifier/tools cp $jfrogCliRepoDir/LICENSE $jfrogCliRepoDir/build/chocolatey/$identifier/tools docker run -v \$PWD:/work -w /work $architecture.chocoImage choco pack version=$version - docker run -v \$PWD:/work -w /work $architecture.chocoImage choco push --source='https://push.chocolatey.org/' --apiKey \$CHOCO_API_KEY ${packageName}.${version}.nupkg + output=\$(docker run -v \$PWD:/work -w /work $architecture.chocoImage choco push --source='https://push.chocolatey.org/' --apiKey \$CHOCO_API_KEY ${packageName}.${version}.nupkg 2>&1) + exit_code=\$? + echo "\$output" + if [[ \$exit_code -ne 0 ]]; then + if echo "\$output" | grep -qi "already exists"; then + echo "Choco package publish skipped - $packageName $version already exists" + exit 0 + else + exit \$exit_code + fi + fi """ } }