mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
An untyped inspect searches every docker object kind, and a role's overlay network carries the same entity name as its main container, so the call can resolve the network and report a missing State key instead of naming the container. That is how the openresty assert died on every swarm job of run 30709070050. Extend container-exec-resolver to cover inspect, stripping raw markers and quoted spans first so the flag walker survives Go template format strings. Add container-inspect-type, scoped to roles/ because the collision follows the entity naming convention and the outer act namespace carries no role networks. Sweep 40 call sites; suppress the delegate_to-resolved CIDs and the compose co-location probes with a stated reason. Move the five container rules into tests/lint/ansible/shell/container/ and drop the container_ prefix from their filenames. Register both markers in the suppression docs, where the resolver marker was missing entirely. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
68 lines
3.0 KiB
YAML
68 lines
3.0 KiB
YAML
---
|
|
- name: ⏳ Wait until OpenProject web container is running (compose)
|
|
shell: >
|
|
container inspect --type container
|
|
-f '{{"{{"}}.State.Status{{"}}"}}' {{ OPENPROJECT_WEB_CONTAINER_ADDRESS }}
|
|
register: openproject_web_state
|
|
retries: 60
|
|
delay: 5
|
|
until: openproject_web_state.stdout.strip() == "running"
|
|
changed_when: false
|
|
when: DEPLOYMENT_MODE == 'compose'
|
|
|
|
- name: ⏳ Wait until OpenProject web service converged (swarm)
|
|
ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/wait_converged.yml') }}"
|
|
vars:
|
|
wait_service_key: "{{ OPENPROJECT_WEB_SERVICE }}"
|
|
|
|
- name: "🔍 Resolve the OpenProject web hosting node and container id"
|
|
ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}"
|
|
vars:
|
|
resolve_service_key: "{{ OPENPROJECT_WEB_SERVICE }}"
|
|
resolve_service_name: "{{ lookup('container_service', application_id, OPENPROJECT_WEB_SERVICE) }}"
|
|
resolve_output_prefix: OPENPROJECT_WEB
|
|
resolve_compose_cid: "{{ OPENPROJECT_WEB_CONTAINER_ADDRESS }}"
|
|
resolve_converge_retries: 120
|
|
resolve_converge_delay: 5
|
|
|
|
- name: ▶️ Run database migrations
|
|
shell: >- # nocheck: container-exec-resolver OPENPROJECT_WEB_LOCAL_CID resolved at delegate_to runtime; container_address would return a manager-only subshell
|
|
container exec -i {{ OPENPROJECT_WEB_LOCAL_CID | quote }} bash -lc
|
|
"cd /app && bin/rails db:migrate RAILS_ENV=production"
|
|
delegate_to: "{{ OPENPROJECT_WEB_HOST_NODE }}"
|
|
register: openproject_migrate
|
|
retries: 30
|
|
delay: 10
|
|
until: openproject_migrate.rc == 0
|
|
|
|
- name: ⏳ Wait until OpenProject web container is running (after migrations, compose)
|
|
shell: >
|
|
container inspect --type container
|
|
-f '{{"{{"}}.State.Status{{"}}"}}' {{ OPENPROJECT_WEB_CONTAINER_ADDRESS }}
|
|
register: openproject_web_state_after_migrate
|
|
retries: 60
|
|
delay: 5
|
|
until: openproject_web_state_after_migrate.stdout.strip() == "running"
|
|
changed_when: false
|
|
when: DEPLOYMENT_MODE == 'compose'
|
|
|
|
- name: ⏳ Wait until OpenProject web service converged (after migrations, swarm)
|
|
ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/wait_converged.yml') }}"
|
|
vars:
|
|
wait_service_key: "{{ OPENPROJECT_WEB_SERVICE }}"
|
|
|
|
- name: 🔧 Set settings in OpenProject (rails runner via STDIN from an external script)
|
|
ansible.builtin.shell:
|
|
cmd: >- # nocheck: container-exec-resolver OPENPROJECT_WEB_LOCAL_CID resolved at delegate_to runtime; container_address would return a manager-only subshell
|
|
container exec -i
|
|
-e OPENPROJECT_RAILS_SETTINGS={{ OPENPROJECT_RAILS_SETTINGS | to_json | quote }}
|
|
{{ OPENPROJECT_WEB_LOCAL_CID | quote }}
|
|
bash -lc "cd /app && bundle exec rails runner -"
|
|
stdin: "{{ lookup('file', 'ruby/apply_settings.rb') }}"
|
|
delegate_to: "{{ OPENPROJECT_WEB_HOST_NODE }}"
|
|
register: openproject_apply_settings
|
|
retries: 30
|
|
delay: 5
|
|
until: openproject_apply_settings.rc == 0
|
|
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|