2
votes

I'm using a shared groovy library in my pipelines. I'm finding that when ever I merge to my library, a subset of jobs (but not all) that use the library are being triggered.

I've looked at the shared library configuration and verified that "Include @Library changes in job recent changes" is not checked. I've combed through logs, looking for clues, I'm finding that seemingly random jobs get triggered by the merge, but I haven't been able to identify why these particular jobs get run.

My current thought is that /github-webhook/ is just triggering too many jobs.

I'm using Jenkins 2.82 and 2.9 of the groovy libraries plugin https://wiki.jenkins.io/display/JENKINS/Pipeline+Shared+Groovy+Libraries+Plugin

Further information: If I delete one of the jobs that is getting triggered by the shared library, and recreate it, then it will no longer rebuild when the shared library is merged. Running a diff on the old config.xml vs the new one isn't helping a ton. The workflow-job@$id and other plugin versions change, but that seems unrelated.

2

2 Answers

1
votes

I had the exact same behaviour you described in your question. In my case, disabling and enabling all jobs fixed this issue. Run the following code on the "Script Console":

for (item in Jenkins.instance.items) {
    item.disabled = true
    item.save()
    item.disabled = false
    item.save()
}
1
votes

The shared library plugin, workflow-cps-global-lib, has a fix for this in version 2.9:

JENKINS-41497 - allow excluding shared libraries from changelogs (and therefore from SCM polling as well) via global configuration option and/or @Library(value="some-lib@master", changelog=false).

Simply configure it at the library or pipeline level to disable this behavior.