ci: keep build cache cleanup best-effort in the restore step [CI]
ci/woodpecker/push/web-build Pipeline was successful
ci/woodpecker/push/verify Pipeline was successful
ci/woodpecker/push/dev-image Pipeline failed

The restore step failed after restoring every dependency because the final cache cleanup (buildah unshare reporting memfd_create) was not guarded. Cleanup failures now only warn, and a test requires every cleanup call to be guarded.
This commit is contained in:
justme committed 2026-10-21 14:41:28 +08:00
1 parent c6d0c8637e
commit 13c16ad9c7
3 files changed
+16 -2

No files matched your search

+4 -1
View File
@@ -24,4 +24,7 @@ for image in "${expired[@]}"; do
done
echo "expired build layers considered: ${#expired[@]} (retention: 7 days; NuGet cache retained)"
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
buildah unshare python3 "$root/ci/cleanup-retired-stores.py" /home/justme/woodpecker/buildah-home
# 旧的 Buildah 存储目录需要在 buildah unshare 里删(属主是映射后的 uid);这台主机上 unshare 失败时(memfd_create 之类)只警告,下次再试,不影响调用方。
if ! buildah unshare python3 "$root/ci/cleanup-retired-stores.py" /home/justme/woodpecker/buildah-home; then
echo 'warning: retired Buildah stores were not cleaned (buildah unshare failed); the next run retries' >&2
fi
+2 -1
View File
@@ -149,8 +149,9 @@ PY
done
flock -u 9
agent_lock_held=false
# 清理只是尽力而为:依赖已经还原好了,清理失败(比如 buildah unshare 在这台主机上报 memfd_create 错误)不能让这一步失败
if flock -n -x 9; then
bash "$root/ci/cleanup-build-cache.sh"
bash "$root/ci/cleanup-build-cache.sh" || echo 'warning: build cache cleanup failed' >&2
flock -u 9
fi
fi