TL:DR: Is there a way to somehow cancel the old background task when a new task is scheduled (after merging a new commit) for the same PR?
Context: My org. uses a mono-repo.
It’s pretty typical for mono-repos to use the merge queue technique, where instead of manually merging PRs, developers mark their PRs (e.g. with a “need-to-merge” label), and the merge queue does the rest: fetches the master branch, waits for all CI builds/checkouts to go green, and (finally) merges this PR to the master.
It may take several hours before the merge queue merges the PR and during this time, it constantly merges commits from the updated master into the current PR branch. This action triggers SonarQube to scan this PR/branch over and over again (because it’s configured to scan for every PR commit).
If SonarQube already has pending tasks, it creates a new task in the background which will duplicate the old one (as shown in the picture below) which is bad because it increases the scope of background tasks and the pending time for the rest of the tasks.
Is there a way to somehow cancel the old background task when a new task is scheduled (after merging a new commit) for the same PR?
SonarQube Developer Edition, Version 9.2.4 (build 50792)
If you cancel the build for previous commits, are you not stopping the whole pipeline? In that case, I would expect SonarQube analysis to not even start.
Can you please tell me more about your use case?