When given the "run" argument, in addition to launching `podman system service` in the background, also start a small periodic maintenance script. It's only job is to clean up stale images, containers, and volumes from old jobs. Currently hard-coded to trigger every 2 days, this could be tweaked via build-args or env. var. Signed-off-by: Chris Evich <cevich@redhat.com>
22 lines
589 B
Bash
22 lines
589 B
Bash
#!/bin/bash
|
|
|
|
# This script is intended to be called as the entrypoint for
|
|
# a podman-in-podman gitlab runner container. Any usage
|
|
# outside that context is not supported and may cause harm.
|
|
|
|
set -e
|
|
|
|
unset _debug_args
|
|
if [[ -n "$PODMAN_RUNNER_DEBUG" ]]; then
|
|
_debug_args="--log-level=$PODMAN_RUNNER_DEBUG"
|
|
fi
|
|
|
|
if [[ "$1" == "run" ]] && [[ ! -S "/tmp/podman-run-1000/podman/podman.sock" ]]; then
|
|
podman $_debug_args system service -t 0 &
|
|
/usr/local/bin/podman-in-podman-maintenance &
|
|
# Prevent SIGHUP propagation to podman process
|
|
disown -ar
|
|
fi
|
|
|
|
exec gitlab-runner "$@"
|