Hi Team,
I have a unique problem to solve. We are trying to save precious execution time. Issue is - We have pipeline job that triggers on creating PR, and re-triggers on every new commit to branch. We want a way to cancel old execution if a new pipeline job has been triggered for the same branch / PR.
Is there a way to achieve this?
I'm afraid that there is no automated way to do that.
You could write a script that uses our APIs to do the following, and then use that script at the beginning of each pull requests Pipelines build:
You can check below the script another customer developed to do something similar:
Please note that their use case was different and it did not concern builds that run on PRs but builds that run on branches, so some adjustments would be needed to achieve what you are looking for.
Kind regards,
Theodora
That solution still doesn't work if the latest pipeline is just on queue waiting for the previous one to end. We need a solution for the newest pipeline to not go on queue, but stop all other pipelines that have been triggered from the same branch or PR.
If there was a new commit onto a branch, all other pipelines from that same branch are not needed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Enrique,
Just to understand your use case better, are you using one of our self-hosted Runners for your builds? Pipelines builds that run in our own infrastructure are not queued, so I just want to understand if you are using Runners instead.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Enrique,
Thank you for your reply. With self-hosted runners, this is indeed not possible if you use only one runner, as a runner can only run one build at a time.
I went ahead and created a feature request for what you are asking: https://jira.atlassian.com/browse/BCLOUD-22726
Please make sure to add your vote to it and add yourself as a watcher if you'd like to get notified via email on updates.
In the meantime, you can look into using custom pipelines to replace the branch pipelines. Custom pipelines do not run automatically on every push. A user can trigger a custom pipeline manually from our website, or you can create a schedule to run it at specific times:
You could also use more than one runner with the same label, then certain builds would go to one runner while others will go to the other available runner. This should reduce the wait time. Please keep in mind that we don't recommend having multiple runners in a single machine for Linux Shell, Windows, and MacOS Runners, as this may lead to issues related to resource sharing/usage conflicts due to the shared build environment.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.