Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
Description
Using a JobDSL script to generate a multibranch Pipeline job does not trigger a branch index to find Jenkinsfile
Here is a simple dsl job
multibranchPipelineJob(repo) { branchSources { github { scanCredentialsId(credentials) repoOwner(credentials) repository(repo) } } }
Using this created the job fine but did not trigger a branch scan until I manually triggered a branch index. It also works if you open the multibranch job configuration and save it with no changes.
Creating a multibranch job directly from the UI works fine.
The only way I can trigger a branch index is to add a triggers section to the command to periodically scan every minute. I then had to create 3 build steps:
1. JobDSL to create mutlibranch Pipeline job with a trigger set to 1 minute
2. Shell step to Sleep for 60 seconds
3. JobDSL to modify the multibranch Pipeline job and turn off the trigger.
Attachments
Issue Links
- is related to
-
JENKINS-38887 support launching multibranch pipeline (branch indexing)
-
- Closed
-
- links to
michelzanini we also found that issue that all our ~ 800 repos was reindexed every night (ofc one day is not enough to reindex all of them with GH API limits)
But I found way how to fix it..
See https://github.com/jenkinsci/job-dsl-plugin/blob/master/job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/JenkinsJobManagement.java#L456
If your configuration is not changed then updateByXml is not called, so no reindexing is done..
In our case it was even harder to catch cause jobs itself did not changed but folders did (we have some portlets there that have random ID by default)
We changed them to static IDs and problem is gone..