Inventory tagged images across tasks before scoped cleanup
runner tagged image ownership inventory / diagnose (push) Successful in 22s
runner tagged image ownership inventory / diagnose (push) Successful in 22s
This commit is contained in:
@@ -1,27 +1,20 @@
|
|||||||
name: runner old dangling image cache recovery
|
name: runner tagged image ownership inventory
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [codex/creative-browser-diagnosis]
|
branches: [codex/creative-browser-diagnosis]
|
||||||
jobs:
|
jobs:
|
||||||
diagnose:
|
diagnose:
|
||||||
runs-on: ces-control
|
runs-on: ces-control
|
||||||
timeout-minutes: 15
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- name: Reclaim old untagged unused image cache without volumes or tagged releases
|
- name: Inventory tagged image repositories and container references without deleting
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
df -h /
|
df -h /
|
||||||
echo 'Dangling image cache count (before age filtering)'
|
docker image ls --no-trunc --format 'IMAGE {{json .}}'
|
||||||
docker image ls -q --filter dangling=true | sort -u | wc -l
|
ids=$(docker ps -aq)
|
||||||
python3 -u - <<'PY'
|
if [ -n "$ids" ]; then
|
||||||
import json,subprocess,shutil,time,urllib.request
|
docker inspect --format 'CONTAINER {{.Name}} status={{.State.Status}} image={{.Image}} tag={{.Config.Image}} project={{with index .Config "Labels"}}{{index . "com.docker.compose.project"}}{{end}}' $ids
|
||||||
before=shutil.disk_usage('/').free
|
fi
|
||||||
# Default dangling-only mode. Do not add --all or use system/volume prune.
|
echo 'DEPLOYMENT ROOT DIRECTORIES (names only)'
|
||||||
subprocess.run(['docker','image','prune','--force','--filter','until=24h'],check=True)
|
find /opt -mindepth 1 -maxdepth 2 -type d -print
|
||||||
time.sleep(5)
|
|
||||||
after=shutil.disk_usage('/').free
|
|
||||||
print('DANGLING RECOVERY '+json.dumps({'beforeFreeBytes':before,'afterFreeBytes':after,'netRecoveredBytes':after-before}),flush=True)
|
|
||||||
with urllib.request.urlopen('http://8.211.154.134:18131/api/health',timeout=20) as response:
|
|
||||||
print('PUBLIC HEALTH '+response.read().decode(),flush=True)
|
|
||||||
PY
|
|
||||||
df -h /
|
|
||||||
|
|||||||
Reference in New Issue
Block a user