I'm trying to automatically trigger 'Branch Indexing' on a Multibranch Pipelines job in Jenkins.
At the moment, only one method seems to actually work, which is polling, but I am unable to do that and polling is a bad solution anyway.
The plug-in doesn't support 'Trigger builds remotely (e.g., from scripts)' (options are not saved), so I cannot trigger it via a web hook on push etc.
I tried creating a 'trigger' freestyle build on the repo but the 'Post-build Actions - Build other projects' claims the Multibranch Pipeline project is not a buildable project.
If polling is the only way I can do this, then I need to disable automatic SCM triggering (otherwise we get duplicate builds when we re-index) because I'll need to enable web hook triggering on the branch projects.
But that doesn't work, because I'm setting up the web hook via a pipeline script in the branch project, and you need to have built it at least once to have that property registered.
I've been going around in circles for a while, so hopefully I've just missed something obvious, but any help would be appreciated.
I imagined being able to do one of the following
Somehow trigger the multi-branch project as a downstream project
Poll the multibranch project, and only build branch projects which have not been built before
Cheers
Jenkins.instance.getItemByFullName(downStreamProjectName).scheduleBuild()
was exactly what I was looking for to trigger a rescan of my Multibranch Pipeline – Shellbark