fix(orchestrator): Drop subprocess stdout from woodpecker-apply phase result#640
Conversation
… result
`_phase_woodpecker_apply` was the only CalledProcessError handler in
the file that surfaced exc.output into the PhaseResult.detail (as a
sliced "tail" of the last stdout line, truncated to 120 chars). The
six other handlers (infisical-bootstrap, services-configure,
gitea-configure, seed, kestra-register, woodpecker-oauth) all stick
to `type(exc).__name__` + rc and let `docker logs <container>` /
`docker compose logs` be the source of truth for the full output.
exc.output here is the captured stdout of `docker compose up -d` for
the woodpecker stack. Modern compose tends to print only the start
sequence ("Network … Creating", "Container … Started", etc.), but
its error branches can echo back values from the rendered env block
(e.g. when interpolation fails for a malformed variable). The
woodpecker stack's .env contains Infisical-managed secrets — the
risk of those landing in a PhaseResult that gets logged / surfaced
to the operator is non-zero.
Aligned this handler with the rest of the file: report the rc and
the exception type, no stdout excerpt. Existing test
test_phase_woodpecker_apply_partial_on_compose_up_nonzero still
passes — it only asserts on "docker compose up -d failed" and
"rc=1", both of which remain in the new detail string.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR simplifies error reporting in the ChangesWoodpecker Apply Error Handling
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
_phase_woodpecker_applywas the onlyCalledProcessErrorhandler in src/nexus_deploy/orchestrator.py that surfacedexc.outputinto thePhaseResult.detail(as a sliced last-line "tail", truncated to 120 chars). The six other handlers in the same file —infisical-bootstrap,services-configure,gitea-configure,seed,kestra-register,woodpecker-oauth— all stick totype(exc).__name__+rcand leavedocker logs/docker compose logsas the source of truth for full output.This PR aligns the woodpecker handler with the rest of the file.
Why
exc.outputhere is the captured stdout ofdocker compose up -dfor the woodpecker stack, which has a.envpopulated with Infisical-managed secrets. Modern compose prints mostly status lines (Container … Started), but its error branches can echo back values from the rendered env block (e.g. when interpolation fails for a malformed variable, the failing key=value can land in the error message). The risk of those landing in aPhaseResult.detailthat gets logged or surfaced to the operator is non-zero — and inconsistent with the convention every other handler in this file already follows.What this does NOT lose
The new detail still tells the operator everything actionable from inside Python:
woodpecker-apply)rc=1)CalledProcessError)For the full compose stack trace, the on-server
docker compose logs woodpecker/docker logs woodpecker-serveris the canonical place — which is also the convention for every other stack's deploy failure.Test plan
test_phase_woodpecker_apply_partial_on_compose_up_nonzerostill passes — it asserts"docker compose up -d failed" in result.detailand"rc=1" in result.detail, both substrings present in the new detail.uv run pytest tests/unit/ -q -k woodpecker—50 passed, 1525 deselected).docker logson the server.Summary by CodeRabbit