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

Name or alias Shell Script Step (sh)

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Not A Defect
    • Component/s: pipeline
    • Labels:
      None
    • Similar Issues:

      Description

      The `sh` step adds a "Shell Script" step in the Pipeline. However, there could be multiple such steps including steps from various plugins (e.g., Docker), which makes it hard to distinguish the steps. We should perhaps add an optional parameter to sh to specify a name or alias which would then appear in the pipeline steps.

      e.g., the following can be the step for npm which would show as "Shell script: npm" in the pipeline view.

      sh cmd:"npm install", name: "npm"
      

        Attachments

        1. how_can_i_know.png
          156 kB
          Eloy Lafuente
        2. image-2018-02-15-17-12-01-090.png
          34 kB
          Veaceslav Gaidarji
        3. Screen Shot 2016-10-03 at 4.13.46 PM.png
          25 kB
          Kaden Wilkinson
        4. Screenshot from 2017-03-03 11-48-15.png
          15 kB
          Justin Holmes
        5. Screenshot from 2017-03-03 11-49-10.png
          29 kB
          Justin Holmes

          Issue Links

            Activity

            Hide
            vgaidarji Veaceslav Gaidarji added a comment -

            Saving scripts into files is a common approach, but not really what we want to do in every case.
            Let's say I have a simple step which runs Lint checks and it looks like

            sh "./gradlew lint"
            

            I wouldn't create a file in workspace with this single instruction. And probably it's not always possible to have write access to the repository on which you operate.
            Proposed solution sounds more like a workaround, but having possibility to name shell steps is really good to have.

            Show
            vgaidarji Veaceslav Gaidarji added a comment - Saving scripts into files is a common approach, but not really what we want to do in every case. Let's say I have a simple step which runs Lint checks and it looks like sh "./gradlew lint" I wouldn't create a file in workspace with this single instruction. And probably it's not always possible to have write access to the repository on which you operate. Proposed solution sounds more like a workaround, but having possibility to name shell steps is really good to have.
            Hide
            greg_k Greg Knapp added a comment -

            One more vote for this (as I can't use the vote link due to this issue being resolved)

            Show
            greg_k Greg Knapp added a comment - One more vote for this (as I can't use the vote link due to this issue being resolved)
            Hide
            vgaidarji Veaceslav Gaidarji added a comment -

            I also think that this ticket was partially implemented and should be reopened (or another ticket for improvement should be created).
            It still looks like below

            I'm using commands like

            • sh(script: "./gradlew whatever", returnStdout: true).trim()
            • sh(script: "git rev-parse --verify HEAD", returnStdout: true)

            Jesse Glick ^^

            Show
            vgaidarji Veaceslav Gaidarji added a comment - I also think that this ticket was partially implemented and should be reopened (or another ticket for improvement should be created). It still looks like below I'm using commands like sh(script: "./gradlew whatever", returnStdout: true).trim() sh(script: "git rev-parse --verify HEAD", returnStdout: true) Jesse Glick ^^
            Hide
            orathore Omit Rathore added a comment - - edited

            One more vote from my side too seems bug, as same sh command some time appears on the label and some time inside label (in collapsed form). 

            We need this functionality to make the console more user-friendly and readable.

            Can we please reopen this issue or provide any other possible alternate solution. We probably don't want to use Stage for this.

            Show
            orathore Omit Rathore added a comment - - edited One more vote from my side too seems bug, as same sh command some time appears on the label and some time inside label (in collapsed form).  We need this functionality to make the console more user-friendly and readable. Can we please reopen this issue or provide any other possible alternate solution. We probably don't want to use Stage for this.
            Hide
            towel Yoav Miles added a comment -

            Sorry Jesse Glick I cannot vote this issue up while it's closed. I use Pipeline Steps a lot and run hundreds of batch file steps - if I could name them that would be super awesome.

            Show
            towel Yoav Miles added a comment - Sorry Jesse Glick I cannot vote this issue up while it's closed. I use Pipeline Steps a lot and run hundreds of batch file steps - if I could name them that would be super awesome.

              People

              • Assignee:
                Unassigned
                Reporter:
                shauvik Shauvik Roy Choudhary
              • Votes:
                1 Vote for this issue
                Watchers:
                42 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: