Skip to content

Handle container creation 409 conflict#16

Open
cmyers-mieweb wants to merge 1 commit into
mainfrom
cmyers_issue13
Open

Handle container creation 409 conflict#16
cmyers-mieweb wants to merge 1 commit into
mainfrom
cmyers_issue13

Conversation

@cmyers-mieweb
Copy link
Copy Markdown
Collaborator

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

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.
@cmyers-mieweb cmyers-mieweb requested a review from runleveldev May 18, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant