ci: harden registry proxy and manifest output
This commit is contained in:
Vendored
+8
-2
@@ -118,7 +118,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 \
|
||||||
@@ -155,9 +158,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')
|
digest=$(./scripts/ci-docker.sh image inspect --format '{{index .RepoDigests 0}}' "$IMAGE_REF" | sed -n 's/.*@//p')
|
||||||
test -n "$digest"; export digest
|
test -n "$digest"; export digest
|
||||||
@@ -172,7 +178,7 @@ payload = {
|
|||||||
'fpk': pathlib.Path(os.environ['FPK_PATH']).name, 'fpkSha256': os.environ['fpk_sha'],
|
'fpk': pathlib.Path(os.environ['FPK_PATH']).name, 'fpkSha256': os.environ['fpk_sha'],
|
||||||
'image': os.environ['IMAGE_REF'], 'digest': os.environ['digest'], 'platform': 'linux/amd64'
|
'image': os.environ['IMAGE_REF'], 'digest': os.environ['digest'], 'platform': 'linux/amd64'
|
||||||
}
|
}
|
||||||
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"
|
||||||
'''
|
'''
|
||||||
|
|||||||
Reference in New Issue
Block a user