From bbccb3e05ebd7a1c3abb9aa4d2538d7c25ab2ec3 Mon Sep 17 00:00:00 2001 From: wwweww <2646787260@qq.com> Date: Mon, 4 May 2026 12:19:57 +0800 Subject: [PATCH] fix(jenkins): quote URL with query params to prevent shell glob expansion --- deploy/jenkins/Jenkinsfile.poll | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/deploy/jenkins/Jenkinsfile.poll b/deploy/jenkins/Jenkinsfile.poll index 6c17e3e..ee164d4 100644 --- a/deploy/jenkins/Jenkinsfile.poll +++ b/deploy/jenkins/Jenkinsfile.poll @@ -96,17 +96,20 @@ pipeline { passwordVariable: 'HARBOR_PASS' ) ]) { + def harborListUrl = "${HARBOR_API}/projects/${params.HARBOR_PROJECT}/repositories?page_size=100" def services = sh( script: """ curl -s -u "\${HARBOR_USER}:\${HARBOR_PASS}" \\ --connect-timeout 10 --max-time 30 \\ - "${HARBOR_API}/projects/${params.HARBOR_PROJECT}/repositories?page_size=100" \\ - | python3 -c " + '${harborListUrl}' \\ + | python3 -c ' import sys, json repos = json.load(sys.stdin) -names = [r['name'].split('/')[-1] for r in repos if isinstance(repos, list)] -print(','.join(sorted(names))) -" 2>/dev/null || echo "" +if not isinstance(repos, list): + sys.exit(1) +names = [r["name"].split("/")[-1] for r in repos] +print(",".join(sorted(names))) +' 2>/dev/null || echo "" """, returnStdout: true ).trim()