Diagnostics: recursive container rescue snapshotΒΆ
container.py is the single failure-diagnostics entry point. The CI
workflows (compose + swarm) call it once on the runner when a job fails;
it captures the current level and then recurses itself through every
Docker-in-Docker boundary, so one call collects evidence from the
outermost runner down to the innermost application container. It always
exits 1.
flowchart TB
subgraph entry["π©Ί One workflow call on failure()"]
wf["βοΈ CI step (compose + swarm identical)<br/>INFINITO_RESCUE_DIAGNOSTICS_DIR=/tmp/rescue-diagnostics/<app><br/>python3 utils/diagnostics/container.py <app> <context>"]:::infra
end
subgraph level["πΈ Per-level capture (repeated on every depth)"]
direction TB
host["π₯οΈ Host facts<br/>meta, uname, df/free/uptime,<br/>journal, dmesg OOM evidence"]:::store
dumps["π local-dumps/<br/>in-play role evidence from<br/>DIR_RESCUE_DIAGNOSTICS (pg_hba, xwiki)"]:::store
rtc["π³ Runtime state<br/>info, stats, ps -a,<br/>per-container logs + inspect"]:::store
svc["π Swarm services<br/>ls, per-service ps + logs"]:::store
end
subgraph recursion["π Recursion (RESCUE_MAX_DEPTH, default 3)"]
direction TB
probe["π For every RUNNING container:<br/>has python3 + docker/container runtime?"]:::step
copy["π€ Copy itself in<br/>(stdin β /tmp/rescue-self.py)"]:::step
nested["π©Ί Run nested capture<br/>RESCUE_DEPTH+1, own staging dir"]:::step
pull["π₯ tar the nested snapshot back to<br/>containers/<name>/nested/ + clean up"]:::step
probe -->|yes| copy --> nested --> pull
probe -.->|no: plain app container,<br/>logs already captured| skipped["βοΈ skip"]:::skip
end
wf --> level --> recursion
nested -.->|same program,<br/>one level deeper| level
result["ποΈ Artifact tree (uploaded by CI)<br/><app>-<stamp>-<pid>/<br/>βββ meta/system/journal/β¦<br/>βββ local-dumps/β¦<br/>βββ containers/<name>.log + .inspect.json<br/>βββ containers/<did-node>/nested/<app>-β¦/ (recursion)<br/>βββ services/<svc>.log + .ps.txt"]:::store
recursion --> result
classDef infra fill:#f3f7fb,stroke:#d6e2ee,color:#455a64;
classDef store fill:#f1f8f6,stroke:#d5e7e2,color:#455a64;
classDef step fill:#fbf6f0,stroke:#eee1cf,color:#455a64;
classDef skip fill:#f7f8f9,stroke:#e3e6e9,color:#455a64;
style entry fill:#ffffff,stroke:#e6e6e6;
style level fill:#ffffff,stroke:#e6e6e6;
style recursion fill:#ffffff,stroke:#e6e6e6;
Ansible rescue: blocks are forbidden
(tests/lint/ansible/structure/test_no_rescue_blocks.py); the rare
justified block (# nocheck: rescue-<reason>) leaves its role-specific
evidence in DIR_RESCUE_DIAGNOSTICS, which every capture level ships as
local-dumps/.