ci: harden registry proxy and manifest output

This commit is contained in:
2026-08-12 00:02:14 +08:00
parent a07294b1b8
commit c321d020dd
Vendored
+8 -2
View File
@@ -133,7 +133,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.no_proxy=reg.nxsir.cn" --use --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" --use
./scripts/ci-docker.sh buildx inspect "$BUILDER_NAME" --bootstrap ./scripts/ci-docker.sh buildx inspect "$BUILDER_NAME" --bootstrap
./scripts/ci-docker.sh buildx build --builder "$BUILDER_NAME" --platform linux/amd64 --network host \ ./scripts/ci-docker.sh buildx build --builder "$BUILDER_NAME" --platform linux/amd64 --network host \
--progress=plain --provenance=false --no-cache --load \ --progress=plain --provenance=false --no-cache --load \
@@ -184,9 +187,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
./scripts/ci-docker.sh push "$IMAGE_REF" ./scripts/ci-docker.sh push "$IMAGE_REF"
digest=$(./scripts/ci-docker.sh image inspect --format '{{index .RepoDigests 0}}' "$IMAGE_REF" | sed -n 's/.*@//p'); test -n "$digest"; export digest digest=$(./scripts/ci-docker.sh image inspect --format '{{index .RepoDigests 0}}' "$IMAGE_REF" | sed -n 's/.*@//p'); test -n "$digest"; export digest
fpk_sha=$(awk '{print $1}' "$FPK_PATH.sha256"); export fpk_sha fpk_sha=$(awk '{print $1}' "$FPK_PATH.sha256"); export fpk_sha
@@ -201,7 +207,7 @@ payload = {
'image':os.environ['IMAGE_REF'],'digest':os.environ['digest'],'platform':'linux/amd64', 'image':os.environ['IMAGE_REF'],'digest':os.environ['digest'],'platform':'linux/amd64',
'database':'PostgreSQL 15 + pgvector 0.8.6 (embedded Docker runtime)' 'database':'PostgreSQL 15 + pgvector 0.8.6 (embedded Docker runtime)'
} }
path.write_text(json.dumps(payload,ensure_ascii=False,indent=2)+'\n',encoding='utf-8') path.write_text(json.dumps(payload,ensure_ascii=False,indent=2)+chr(10),encoding='utf-8')
PY PY
sha256sum "$MANIFEST_PATH" >"$MANIFEST_PATH.sha256" sha256sum "$MANIFEST_PATH" >"$MANIFEST_PATH.sha256"
''' '''