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

SCM polling of shared libraries cannot be disabled

XMLWordPrintable

      When a pipeline job is configured with Poll SCM and the pipeline script loads shared libraries using the @Library annotation or library step, SCM polling is also configured for the shared libraries.

      Looking at the source code, it appears that polling is explicitly disabled, yet the polling still occurs, hence why I marked this issue as a Bug.

      https://github.com/jenkinsci/pipeline-groovy-lib-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/libs/SCMBasedRetriever.java#L125

      For example, this pipeline script:

      @Library('jenkins-library') _

      And this pipeline script:

      library 'jenkins-library' 

       

      Result in similar behavior, where if I configure the Poll SCM property on the job in question, then SCM polling is configured for the library. Here's a snippet from the polling log (slightly modified to remove sensitive info).

      Started on May 9, 2024, 5:08:00 PM
      Using strategy: SpecificRevisionBuildChooser
      [poll] Last Built Revision: Revision 6b145a1a2b6fa030f759e1575cedf3d6b68fa6ec (main)
      The recommended git tool is: NONE
      using credential github.company.com
       > git.exe --version # timeout=10
       > git --version # 'git version 2.39.1.windows.1'
      using GIT_ASKPASS to set credentials github.company.com
       > git.exe ls-remote -h -- https://github.company.com/jholzinger/jenkins-library.git # timeout=10
      Found 1 remote heads on https://github.company.com/jholzinger/jenkins-library.git
      [poll] Latest remote head revision on refs/heads/main is: adac0855a06bdf8ee68637aca63920925db30b20 

      I am able to "break" the polling by turning off changelogs for the shared library, but I would prefer not to disable the shared library changelogs.

      The changed pipeline:

      @Library(value='jenkins-library', changelog=false) _ 

      And the polling log after the change:

      Started on May 9, 2024, 5:26:00 PM
      no polling baseline in C:\ProgramData\Jenkins\.jenkins\workspace\MyJob@libs\0f6cf42558ff97ea42fceb2077654c97e393d0e5900319a1962f63dc9b37b0a8 on 

            Unassigned Unassigned
            jholzinger Jacob Holzinger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: