Interview Prep/Python for DevOps/Concurrency, async, tests, services & containers

The containerized audit CLI exits 0 in GitHub Actions but the report file is missing from the uploaded artifact.

IntermediateTroubleshootingConcurrency, async, tests, services & containers
Answer

Likely causes → The container wrote the report to a path inside the container that is not bind-mounted, or the mount exists but the non-root container user (UID 10001) cannot write to the runner-owned directory, and the tool wrote to stdout instead or failed to write.

Diagnose →

ls -la reports/
docker run --rm -v "$PWD/reports:/out" --entrypoint id ghcr.io/org/cloudaudit:sha

Fix → Mount the output directory and write to it (-o /out/report.md), and run the container with the runner's UID (--user "$(id -u):$(id -g)") or make the directory writable. Make the tool exit non-zero if it cannot write the output file.

Prevent → Add an explicit check step (test -s reports/report.md) before upload.

All Python for DevOps questions Roadmap: Python for automation

More on Concurrency, async, tests, services & containers