add concurrency check to gradle-check workflow #16007
Merged
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.
Description
Coming from opensearch-project/opensearch-build#5008 the gradle-check workflow runs for every new commit that is pushed onto the pull-request. This results in multiple instances of gradle-check workfow and as well as jenkins job to run. The user is only interested in the result of the latest commit run and doesn't care about the previous commit run results.
This results in unnecessary noise on the pull request and as well as wastage of resources. Since there can be only 30 concurrent gradle-check jobs at any given point of time, these stale runs also exhaust the job queue which can otherwise be used for legitimate runs.
This PR adds
concurrency
feature provided with github-actions to limit the workflow to run only 1 instance and cancel all other instances of the workflow for the same PR. See https://docs.github.com/en/enterprise-cloud%40latest/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs.This will only cancel the github worflow and doesn't handle cancelling the jenkins job.
The logic to cancel the jenkins job is currently handled in opensearch-project/opensearch-build#5043.
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
opensearch-project/opensearch-build#5008
Check List
[ ] Functionality includes testing.[ ] API changes companion pull request created, if applicable.[ ] Public documentation issue/PR created, if applicable.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.