Merge pull request '在 VM Runner 中构建发布镜像' (#17) from refactor/publish-on-vm into main
test / python (push) Successful in 10s
test / shell (push) Successful in 15s
publish images / publish-images (push) Failing after 0s

Reviewed-on: #17
This commit was merged in pull request #17.
This commit is contained in:
2026-09-16 18:29:26 +00:00
+2 -34
View File
@@ -17,7 +17,7 @@ on:
jobs:
publish-images:
name: publish-images
runs-on: [self-hosted, pod]
runs-on: [self-hosted, vm]
timeout-minutes: 45
permissions:
contents: read
@@ -41,29 +41,6 @@ jobs:
apt-get install --yes --no-install-recommends shellcheck
shellcheck scripts/*
- name: Start Docker
shell: bash
run: |
set -euo pipefail
# The runner Pod itself uses an overlay filesystem. A nested overlay
# snapshotter cannot mount there, so use the copy-based vfs driver.
dockerd \
--storage-driver=vfs \
--feature containerd-snapshotter=false \
>/tmp/dockerd.log 2>&1 &
for _ in $(seq 1 60); do
if docker info >/dev/null 2>&1; then
exit 0
fi
if ! kill -0 "$!" 2>/dev/null; then
cat /tmp/dockerd.log >&2
exit 1
fi
sleep 1
done
cat /tmp/dockerd.log >&2
exit 1
- name: Build and publish
shell: bash
run: |
@@ -74,10 +51,9 @@ jobs:
image_tag="sha-${GITHUB_SHA}"
docker_config=$(mktemp -d)
jwt_file=$(mktemp)
buildkit_config=$(mktemp)
cleanup() {
docker buildx rm ci-builder >/dev/null 2>&1 || true
rm -rf -- "$docker_config" "$jwt_file" "$buildkit_config"
rm -rf -- "$docker_config" "$jwt_file"
}
trap cleanup EXIT
export DOCKER_CONFIG="$docker_config"
@@ -90,17 +66,9 @@ jobs:
jq -er '.[0].svids[0].svid' "$jwt_file" | \
docker login "$PUSH_REGISTRY" --username zot --password-stdin
# The docker driver cannot publish attestations. Use an isolated
# BuildKit worker, but force its snapshotter to copy-based native so
# it does not attempt nested overlay mounts inside the runner Pod.
printf '%s\n' \
'[worker.oci]' \
' snapshotter = "native"' \
>"$buildkit_config"
docker buildx create \
--name ci-builder \
--driver docker-container \
--buildkitd-config "$buildkit_config" \
--use
publish() {