From 00e6208d978ccfa709ade764426a64474b40a3d5 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Fri, 10 Apr 2026 06:41:02 -0300 Subject: [PATCH] ci: use Jenkins harbor credential for image push auth --- Jenkinsfile | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5e83b25..80f230a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -93,21 +93,23 @@ spec: stage('Prep toolchain') { steps { container('builder') { - sh ''' - set -euo pipefail - for attempt in 1 2 3 4 5; do - if apk add --no-cache bash git jq curl; then - break - fi - if [ "$attempt" -eq 5 ]; then - echo "apk add failed after ${attempt} attempts" >&2 - exit 1 - fi - sleep $((attempt * 2)) - done - mkdir -p /root/.docker - cp /docker-config/config.json /root/.docker/config.json - ''' + withCredentials([usernamePassword(credentialsId: 'harbor-robot', usernameVariable: 'HARBOR_USERNAME', passwordVariable: 'HARBOR_PASSWORD')]) { + sh ''' + set -euo pipefail + for attempt in 1 2 3 4 5; do + if apk add --no-cache bash git jq curl; then + break + fi + if [ "$attempt" -eq 5 ]; then + echo "apk add failed after ${attempt} attempts" >&2 + exit 1 + fi + sleep $((attempt * 2)) + done + mkdir -p /root/.docker + printf '%s' "${HARBOR_PASSWORD}" | docker login registry.bstein.dev -u "${HARBOR_USERNAME}" --password-stdin + ''' + } } } }