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

Tools should allow variables in their names for declarative pipeline

    XMLWordPrintable

    Details

    • Epic Link:
    • Similar Issues:

      Description

      I have a parameter called JDK_TOOL and would like to use the parameter inside of my declarative pipeline tools definition but this script does not work:

      pipeline { 
       agent any
       tools { 
        jdk "${params.JDK_TOOL}"
       } 
       stages {
        stage('Example') {
         steps {
          sh 'jdk --version'
         }
        }
       }
      }
      

      I get an error which says:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      WorkflowScript: 7: Tool type "jdk" does not have an install of ""${params.JDK_TOOL}"" configured - did you mean "TEST2"? @ line 7, column 5.
         jdk "${params.JDK_TOOL}"
      

      so it does not seem to actually parse the variable at all(and adds the " as well)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                ataylor Alex Taylor
              • Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: