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

load command does not work in SharedLibraries

XMLWordPrintable

      Hi, i've been on this for hours and I am positive it is a bug

      Steps to reproduce:

               1. write a file with key value pairs (e.g. myKeyVal.properties) :

                        key1="value1"

                2. in pipeline write:

                     load "<your path>/myKeyVal.properties"

                     echo "$key1"

               3. run it and see it works without problems

               4. take the same code that loads the properties file, and put the code in a groovy file in a SharedLibrary, and load the SharedLibrary and run it and it will say 
      groovy.lang.MissingPropertyException: No such property: Build_Name for class: Script1
      even if you print the content of the file in the shared library you see it writes the content correcly, only the load doesn't work

               5. take the same groovy file you created in the shared library, load it in the pipeline and you will notice it works without problem.

      So to summarize - load command for a properties file works great in pipeline script, and from a groovy file, but take the same groovy file and put it as a shared library and load does not work anymore.
      My guess is that it loads it, but the share library can't recognize it

            Unassigned Unassigned
            giladbaru Gilad Baruchian
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: