• Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Major Major
    • pipeline
    • None

      Pipeline `sh` sometime is used to compute value to be later used by pipeline as a groovy variable. Same happens in a classic shell script, but on can use `foo = $(some command)` in such circumstances. Would be nice to have pipeline support something comparable.

      Not sure something as simple as `def foo = sh 'some command'` can be achieved, then a dedicated syntax would be required.

      Some use to dump value in shell script into a text file, then use `readFile` in Pipeline to parse and assign to a groovy variable, This only can be considered a workaround imho, as this makes the Pipeline script heavy to read.

          [JENKINS-34331] get shell to expose a value

          Nicolas De Loof created issue -
          Nicolas De Loof made changes -
          Description Original: Pipeline `sh` sometime is used to compute value to be later used by pipeline as a groovy variable. Same happens in a classic shell script, but on can use `foo = $(some command)` in such circumstances. Would be nice to have pipeline support something comparable.

          Not sure something as simple as `def foo = sh 'some command'` can be achieve, then a dedicated syntax would be required.

          Some use to dump value in a text file then `readFile` in workflow, this only can be considered a workaround imha, this makes the Pipeline script heavy to read
          New: Pipeline `sh` sometime is used to compute value to be later used by pipeline as a groovy variable. Same happens in a classic shell script, but on can use `foo = $(some command)` in such circumstances. Would be nice to have pipeline support something comparable.

          Not sure something as simple as `def foo = sh 'some command'` can be achieved, then a dedicated syntax would be required.

          Some use to dump value in shell script into a text file, then use `readFile` in Pipeline to parse and assign to a groovy variable, This only can be considered a workaround imho, as this makes the Pipeline script heavy to read.
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-26133 [ JENKINS-26133 ]
          Jesse Glick made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Jesse Glick made changes -
          Link Original: This issue is related to JENKINS-26133 [ JENKINS-26133 ]
          Jesse Glick made changes -
          Link New: This issue duplicates JENKINS-26133 [ JENKINS-26133 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 170414 ] New: JNJira + In-Review [ 198864 ]
          Andrew Bayer made changes -
          Component/s New: pipeline-general [ 21692 ]
          Andrew Bayer made changes -
          Component/s Original: workflow-plugin [ 18820 ]

            jglick Jesse Glick
            ndeloof Nicolas De Loof
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: