Build musl and glibc for amd64 and arm64 through one native package path. Reuse musl outputs for OCI images and OpenWrt installers, and export binaries inside a rootless unshare session. Restore the executable dependency graph into a shared persistent NuGet cache, build managed dependencies once, and run isolated native publishes in parallel. Clean temporary outputs and expired image layers under store locks, retire inactive legacy stores after seven days, and retain two toolchain exports. Add regression coverage for staging, extraction, packaging and cleanup boundaries.
24 lines
1.2 KiB
Bash
24 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
# Caller holds its store lock. Keep recent image layers and persistent RUN caches.
|
|
set -euo pipefail
|
|
: "${CONTAINERS_STORAGE_CONF:?an explicit, locked CI Buildah store is required}"
|
|
# prune also deletes RUN cache mounts; remove only expired intermediate layers and versioned application images.
|
|
mapfile -t expired < <(buildah images --all --no-trunc --format '{{.ID}} {{.Created}} {{.Name}}:{{.Tag}}' | python3 -c '
|
|
import re,sys,time
|
|
cutoff=time.time()-7*86400
|
|
for line in sys.stdin:
|
|
fields=line.split()
|
|
if len(fields)!=3 or float(fields[1]) >= cutoff:
|
|
continue
|
|
name=fields[2]
|
|
if name in ("<none>:<none>", ":") or re.fullmatch(r"localhost/moshiro-(agent|backend):[0-9][A-Za-z0-9._-]*",name):
|
|
print(fields[0])
|
|
')
|
|
for image in "${expired[@]}"; do
|
|
# No force: a layer still referenced by another image/container is retained.
|
|
buildah rmi "$image" >/dev/null 2>&1 || true
|
|
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
|