Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-41497

Poll SCM and Timer triggers include "Changes" for a Pipeline for any/all Shared Libraries

    XMLWordPrintable

    Details

    • Similar Issues:
    • Sprint:
      Pipeline - July/August

      Description

      I noticed this while filing another ticket (JENKINS-41496), but the "Changes" view for the Pipeline run for this project "azure" has the "wrong commits" shown. See the screenshots for more.

      What basically appears to be happening is that any change to a Shared Library will result in newly triggered Pipelines which have "Poll SCM" configured. Pipelines which configure a timer will also have Changes from the Shared Library listed when it executes again.

      I think listing the Shared Library commits in "Changes" is acceptable, but triggering based on an SCM Poll for a Pipeline is very confusing behavior and IMHO incorrect behavior.

      As a shared tooling team, I would not expect my Shared Library changes to trigger a bunch of Pipelines for projects depending on them.

        Attachments

          Issue Links

            Activity

            Hide
            richmond Rich added a comment -

            I am facing similar issue. When I unselect 'Include @Library changes in job recent changes' and restart Jenkins, changelog does not show changes made to shared library but any change in shared library is still triggering the build.

            Show
            richmond Rich added a comment - I am facing similar issue. When I unselect 'Include @Library changes in job recent changes' and restart Jenkins, changelog does not show changes made to shared library but any change in shared library is still triggering the build.
            Hide
            dordor dor s added a comment -

            I still can't find a way to disable the change log for the shared library changes (which is not relevant for me) in declerative pipelines

             

            is seems that the default is true

            apperantly thhis is the relevant code:

             

                private Boolean changelog = true;
                ...
                // default to including changes of the library in job recent changes
                @DataBoundSetter public void setChangelog(Boolean changelog) {
                    this.changelog = changelog;
                }

             

            https://github.com/jenkinsci/workflow-cps-global-lib-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/libs/LibraryStep.java#L111-L114

             

            and this

             

                static void doRetrieve(String name, boolean changelog, @Nonnull SCM scm, FilePath target, Run<?, ?> run, TaskListener listener) throws Exception {
                    ...
                    delegate.setChangelog(changelog);

             

            https://github.com/jenkinsci/workflow-cps-global-lib-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/libs/SCMSourceRetriever.java#L139

             

            more info here: https://issues.jenkins.io/browse/JENKINS-41497?focusedCommentId=394574&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-394574

            Devin Nusbaum any chance that you can have a look?

             

            Show
            dordor dor s added a comment - I still can't find a way to disable the change log for the shared library changes (which is not relevant for me) in declerative  pipelines   is seems that the default is true apperantly thhis is the relevant code:   private Boolean changelog = true ; ... // default to including changes of the library in job recent changes @DataBoundSetter public void setChangelog( Boolean changelog) { this .changelog = changelog; }   https://github.com/jenkinsci/workflow-cps-global-lib-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/libs/LibraryStep.java#L111-L114   and this   static void doRetrieve( String name, boolean changelog, @Nonnull SCM scm, FilePath target, Run<?, ?> run, TaskListener listener) throws Exception { ... delegate.setChangelog(changelog);   https://github.com/jenkinsci/workflow-cps-global-lib-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/libs/SCMSourceRetriever.java#L139   more info here:  https://issues.jenkins.io/browse/JENKINS-41497?focusedCommentId=394574&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-394574 Devin Nusbaum  any chance that you can have a look?  
            Hide
            falloutphil Philip Beadling added a comment - - edited

            I have the same issue in declarative pipeline with fresh install of 2.263.3.

            With a multibranch declarative pipeline (Bitbucket Source Plugin) my job changelog contains very confusingly Git revision changes for my global pipeline library (loaded via git scm), but lists no changes from Bitbucket.

            Following advice I have unticked:

              Include @Library changes in job recent changes

             

            And also tried changing my Jenkinsfile annotation to:

            @Library(value='my-lib', changelog=false)

             

            But neither prevents the details appearing on clicking on a the build page for a completed job.

            I get GIt revision details on every job run from the last library update - irrespective if the library has been updated from the last job or not.

             

            Also I note that the declarative way of loading a libraries - using the libraries directive has no provision for setting the changelog parameter, as evidenced by this note in the source code:

            https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/15978cd172a8d34e2cd6bf8a6bfeaa5514d44dad/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy#L743

             

            As Bitbucket doesn't use polling I don't have the problem of my jenkins library kicking off builds.

             

            FWIW - I think both kicking off builds and even reporting library changes should be turned off by default, it's taken me a fair bit of head-scratching to even understand where the commit ids came from - I had just assumed they were from my project source control for months.

             

            Show
            falloutphil Philip Beadling added a comment - - edited I have the same issue in declarative pipeline with fresh install of 2.263.3. With a multibranch declarative pipeline (Bitbucket Source Plugin) my job changelog contains very confusingly Git revision changes for my global pipeline library (loaded via git scm), but lists no changes from Bitbucket. Following advice I have unticked:   Include @Library changes in job recent changes   And also tried changing my Jenkinsfile annotation to: @Library(value='my-lib', changelog=false)   But neither prevents the details appearing on clicking on a the build page for a completed job. I get GIt revision details on every job run from the last library update - irrespective if the library has been updated from the last job or not.   Also I note that the declarative way of loading a libraries - using the libraries directive has no provision for setting the changelog parameter, as evidenced by this note in the source code: https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/15978cd172a8d34e2cd6bf8a6bfeaa5514d44dad/pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy#L743   As Bitbucket doesn't use polling I don't have the problem of my jenkins library kicking off builds.   FWIW - I think both kicking off builds and even reporting library changes should be turned off by default, it's taken me a fair bit of head-scratching to even understand where the commit ids came from - I had just assumed they were from my project source control for months.  
            Hide
            gartoty Tyler added a comment -

            My company recently moved from GitLab to GitHub and this exact issue is happening now where it triggers all consumers of our shared library. The problem is that we have such a large consumer base that it is literally triggering 100s of pipeline jobs. We have tried everything like others have mentioned with adding additional behaviours to the lib pipeline definition: "Don't trigger a build on commit notifications", "Polling ignored from certain users", "dot not check Include @Library changes in job recent changes" and nothing works. We are upgrading our Jenkins and plugins this weekend which is a little dated but I don't think it will resolve anything based on the open issues. I'm hoping some sort of solution is found because this is not ideal and we are having to do some creative things to get by at the moment 

            Show
            gartoty Tyler added a comment - My company recently moved from GitLab to GitHub and this exact issue is happening now where it triggers all consumers of our shared library. The problem is that we have such a large consumer base that it is literally triggering 100s of pipeline jobs. We have tried everything like others have mentioned with adding additional behaviours to the lib pipeline definition: "Don't trigger a build on commit notifications", "Polling ignored from certain users", "dot not check Include @Library changes in job recent changes" and nothing works. We are upgrading our Jenkins and plugins this weekend which is a little dated but I don't think it will resolve anything based on the open issues. I'm hoping some sort of solution is found because this is not ideal and we are having to do some creative things to get by at the moment 
            Hide
            richmond Rich added a comment -

            Tyler, I had similar issues. Try this:

            1. Did you restart Jenkins after you made changes to the Shared Library definition ? If not, do it now.
            2. All your pipeline jobs which are getting triggered, will need reset of 'GitHub hook trigger for GITScm polling' i.e. go to each job, disable the trigger, save job, enable the trigger, save job.

            That should fix. You may try #2 on a few jobs first before doing it for all 100s of them.

            Show
            richmond Rich added a comment - Tyler , I had similar issues. Try this: Did you restart Jenkins after you made changes to the Shared Library definition ? If not, do it now. All your pipeline jobs which are getting triggered, will need reset of 'GitHub hook trigger for GITScm polling' i.e. go to each job, disable the trigger, save job, enable the trigger, save job. That should fix. You may try #2 on a few jobs first before doing it for all 100s of them.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              rtyler R. Tyler Croy
              Votes:
              83 Vote for this issue
              Watchers:
              92 Start watching this issue

                Dates

                Created:
                Updated: