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

Add a concurrency group to try jobs #30756

Merged
merged 1 commit into from
Nov 21, 2023
Merged

Conversation

mrobinson
Copy link
Member

This should prevent multiple parse-comment jobs from running at the
same time for the same pull request, reducing the number of duplicate
builds when multiple labels are applied.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes do not require tests because they adjust the CI configuration.

This should prevent multiple `parse-comment` jobs from running at the
same time for the same pull request, reducing the number of duplicate
builds when multiple labels are applied.
@sagudev
Copy link
Member

sagudev commented Nov 20, 2023

Wouldn't this also prevent running two different try runs for different PRs?

@@ -8,6 +8,8 @@ jobs:
parse-comment:
name: Trigger Try
runs-on: ubuntu-latest
concurrency:
group: try-${{ github.event.number }}
Copy link
Member

Choose a reason for hiding this comment

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

Can we also use cancel-in-progress: true to allow more recently triggered workflow's labels for the run?

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency

Copy link
Member Author

Choose a reason for hiding this comment

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

I did consider this, but it would add a subtle race condition. If a new job was triggered while the first was running, it could lead to a label being ignored. In this way, the second job will run and simply exit early if no applicable label is found.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, does this happen because we remove the labels when the job starts? Is there any advantage for doing it this way and not removing labels once it completes successfully?

Copy link
Member Author

Choose a reason for hiding this comment

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

The issue isn't so much the time after the labels are removed, but the time between when the action and queued and when the labels are finally removed. I'm not sure that removing the labels at the end of the job would help, because if a label was added in the meantime another job would still need to be triggered for those new labels.

Copy link
Member

Choose a reason for hiding this comment

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

My concern was not to reduce the need for new jobs when new labels are added, but to keep the logic simple so that we don't have to worry about such subtle races when extending this workflow in the future.

I am not sure I have a full picture of this workflow's lifecycle and event payloads to understand the race here, so I'm good with merging this PR as is and revisit this if it becomes a problem.

@mukilan
Copy link
Member

mukilan commented Nov 20, 2023

Wouldn't this also prevent running two different try runs for different PRs?

@sagudev , I believe that is avoided here by using a group id derived from the PR number i.e group: try-${{github.action.number}}

@mrobinson mrobinson added this pull request to the merge queue Nov 21, 2023
Merged via the queue into servo:master with commit 35b4641 Nov 21, 2023
10 checks passed
@mrobinson mrobinson deleted the concurrency branch November 21, 2023 09:25
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.

None yet

3 participants