Files
computer-playbook/roles/sys-svc-compose/tasks/04_files.yml
kevinveenbirkenbachandClaude Opus 5.5 86f22146ab fix(sys-svc-compose): resume only a marker an earlier run left behind
The resume check stats the pending marker after 04_files.yml has
written it, so it fired in every run that changed a compose file,
logged that the last compose up never completed, and notified
compose-build on top of the compose-up the change had already
notified. A PR CI compose deploy showed it for every role
("Resume the compose up a failed run left pending => changed" right
after "Mark compose up pending => changed").

The marker task now registers its result, and the resume task skips a
marker that this run wrote. A marker a failed run left behind is
unchanged when the file task meets it, so it is still resumed.

Refs #1169

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 10:24:51 +02:00

81 lines
2.6 KiB
YAML

---
- name: "🔍 Find optional Dockerfile for {{ application_id }}"
set_fact:
dockerfile_src: >-
{{ lookup(
'first_found',
{
'files': [
application_id | abs_role_path_by_application_id ~ '/templates/Dockerfile.j2',
application_id | abs_role_path_by_application_id ~ '/files/Dockerfile'
]
},
errors='ignore'
) | default('', true)
}}
- name: "📁 Create (optional) Dockerfile for {{ application_id }}"
stack_host_template:
src: "{{ dockerfile_src }}"
dest: "{{ lookup('container', application_id, 'files.dockerfile') }}"
mode: "0640"
notify:
- compose-build
- compose-up
register: dockerfile_template
when:
- dockerfile_src | default('') | length > 0
- name: "📁 Create (optional) '{{ lookup('container', application_id, 'files.env') }}'"
stack_host_template:
src: "{{ item }}"
dest: "{{ lookup('container', application_id, 'files.env') }}"
mode: "0640"
force: true
notify:
- compose-up
- compose-build
with_first_found:
- files:
- "{{ application_id | abs_role_path_by_application_id }}/templates/env.j2"
- "{{ application_id | abs_role_path_by_application_id }}/files/env"
skip: true
register: env_template
- name: "📁 Create (optional) compose override for '{{ application_id }}'"
stack_host_template:
src: "{{ item }}"
dest: "{{ lookup('container', application_id, 'files.compose_override') }}"
mode: "0640"
force: true
notify: compose-up
with_first_found:
- files:
- "{{ application_id | abs_role_path_by_application_id }}/templates/compose.override.yml.j2"
- "{{ application_id | abs_role_path_by_application_id }}/files/compose.override.yml"
skip: true
register: compose_override_template
- name: "📁 Create (optional) '{{ lookup('container', application_id, 'files.compose') }}'"
stack_host_template:
src: "{{ item }}"
dest: "{{ lookup('container', application_id, 'files.compose') }}"
mode: "0640"
force: true
with_first_found:
- files:
- "compose.yml.j2"
skip: true
register: docker_compose_template
notify: compose-up
- name: "📌 Mark compose up pending for '{{ application_id }}' until it succeeds"
stack_host_copy:
content: ""
dest: "{{ COMPOSE_UP_PENDING_MARKER }}"
mode: "0640"
register: compose_up_marker
when:
- compose_mode == 'compose'
- dockerfile_template.changed or env_template.changed or compose_override_template.changed or docker_compose_template.changed