deploy/gitbay-runner-prune.service
17 lines · 768 bytes
1# Paired with gitbay-runner-prune.timer. Runs as the runner's own user,
2# because rootless podman's store belongs to that user and root's prune
3# would not see it.
4[Unit]
5Description=Prune unused podman images on the CI runner
6
7[Service]
8Type=oneshot
9User=ci-runner
10# Rootless podman reads storage.conf under HOME; a User= unit does not
11# set it.
12Environment=HOME=/var/lib/gitbay-runner
13# Images not used by a container and created more than a week ago. A
14# registry image is pulled again on next use. A locally built image cannot
15# be, so one labelled org.gitbay.keep=true (deploy/Containerfile.ci) is kept.
16ExecStart=/usr/bin/podman image prune --all --force --filter until=168h --filter label!=org.gitbay.keep=true
17ExecStart=/usr/bin/podman container prune --force