Status: Closed (View Workflow)
workflow-jobs:2.31jenkins 2.164.2 ansicolor:0.6.2 basic-branch-build-strategies:1.3.1 blueocean:1.14.0 buildtriggerbadge:2.10 configuration-as-code:1.12 configuration-as-code-support:1.12 credentials-binding:1.18 cron_column:1.4 delivery-pipeline-plugin:1.3.2 disable-github-multibranch-status:1.1 git:3.9.3 github-oauth:0.32 github-pr-comment-build:2.0 google-storage-plugin:1.2 job-dsl:1.72 kubernetes:1.15.1 matrix-auth:2.3 pipeline-githubnotify-step:1.0.4 rebuild:1.30 script-security:1.58 simple-theme:0.5.1 slack:2.22 ssh-agent:1.17 timestamper:1.9 workflow-aggregator:2.6 workflow-jobs:2.31
I have a fully configured as code jenkins deployed in GKE using the official Helm [chart|https://github.com/helm/charts/tree/master/stable/jenkins] (version 0.33.1). I also use a seed job (pre-installed by the chart) which creates all the other jobs.
My problem is that each time someone triggers the seed job, it triggers a branch indexing in every existing multibranch pipelines. Those branch indexing trigger a build for every branches discovered even when they were already previously discovered and builtt.
The consequence is that we get huge build spikes each time someone runs the jenkins seed. I searched the web for months for a fix but all I could find was workarounds. The latest I put in place is to install the "Basic Branch Strategy plugin" and enforce the newly added "skip initial build on first branch indexing" strategy on all my multibranch pipelines. It fixed my problem but the downside is that, my newly discovered branches stopped building automatically so the workaround isn't satisfying.
From what I understood, the seed job recreates all its managed jobs every time it is run, so I guess the problem must come from there but I don't know how to confirm it.
I can debug this further but I will need a bit of help (debugging tips).
To me the solutions are:
- Fix either the seed or the way the multibranch pipelines handles recreation.
- Create a basic branch strategy which filters an initial trigger when the branch was already built before and the current commit is the same than the previous build's.
I can provide further information if needed. I can even submit a fix if it is trivial/simple (I am not a Java developer).
Thanks for your help!
JENKINS-43693 multibranchPipelineJob overrides old branch indexing sources
- is duplicated by
JENKINS-57663 Do not trigger all branch builds when regenerating a multibranchPipelineJob
What did you find out? How did you fix it?
Hi halkeye. Sorry, Actually the solution is in the Jira ticket duplicated (
In short, you have to set fixed ids in the branch sources.
The bug comes from the job-dsl plugin which autogenerates branch sources ids on every run (when they are not set), thus recreating branch sources which have to "takeover" and schedule a new build doing so.
What is truly missleading is that this behavior is not mentioned in the seed documentation AND the examples do not set ids.
Ah, interesting, I actually found a different problem, I did also figure it out eventually from reading the other bugs.
Buildstrategies, by default, is an OR, so it would discover branches, or skip indexing, but not both. So I had to convert it to an AND
Thanks. I found this solution myself a while ago and forgot to update the ticket.