Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent concurrent deployments #1905

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

dscho
Copy link
Member

@dscho dscho commented Oct 11, 2024

Changes

Let's avoid having multiple deployment runs stumble over each other's toes.

Context

GitHub Pages' sites are singletons and therefore we should use the recommended pattern to prevent multiple deployments to run at the same time; Instead, we want to queue them all up.

Otherwise the same might happen as in this deployment, which was triggered by merging a PR while the previous deployment (triggered by merging another PR) was still running:

deploy
   HttpError: Deployment request failed for ca3b63f due to in progress deployment. Please cancel 5b1041a first or wait for it to complete.
      at /home/runner/work/_actions/actions/deploy-pages/v4/node_modules/@octokit/request/dist-node/index.js:124:1
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
      at createPagesDeployment (/home/runner/work/_actions/actions/deploy-pages/v4/src/internal/api-client.js:125:1)
      at Deployment.create (/home/runner/work/_actions/actions/deploy-pages/v4/src/internal/deployment.js:74:1)
      at main (/home/runner/work/_actions/actions/deploy-pages/v4/src/index.js:30:1)

deploy
   Error: Failed to create deployment (status: 400) with build version ca3b63f. Request ID 2460:3B264E:2D28F10:5686FAF:66F57B0B Responded with: Deployment request failed for ca3b63f due to in progress deployment. Please cancel 5b1041a first or wait for it to complete.

GitHub Pages' sites are singletons and therefore we should use the
recommended pattern to prevent multiple deployments to run at the same
time; Instead, we want to queue them all up.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho self-assigned this Oct 11, 2024
@dscho
Copy link
Member Author

dscho commented Oct 11, 2024

I verified that this is working correctly by first pushing this branch to my gh-pages, which triggered this run on push, then immediately triggering another run via workflow_dispatch, which is now waiting:

image

@dscho dscho marked this pull request as ready for review October 11, 2024 15:30
@dscho
Copy link
Member Author

dscho commented Oct 18, 2024

I'll just go ahead and merge this.

@dscho dscho merged commit 95aa4ab into git:gh-pages Oct 18, 2024
1 check passed
@dscho dscho deleted the prevent-concurrent-deployments branch October 18, 2024 11:49
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