ci: use Jenkins harbor credential for image push auth

This commit is contained in:
Brad Stein 2026-04-10 06:41:02 -03:00
parent a80d46606e
commit 00e6208d97

32
Jenkinsfile vendored
View File

@ -93,21 +93,23 @@ spec:
stage('Prep toolchain') { stage('Prep toolchain') {
steps { steps {
container('builder') { container('builder') {
sh ''' withCredentials([usernamePassword(credentialsId: 'harbor-robot', usernameVariable: 'HARBOR_USERNAME', passwordVariable: 'HARBOR_PASSWORD')]) {
set -euo pipefail sh '''
for attempt in 1 2 3 4 5; do set -euo pipefail
if apk add --no-cache bash git jq curl; then for attempt in 1 2 3 4 5; do
break if apk add --no-cache bash git jq curl; then
fi break
if [ "$attempt" -eq 5 ]; then fi
echo "apk add failed after ${attempt} attempts" >&2 if [ "$attempt" -eq 5 ]; then
exit 1 echo "apk add failed after ${attempt} attempts" >&2
fi exit 1
sleep $((attempt * 2)) fi
done sleep $((attempt * 2))
mkdir -p /root/.docker done
cp /docker-config/config.json /root/.docker/config.json mkdir -p /root/.docker
''' printf '%s' "${HARBOR_PASSWORD}" | docker login registry.bstein.dev -u "${HARBOR_USERNAME}" --password-stdin
'''
}
} }
} }
} }