ci: harden registry proxy credentials

This commit is contained in:
2026-08-12 00:01:50 +08:00
parent 534f8030c1
commit e6068d93e0
Vendored
+6
View File
@@ -201,7 +201,10 @@ pipeline {
--driver-opt network=host \ --driver-opt network=host \
--driver-opt "env.http_proxy=$HTTP_PROXY_URL" \ --driver-opt "env.http_proxy=$HTTP_PROXY_URL" \
--driver-opt "env.https_proxy=$HTTP_PROXY_URL" \ --driver-opt "env.https_proxy=$HTTP_PROXY_URL" \
--driver-opt "env.HTTP_PROXY=$HTTP_PROXY_URL" \
--driver-opt "env.HTTPS_PROXY=$HTTP_PROXY_URL" \
--driver-opt "env.no_proxy=reg.nxsir.cn" \ --driver-opt "env.no_proxy=reg.nxsir.cn" \
--driver-opt "env.NO_PROXY=reg.nxsir.cn" \
--use --use
./scripts/ci-docker.sh buildx inspect "$BUILDER_NAME" --bootstrap ./scripts/ci-docker.sh buildx inspect "$BUILDER_NAME" --bootstrap
''' '''
@@ -218,9 +221,12 @@ pipeline {
)]) { )]) {
sh ''' sh '''
set -euo pipefail set -euo pipefail
set +x
auth=$(printf '%s:%s' "$HARBOR_USERNAME" "$HARBOR_PASSWORD" | base64 -w0) auth=$(printf '%s:%s' "$HARBOR_USERNAME" "$HARBOR_PASSWORD" | base64 -w0)
printf '{"auths":{"%s":{"auth":"%s"}}}\n' "$REGISTRY_URL" "$auth" >"$DOCKER_CONFIG/config.json" printf '{"auths":{"%s":{"auth":"%s"}}}\n' "$REGISTRY_URL" "$auth" >"$DOCKER_CONFIG/config.json"
chmod 600 "$DOCKER_CONFIG/config.json" chmod 600 "$DOCKER_CONFIG/config.json"
unset auth
set -x
''' '''
} }
} }