Fix docker stop error on Dependabot PRs by handling missing container gracefully#674
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
… gracefully Co-authored-by: A1L13N <193832434+A1L13N@users.noreply.github.com>
🚨 Missing Open Issue LinkThis pull request does not reference any open GitHub issue via the Development section. PRs must be linked to an open issue using GitHub’s "Development" section (on the right sidebar). How to fix this:
This PR will be automatically closed. You can reopen it after linking an open issue. Thank you! |
1 similar comment
🚨 Missing Open Issue LinkThis pull request does not reference any open GitHub issue via the Development section. PRs must be linked to an open issue using GitHub’s "Development" section (on the right sidebar). How to fix this:
This PR will be automatically closed. You can reopen it after linking an open issue. Thank you! |
Problem
The Docker Build & Test workflow was failing on Dependabot PRs with the following error:
This occurred in the cleanup step when the workflow attempted to stop a Docker container that didn't exist. The container could be missing for various reasons:
Solution
Modified
.github/workflows/docker-test.ymlto gracefully handle missing containers during cleanup:Added
|| trueto docker stop command (line 158)Added docker rm cleanup step (lines 160-162)
|| trueto handle missing containers gracefullyBoth cleanup steps use
if: always()to ensure they run regardless of whether previous steps succeeded or failed.Testing
Verified that the fix works correctly by:
docker stop nonexistent-container || truereturns exit code 0This minimal change ensures Dependabot PRs won't fail due to cleanup errors while maintaining proper container cleanup when containers do exist.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.