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

Inconsistent shared library changelog default value

    XMLWordPrintable

Details

    Description

      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.

       

      Attachments

        Activity

          mnsa Matthias Nodeland created issue -

          I tried to write a pull request setting the default value to null, but I do not know how to modify LibraryStep/config.jelly such that it can express null values of changelog (configRoundtrip test failing). As I have understood it, f:optionalBlock requires a class with a DataBoundConstructor to pass null values but I think this might break serialization backwards compatibility. I also had no luck with f:select and an explicit null value. I would greatly appreciate a pointer into the right direction, but if someone knows how to fix this right away this is of course also fine with me.

          mnsa Matthias Nodeland added a comment - I tried to write a pull request setting the default value to null, but I do not know how to modify LibraryStep/config.jelly such that it can express null values of changelog (configRoundtrip test failing). As I have understood it, f:optionalBlock requires a class with a DataBoundConstructor to pass null values but I think this might break serialization backwards compatibility. I also had no luck with f:select and an explicit null value. I would greatly appreciate a pointer into the right direction, but if someone knows how to fix this right away this is of course also fine with me.

          People

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

            Dates

              Created:
              Updated: