--- # 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 # The same character set as the weekly schedule; the size takes Docker's own units. - name: Validate the Docker prune count and pressure settings ansible.builtin.assert: that: - gitea_runner_docker_prune_keep_per_repository | int >= 0 - gitea_runner_docker_prune_disk_threshold_percent | int >= 0 - gitea_runner_docker_prune_disk_threshold_percent | int <= 99 - gitea_runner_docker_prune_disk_check_schedule is match('^[A-Za-z0-9 :*,./~-]+$') - gitea_runner_docker_prune_builder_keep_storage is match('^[0-9]+(B|KB|MB|GB|TB)?$') fail_msg: >- gitea_runner_docker_prune_keep_per_repository must be 0 or more, gitea_runner_docker_prune_disk_threshold_percent 0 (off) or 1 to 99, gitea_runner_docker_prune_disk_check_schedule a plain OnCalendar value (no newline or %) and gitea_runner_docker_prune_builder_keep_storage 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 - name: Require the collections requirements file for the molecule tooling ansible.builtin.assert: that: - gitea_runner_collections_requirements_file is string - gitea_runner_collections_requirements_file | length > 0 fail_msg: >- gitea_runner_molecule_enabled is true, so gitea_runner_collections_requirements_file must name the collections requirements file on the control host that the molecule install reads. quiet: true when: gitea_runner_molecule_enabled | bool