Pin molecule and its Docker driver in requirements-dev.txt and bake them, with the driver's collection, into the ci image. The Molecule job runs docker run on the pinned ci image with the Docker socket and the checkout mounted at the same path, as the runner user. A pull request whose pins differ from the image installs its own pins first, so a core bump runs its scenarios on the new core. gitea_runner no longer installs the molecule venv and collections. Closes #225 Assisted-by: Claude Code
82 lines
3.7 KiB
YAML
82 lines
3.7 KiB
YAML
---
|
|
# Input checks. Imported first in main.yml with tags: always, so a bad input fails before any
|
|
# change, whatever tags the run selects.
|
|
- name: Require a plain gitea_runner_version
|
|
ansible.builtin.assert:
|
|
that:
|
|
- gitea_runner_version is string
|
|
- gitea_runner_version is match('^[0-9]+\\.[0-9]+\\.[0-9]+$')
|
|
fail_msg: >-
|
|
gitea_runner_version must be a plain release number such as 6.0.1, with no leading v: it is
|
|
used in the download URL and compared with what the binary reports.
|
|
quiet: true
|
|
|
|
# Checks the format only. Together with minting the token first, a malformed scope or a
|
|
# failed mint stops the play before a forced re-registration drops .runner.
|
|
- name: Require a valid registration scope
|
|
ansible.builtin.assert:
|
|
that:
|
|
- gitea_runner_registration_scope is string
|
|
- gitea_runner_registration_scope | length == 0 or gitea_runner_registration_scope is match('^[A-Za-z0-9_.-]+(/[A-Za-z0-9_.-]+)?$')
|
|
fail_msg: >-
|
|
gitea_runner_registration_scope must be empty (instance-wide), an owner (user or organisation)
|
|
or owner/repo, got '{{ gitea_runner_registration_scope }}'.
|
|
quiet: true
|
|
|
|
# The values land in systemd unit files: a newline or % would inject or expand directives.
|
|
- name: Validate the Docker prune settings
|
|
ansible.builtin.assert:
|
|
that:
|
|
- gitea_runner_docker_prune_schedule is match('^[A-Za-z0-9 :*,./~-]+$')
|
|
- gitea_runner_docker_prune_container_age is match('^[0-9]+[smh]$')
|
|
- gitea_runner_docker_prune_image_age is match('^[0-9]+[smh]$')
|
|
fail_msg: >-
|
|
gitea_runner_docker_prune_schedule must be a plain OnCalendar value (no newline or %),
|
|
the two ages a number with s, m or h (e.g. 168h).
|
|
quiet: true
|
|
when: gitea_runner_docker_prune_enabled | bool
|
|
|
|
- name: Validate the Docker prune count
|
|
ansible.builtin.assert:
|
|
that: gitea_runner_docker_prune_keep_per_repository | int >= 0
|
|
fail_msg: gitea_runner_docker_prune_keep_per_repository must be 0 (off) or more.
|
|
quiet: true
|
|
when: gitea_runner_docker_prune_enabled | bool
|
|
|
|
- name: Validate the Docker prune disk threshold
|
|
ansible.builtin.assert:
|
|
that:
|
|
- gitea_runner_docker_prune_disk_threshold_percent | int >= 0
|
|
- gitea_runner_docker_prune_disk_threshold_percent | int <= 99
|
|
fail_msg: gitea_runner_docker_prune_disk_threshold_percent must be 0 (off) or 1 to 99.
|
|
quiet: true
|
|
when: gitea_runner_docker_prune_enabled | bool
|
|
|
|
# Same character set as the weekly schedule.
|
|
- name: Validate the Docker prune disk check schedule
|
|
ansible.builtin.assert:
|
|
that: gitea_runner_docker_prune_disk_check_schedule is match('^[A-Za-z0-9 :*,./~-]+$')
|
|
fail_msg: gitea_runner_docker_prune_disk_check_schedule must be a plain OnCalendar value (no newline or %).
|
|
quiet: true
|
|
when: gitea_runner_docker_prune_enabled | bool
|
|
|
|
# A subset of the units Docker accepts for --keep-storage.
|
|
- name: Validate the Docker builder keep-storage size
|
|
ansible.builtin.assert:
|
|
that: gitea_runner_docker_prune_builder_keep_storage is match('^[0-9]+(B|KB|MB|GB|TB)?$')
|
|
fail_msg: >-
|
|
gitea_runner_docker_prune_builder_keep_storage must be a number with an optional B, KB, MB, GB or TB (e.g. 10GB).
|
|
quiet: true
|
|
when: gitea_runner_docker_prune_enabled | bool
|
|
|
|
- name: Require a count for the pressure prune
|
|
ansible.builtin.assert:
|
|
that: >-
|
|
gitea_runner_docker_prune_disk_threshold_percent | int == 0
|
|
or gitea_runner_docker_prune_keep_per_repository | int > 0
|
|
fail_msg: >-
|
|
gitea_runner_docker_prune_disk_threshold_percent needs gitea_runner_docker_prune_keep_per_repository above 0:
|
|
the pressure prune removes images by that count.
|
|
quiet: true
|
|
when: gitea_runner_docker_prune_enabled | bool
|