fix(digest): digest 汇总文件改 mktemp(PLAT-014 二段:宿主非 root 撞容器 chown 后的 workspace)
run 924 build 红根因:容器 install chown -R node:node workspace → 宿主 digest 步 mkdir -p .tmp-ci EACCES(897 时代 runner 为 root 故绿;治理后必红)。 修法:digest/manifest 暂存文件改宿主 mktemp 目录(runner 自建 tmp 可写), 两处 digest 步(verify/script 路径)同修。合并后打 v5。
This commit is contained in:
@@ -193,8 +193,11 @@ jobs:
|
|||||||
set -eu
|
set -eu
|
||||||
IMAGE_TAG="git-${GITHUB_SHA}"
|
IMAGE_TAG="git-${GITHUB_SHA}"
|
||||||
printf '%s' "${GITHUB_SHA}" | grep -Eq '^[0-9a-f]{40}$'
|
printf '%s' "${GITHUB_SHA}" | grep -Eq '^[0-9a-f]{40}$'
|
||||||
mkdir -p .tmp-ci
|
# PLAT-014: the containerized install chowns the workspace to the
|
||||||
digest_file=".tmp-ci/digests.txt"
|
# helper's node user, so a host-side mkdir in $PWD fails with EACCES
|
||||||
|
# on the non-root runner. Keep host-written scratch in mktemp space.
|
||||||
|
digest_dir="$(mktemp -d)"
|
||||||
|
digest_file="$digest_dir/digests.txt"
|
||||||
: >"$digest_file"
|
: >"$digest_file"
|
||||||
cache_args=""
|
cache_args=""
|
||||||
if [ -n "${CACHE_REGISTRY_REF}" ]; then
|
if [ -n "${CACHE_REGISTRY_REF}" ]; then
|
||||||
@@ -248,7 +251,7 @@ jobs:
|
|||||||
--provenance=mode=max \
|
--provenance=mode=max \
|
||||||
--sbom=true \
|
--sbom=true \
|
||||||
--push .
|
--push .
|
||||||
manifest_file=".tmp-ci/index-${service}.json"
|
manifest_file="${digest_dir}/index-${service}.json"
|
||||||
docker buildx imagetools inspect "${image}" --raw >"$manifest_file"
|
docker buildx imagetools inspect "${image}" --raw >"$manifest_file"
|
||||||
if [ -n "${VERIFY_COMMAND}" ]; then
|
if [ -n "${VERIFY_COMMAND}" ]; then
|
||||||
# VERIFY_COMMAND carries its own interpreter (e.g. "node x.mjs"
|
# VERIFY_COMMAND carries its own interpreter (e.g. "node x.mjs"
|
||||||
@@ -284,8 +287,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
image_tag="git-${GITHUB_SHA}"
|
image_tag="git-${GITHUB_SHA}"
|
||||||
digest_file=".tmp-ci/digests-script.txt"
|
digest_dir="$(mktemp -d)"
|
||||||
mkdir -p .tmp-ci
|
digest_file="${digest_dir}/digests-script.txt"
|
||||||
: >"$digest_file"
|
: >"$digest_file"
|
||||||
while IFS='|' read -r service dockerfile target; do
|
while IFS='|' read -r service dockerfile target; do
|
||||||
[ -n "${service:-}" ] || continue
|
[ -n "${service:-}" ] || continue
|
||||||
|
|||||||
Reference in New Issue
Block a user