jenkinsci / jenkinsci/workflow-multibranch-plugin
[JENKINS-44172] Better scan of multibranch pipelines
- Dominant language
- Java
- Stars
- 87
- Forks
- 131
- PR merge metrics
- No merged PRs in 30d
Description
Multibranch pipeline jobs scans for new branches and creates and removes jobs as needed. This is basically a good idea.
Unfortunately, the scan triggers an immediate build of new jobs when they're found in SCM. In many situations, this is fine - but in some, this is a no-go. I have a lot of jobs that can only run during night as they interrupt services when they're running.
I can avoid triggering the automatic build by setting the property "Suppress automatic SCM triggering" for all branches.
But: By doing that, Jenkins doesn't read the Jenkinsfile and doesn't find a command like
properties([pipelineTriggers([cron('H 5 * * *')])])
that I have on top of my Jenkinsfiles. Thus the job will never build.
If I get out of bed early in the morning and run the job once, Jenkins find the cron specification and runs the job properly afterwards.
It would be very nice - and give me some extra sleep - if the triggers where read at scan time instead of the first run.
Thanks in advance.
---
Originally reported by
larsskj, imported from: Better scan of multibranch pipelines
Raw content of original issue
Multibranch pipeline jobs scans for new branches and creates and removes jobs as needed. This is basically a good idea.
Unfortunately, the scan triggers an immediate build of new jobs when they're found in SCM. In many situations, this is fine - but in some, this is a no-go. I have a lot of jobs that can only run during night as they interrupt services when they're running.
I can avoid triggering the automatic build by setting the property "Suppress automatic SCM triggering" for all branches.
But: By doing that, Jenkins doesn't read the Jenkinsfile and doesn't find a command like
properties([pipelineTriggers([cron('H 5 * * *')])])that I have on top of my Jenkinsfiles. Thus the job will never build.
If I get out of bed early in the morning and run the job once, Jenkins find the cron specification and runs the job properly afterwards.
It would be very nice - and give me some extra sleep - if the triggers where read at scan time instead of the first run.
Thanks in advance.
- environment:
Currently Jenkins 2.59
Contributor guide
Research direction
No source files or tests are named. Start by reading the workflow-multibranch-plugin scan behavior and how it discovers pipeline triggers from Jenkinsfiles. Done means scan-time discovery configures the declared cron trigger without also launching an immediate build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- ci-cd, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100