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

Cancel existing builds on running PRs #2845

Merged
merged 2 commits into from
Dec 4, 2023
Merged

Conversation

nkammah
Copy link
Contributor

@nkammah nkammah commented Nov 30, 2023

As noted in #2835, the docs-pr job always trigger the master branch of the Buildkite job. A PR in repo1 and another PR in repo 2 will both call the head code of the master branch of the elastic/docs and the job itself is configured to fetch the PR content. As a result, I had to disable cancelling intermediate builds since that would mean only one build at a time can run. The downside is that 2 commits in a row on the same PR will trigger a build twice for the same PR.

To tackle this, we introduce this PR that filters the existing running builds (by inspecting the build metadata to check if it came from a specific PR) and cancel the running builds.

Note: while the Buildkite API doc states that we can filter builds by meta_data, it does not work :( as a result, we have to run some jq shenanigans.

@nkammah
Copy link
Contributor Author

nkammah commented Nov 30, 2023

run docs-build

Copy link
Member

@gtback gtback left a comment

Choose a reason for hiding this comment

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

I haven't tested this, but it LGTM!

@nkammah nkammah merged commit 06deb10 into master Dec 4, 2023
6 of 7 checks passed
@nkammah nkammah deleted the bk-cancel-running-builds branch December 4, 2023 05:15
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.

2 participants