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

Inconsistent shared library changelog default value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Jenkins 2.93
      workflow-cps-global-lib-plugin 2.9

      The feature implemented in JENKINS-41497 uses a different default behavior for implicitly loaded libraries and the static import of a shared library

      @Library("mylib") // changelog controlled by global library configuration
      

      than for the dynamic import

      library "mylib" // changelog = true
      

      I would expect that if the changelog parameter is not specified, the library step would also obtain the default value from the global library configuration.

      The workaround to use the decorator syntax is impractical for me because it would require changes to a large number of Jenkinsfiles.

      It seems like my expected behavior might have been intended originally. In the implementation in LibraryStep.java

       

      public static class Execution extends AbstractSynchronousNonBlockingStepExecution<LoadedClasses> {
          @Override protected LoadedClasses run() throws Exception {
              // ...
              Boolean changelog = step.getChangelog(); // returns default value LibraryStep.changelog = true, if not provided
              // ...
              changelog = cfg.defaultedChangelogs(changelog); // returns changelog if != null, else global configuration option
              // ...
          }
      }
      

      a function is called that loads the global configuration value if the argument is null, but due to the default initialization, this statement only has effect if changelog = null is specified explicitly.

       

            Unassigned Unassigned
            mnsa Matthias Nodeland
            Votes:
            5 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: