Handle container creation 409 conflict#16
Open
cmyers-mieweb wants to merge 1 commit into
Open
Conversation
Add handling for HTTP 409 (conflict) when creating a container in action.yml. If the API returns 409, extract the existing container ID from the response using jq, log a message, and emit container_id and container_ready outputs so concurrent workflow race conditions reuse the existing container. Other non-success responses keep the existing error handling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: #15
Related: mieweb/opensource-server#318
Add handling for HTTP 409 (conflict) when creating a container in action.yml. If the API returns 409, extract the existing container ID from the response using jq, log a message, and emit container_id and container_ready outputs so concurrent workflow race conditions reuse the existing container. Other non-success responses keep the existing error handling.
Fixes Applied
Before starting Proxmox creation: checks if the job was cancelled and aborts
After Proxmox creation completes: re-verifies the DB record exists; if deleted, destroys the orphaned Proxmox container and exits
routers/containers.js
Two changes:
POST handler: Checks for existing container with same (siteId, hostname) using SELECT ... FOR UPDATE within the transaction. Returns HTTP 409 if one already exists, preventing the race at the application level
DELETE handler: Cancels any pending/running creation job before destroying the container record, so the creation script knows to abort
Handles HTTP 409 (conflict) response from the POST endpoint gracefully, treats it as "container already exists" and uses the existing container instead of failing