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

Allow loading libraries in evaluated scripts

    XMLWordPrintable

Details

    Description

      When I am trying to load a library in the evaluated script, I get "Could not find any definition of libraries [foo]" error. The minimal job is like this:

      evaluate '@Library("foo") _'
      

      It would be really nice if this code worked as-is, but any workaround would help me too.

      Attachments

        Issue Links

          Activity

            jglick Jesse Glick added a comment -

            Why would you want to do this? And even if you did, I think JENKINS-39450 would be a better approach.

            jglick Jesse Glick added a comment - Why would you want to do this? And even if you did, I think JENKINS-39450 would be a better approach.
            rtimush Roman Timushev added a comment - - edited

            We use evaluate to load jenkinsfiles with non-default names in multibranch pipelines. A separate step to load a library will help, although it means that @Library annotation becomes completely useless for us.

            rtimush Roman Timushev added a comment - - edited We use evaluate to load jenkinsfiles with non-default names in multibranch pipelines. A separate step to load a library will help, although it means that @Library annotation becomes completely useless for us.
            samliddicott Sam Liddicott added a comment -

            I really wish that at least built parameters or env vars could be expanded in the @Library string.

            samliddicott Sam Liddicott added a comment - I really wish that at least built parameters or env vars could be expanded in the @Library string.
            jglick Jesse Glick added a comment -

            samliddicott you can use the library step for dynamic import of libraries.

            jglick Jesse Glick added a comment - samliddicott you can use the library step for dynamic import of libraries.

            People

              Unassigned Unassigned
              rtimush Roman Timushev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: