Skip to content

ci: Remove docker containers at end, systematically - #3020

Open
FabioLuporini wants to merge 1 commit into
mainfrom
codex/cleanup-ci-containers
Open

ci: Remove docker containers at end, systematically#3020
FabioLuporini wants to merge 1 commit into
mainfrom
codex/cleanup-ci-containers

Conversation

@FabioLuporini

Copy link
Copy Markdown
Contributor

No description provided.

@FabioLuporini FabioLuporini added the CI continuous integration label Sep 7, 2026
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.77%. Comparing base (85d54c7) to head (be9903c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3020   +/-   ##
=======================================
  Coverage   83.77%   83.77%           
=======================================
  Files         257      257           
  Lines       54992    54992           
  Branches     4705     4705           
=======================================
  Hits        46072    46072           
  Misses       8108     8108           
  Partials      812      812           
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 68.59% <ø> (ø)
pytest-gpu-gcc- 78.41% <ø> (-0.01%) ⬇️
pytest-gpu-icx- 78.36% <ø> (-0.01%) ⬇️
pytest-gpu-nvc-nvidiaX 69.11% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

docker image rm -f "${{ inputs.tag }}_${{ inputs.uid }}"
CONTAINER_NAME="ci-${NAME:-${TAG}}-${UNIQUE}"

docker container rm -f "${CONTAINER_NAME}" 2>/dev/null || true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually work if a process is hung inside the container?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Containers also have a unique ID that we should use, rather than just the name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually work if a process is hung inside the container?

Yes as long as the the runner and Docker daemon are still responsive

Containers also have a unique ID that we should use, rather than just the name

tweaking it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CID_FILE is a small host-side file containing Docker’s actual container ID.

docker run --cidfile "$CID_FILE" writes the ID as soon as the container is created. If docker run later hangs or gets cancelled, the cleanup action can still do:

docker container rm -f "$(cat "$CID_FILE")"

It’s used because an action output written after docker run would never be produced if the run hangs. The file lives under RUNNER_TEMP, outside the container, and is deleted during cleanup.

@FabioLuporini
FabioLuporini force-pushed the codex/cleanup-ci-containers branch from 7755000 to be9903c Compare September 8, 2026 08:42
UNIQUE: ${{ inputs.uid }}
run: |
CONTAINER_NAME="ci-${NAME:-${TAG}}-${UNIQUE}"
CID_FILE="${RUNNER_TEMP}/${CONTAINER_NAME}.cid"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this should be an output and handled by actions, not written to some arbitrary file. Look at how I built all the custom action, or tell codex to...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI continuous integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants