Files
grm/ansible/roles/gitea_runner/tasks/pre_pull_images.yml
T
emo d9dae396bc
Post-merge / detect-and-configure (push) Successful in 2m52s
Post-merge / release-and-maintain (push) Successful in 1m13s
GRM-172: docs: document pre-pull image usage guidelines
Co-authored-by: emo <emo@oblachno.com>
2026-08-27 16:04:45 +00:00

38 lines
1.7 KiB
YAML

---
# Pre-pull Docker images that CI runners need to avoid pulling them on
# every CI run. The runner container image (ci-full) is large (~3.3GB)
# and pulling it on every run causes timeouts and disk pressure.
#
# The healthcheck script's disk-space prune only removes dangling images
# (not tagged ones), so pre-pulled images persist between CI runs.
#
# Set gitea_runner_pre_pull_images to a list of image refs to pull, or
# empty list to skip pre-pulling.
#
# IMPORTANT: Do NOT use this mechanism for:
# - CI runner container images (e.g. ci-full) — these are already
# cached by the runner setup task and pulling them here is redundant.
# - Images that molecule tests pull themselves — molecule prepare/converge
# steps handle their own image pulls; pre-pulling them here wastes time
# and disk space.
# This mechanism is intended only for images that are needed by the runner
# itself but not pulled by any molecule scenario or runner setup step.
- name: Pre-pull Docker images for CI runner
ansible.builtin.command: "docker pull {{ item }}"
become: true
become_user: "{{ gitea_runner_service_user }}"
environment:
DOCKER_HOST: "unix:///run/user/{{ gitea_runner_uid }}/docker.sock"
XDG_RUNTIME_DIR: "/run/user/{{ gitea_runner_uid }}"
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ gitea_runner_uid | default(0) }}/bus"
register: gitea_runner_pre_pull_result
changed_when: "'Status: Downloaded' in gitea_runner_pre_pull_result.stdout or 'Status: Downloaded' in gitea_runner_pre_pull_result.stderr"
retries: 3
delay: 5
until: gitea_runner_pre_pull_result is success
loop: "{{ gitea_runner_pre_pull_images }}"
when:
- gitea_runner_docker_rootless_setup
- gitea_runner_pre_pull_images | length > 0