Files
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

62 lines
1.8 KiB
YAML

---
- name: "🔍 Check running containers for '{{ application_id }}'"
command: >-
compose ps -q --filter status=running
args:
chdir: "{{ lookup('container', application_id, 'directories.instance') }}"
register: docker_ps
changed_when: >
(docker_ps.stdout | trim) == ""
failed_when: >
docker_ps.rc != 0
and (
(docker_ps.stderr | default(''))
| regex_search('(no configuration file provided|no such file or directory|env file .* not found)') is none
)
when:
- >
not (
docker_compose_template.changed | default(false)
or
env_template.changed | default(false)
)
- compose_mode == 'compose'
notify: compose-up
- name: "🔍 Check for a compose up a failed run left pending"
ansible.builtin.stat:
path: "{{ COMPOSE_UP_PENDING_MARKER }}"
register: compose_up_pending
when: compose_mode == 'compose'
- name: "🔔 Resume the compose up a failed run left pending"
ansible.builtin.debug:
msg: "{{ COMPOSE_UP_PENDING_MARKER }} is still present, so the last compose up never completed"
changed_when: true
notify:
- compose-build
- compose-up
when:
- compose_mode == 'compose'
- compose_up_pending.stat.exists
- compose_up_marker is not changed
- name: "🔔 Notify swarm deploy (under DEPLOYMENT_MODE == swarm)"
ansible.builtin.debug:
msg: "Triggering swarm stack deploy for {{ application_id }}"
changed_when: true
when: compose_mode == 'swarm'
notify: swarm-deploy
- name: "🔄 Flush compose up handlers for '{{ application_id }}'"
meta: flush_handlers
when: compose_handlers_flush | bool
- name: "🚀 Post-deploy steps for '{{ application_id }}'"
ansible.builtin.include_tasks:
file: post_deploy.yml
apply:
delegate_to: "{{ STACK_HOST }}"
run_once: true
when: compose_handlers_flush | bool