Hi,
Is it possible to trigger all the PR pipelines for a given target branch right after the pipeline for the target branch is completed (possibly not failed)?.
The Jenkins instance I look after is integrated with Sonarcube and it would be great to trigger the pipelines for the open PRs as the target branch would have an updated Sonar report.
Hi Giovanni,
I’ve never done that, but I have a few ideas that may or may not work.
First of all, you would have to know when your main pipeline is done. You could add a post-build step to do so.
Then, you have to know the open pull requests. I would use gh
(if you were using GitHub) to do so, but you could do it with the API of your version control system (Gitlab API, GitHub API, …) or via a plugin if it exists for your VCS
To finish, you could use the Jenkins API to start the pipelines for the open PRs, or there may be some plugins that could do that.
Best of luck with your project.
Hi Poddingue,
Yeah I will probably implement something along the lines you are suggesting.
I was hoping there was some kind of inbuilt feature… in fairness as far as I am aware Jenkins should automatically start a pipeline for a PR if the target branch changes (without waiting for the pipeline for the for it to finish), but for some reasons this is not happening for me… and I do not have weird options such us “Ignore rebuilding merge branches when only the target branch changed” enabled.