Skip to content

Commit 113113d

Browse files
committed
fix
1 parent f328397 commit 113113d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pipelines/lib/util.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ def labelPod(){
474474
}
475475

476476
def jsonLabels = groovy.json.JsonOutput.toJson([metadata: [labels: labels]])
477+
echo "jsonLabels": $(jsonLabels)
477478

478479
bash '''
479480
set -eu
@@ -486,14 +487,15 @@ def labelPod(){
486487
TOKEN=$(cat $SA/token)
487488
CA=$SA/ca.crt
488489
490+
echo '${jsonLabels}' > /tmp/patch.json
489491
490492
if curl -sS --fail \
491493
--cacert "$CA" \
492494
-H "Authorization: Bearer $TOKEN" \
493495
-H "Content-Type: application/merge-patch+json" \
494496
-X PATCH \
495497
"https://kubernetes.default.svc/api/v1/namespaces/$NS/pods/$POD" \
496-
-d '${jsonLabels}'
498+
--data-binary @/tmp/patch.json >/dev/null
497499
then
498500
echo "labeled jenkins-job=$JOB jenkins-build=$BUILD_NUMBER for pod $NS/$POD"
499501
else

0 commit comments

Comments
 (0)