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
32 lines
2.3 KiB
YAML
32 lines
2.3 KiB
YAML
---
|
|
# One refused input: runs the main entry point with that input and asserts that the expected
|
|
# assert, not something else, stopped it. Input: gitea_runner_test_refused (name, vars, expect).
|
|
# Task vars cannot come from a template as a whole, so each input under test is passed with
|
|
# its usual value as the default.
|
|
- name: "Run the role, case {{ gitea_runner_test_refused.name }}"
|
|
block:
|
|
- name: "Include the role, case {{ gitea_runner_test_refused.name }}"
|
|
ansible.builtin.include_role:
|
|
name: mortis.kamino.gitea_runner
|
|
vars:
|
|
gitea_runner_version: "{{ gitea_runner_test_refused.vars.gitea_runner_version | default('6.0.1') }}"
|
|
gitea_runner_registration_scope: "{{ gitea_runner_test_refused.vars.gitea_runner_registration_scope | default('') }}"
|
|
gitea_runner_docker_prune_schedule: "{{ gitea_runner_test_refused.vars.gitea_runner_docker_prune_schedule | default('Sun *-*-* 04:30:00') }}"
|
|
gitea_runner_docker_prune_image_age: "{{ gitea_runner_test_refused.vars.gitea_runner_docker_prune_image_age | default('168h') }}"
|
|
gitea_runner_docker_prune_keep_per_repository: "{{ gitea_runner_test_refused.vars.gitea_runner_docker_prune_keep_per_repository | default(2) }}"
|
|
gitea_runner_docker_prune_disk_threshold_percent: "{{ gitea_runner_test_refused.vars.gitea_runner_docker_prune_disk_threshold_percent | default(90) }}"
|
|
gitea_runner_docker_prune_disk_check_schedule: "{{ gitea_runner_test_refused.vars.gitea_runner_docker_prune_disk_check_schedule | default('hourly') }}"
|
|
gitea_runner_docker_prune_builder_keep_storage: "{{ gitea_runner_test_refused.vars.gitea_runner_docker_prune_builder_keep_storage | default('10GB') }}"
|
|
|
|
# Only reached when the include returned. The message must not contain the expected
|
|
# text, so the rescue below cannot mistake it for the assert.
|
|
- name: "Fail because the include returned, case {{ gitea_runner_test_refused.name }}"
|
|
ansible.builtin.fail:
|
|
msg: The role accepted the input
|
|
rescue:
|
|
- name: "The expected assert fired, case {{ gitea_runner_test_refused.name }}"
|
|
ansible.builtin.assert:
|
|
that: gitea_runner_test_refused.expect in ansible_failed_result.msg | default('')
|
|
fail_msg: "Expected '{{ gitea_runner_test_refused.expect }}', got: {{ ansible_failed_result.msg | default('') }}"
|
|
quiet: true
|