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

Pipeline editor mangles shell commands with interpolation and multiple quote levels

XMLWordPrintable

      I have a shell step that I use to get the tool location and execute the tool in a single step that relies on interpolation:

        sh "${tool 'gradle32'}/bin/gradle build"
      

      Entering this step in through a standard editor into a Jenkinsfile / declarative pipeline works fine and runs as expected, substituting the path defined globally for 'gradle32'.

      However, entering this exact same text in a shell step in the Blue Ocean pipeline editor (even copying it verbatim), saving and attempting to run it results in a "Bad substitution" error from the step.

      Looking at the shell command in the blue ocean pipeline editor for both the case where it was entered outside the editor and entered directly in the shell step in the editor shows the exact same syntax in both.

      Apparently, when you enter the step directly in through the editor, it translates it into this (as evidenced by the Jenkinsfile it produced):

       sh '"${tool \'gradle32\'}/bin/gradle build"'
      

            jamesdumay James Dumay
            bclaster Brent Laster
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: