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

Allow loading libraries in evaluated scripts

    Details

    • Similar Issues:

      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

            Hide
            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.

            Show
            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.
            Hide
            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.

            Show
            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.
            Hide
            samliddicott Sam Liddicott added a comment -

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

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

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

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

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: