-
Improvement
-
Resolution: Not A Defect
-
Major
-
None
-
Powered by SuggestiMate
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"
- duplicates
-
JENKINS-26107 Allow stage to operate as a labelled block
-
- Closed
-
-
JENKINS-37324 We would like a more meaningful description of a step
-
- Closed
-
[JENKINS-36933] Name or alias Shell Script Step (sh)
Not all visualizations have been updated to accommodate arbitrary nesting levels.
This is not solved, nor a duplicated of 26107. We can't label the shell step and so we get unreadable display. And no this can not be solved by putting every sh inside a nested stage.
( BTW I love what you do guys <3 )
What Blue Ocean currently chooses to display in its visualization is a separate issue.
Sorry jglick, I must be missing something obvious but... how is this related with Blue Ocean at all, and how can it be closed as not a defect when it's a request for an improvement?
I'm a complete newbie with Jenkins pipelines, but this is one of the features I'm missing since day zero (the ability to name "sh" scripts, or any other step) in order to quickly know what is failing/passing and/or going quickly to certain step results. Right now I've to click on them sequentially till I arrive to the one I'm interested on.
And I'm not using any "Blue Ocean" special thing/plugin (that I'm aware, lol). Just stock Jenkins and its awesome pipelines.
Again, excuse me if I've understood anything wrongly, but I cannot name steps and it's a little bit a pity, and the way this has been closed has surprised me. Hence, I ask.
TIA and ciao
By “stock Jenkins” you seem to mean the pipeline-stage-view plugin, which does not support nested stages or any other kind of fine-grained labeling system either. The built-in Pipeline Steps does.
jglick For what it's worth, I'm using Blue Ocean and I agree with stronk7 that this particular feature is not equivalent to https://issues.jenkins-ci.org/browse/JENKINS-26107.
For example, I have a pipeline with 7 stages that builds an ionic 2 app, and ultimately pushes it iTunes TestFlight. 7 stages is honestly more than I want already, and so a solution that adds more stages does not meet my need.
Some of these stages are rather complicated, with 5-10 steps. These are mostly shell scripts that delegate to CLI tools like fastlane and npm. It would be nice if the blue ocean UI gave me the ability to label these steps, so I don't get 10 blocks that all say "shell script."
Of course I could write custom steps for all of these and provide my own labeling mechanism, but that is much more work than I want to do and these seems like a simple enough usecase that the out of the box shell step should support it. I'm also in favor of the syntax proposed (maybe use label instead of name?)
sh cmd: "command here", name: "label here"
This is a Blue Ocean concern. Last I checked there is something in progress on that side.
7 stages is honestly more than I want already, and so a solution that adds more stages
Of course I was referring to nested stages, which B.O. does not currently display.
jglick Fair. Can you share a link? My searching only returns this issue.
Sorry, I cannot keep track of everything happening in blueocean-plugin.
JENKINS-26107 seems to be a workaround approach rather than a fix/solution. It is not ideal to define nested stage of each script step. Is there a better solution for this?
So I really need this functionality as I have some stages with 10+ `Shell Script`'s and its a pain to have to click through each one to figure out what it is/was doing. I am using the `Stage View Plugin` and the `Blueocean Plugin`, but looking at the code they both use the same call to get the name of the step. Which currently is hard coded to output "Shell Script" which is less than useful.
Also having one stage turn into 10 is not an option as that would mean certain builds could end up having close to 50 stages which is even less digestible than the current setup. Why was this closed? Is there a technical reason why this can't be done? I ask because I couldn't find one in the comments here or in the code.
Seems like this issue may be need a coordinated effort between the pipeline and blue-ocean project devs. Based on Jenkins' own docs on Blue Ocean being the future of the Jenkins UI (https://jenkins.io/doc/book/blueocean/), I would think that the rationale behind this request is founded.
From what the official Blue Ocean doc says:
What does this mean for my plugins?
Extensibility is a pretty core concept to Jenkins, so being able to extend the Blue Ocean UI is important. Based on some research, we worked out a way to allow <ExtensionPoint name=..> to be used in the markup of Blue Ocean, leaving places for plugins to contribute to the UI (plugins can have their own Blue Ocean extension points, just like they do today in Jenkins). Blue Ocean itself (as it is so far) is implemented using these extension points. Extensions are delivered by plugins, as normal, only if they wish to contribute to the Blue Ocean experience they will have some additional javascript that provides extensions.
I think that also applies to the pipeline plugin-set itself, which is clearly a first class citizen in Blue Ocean. From what I can tell about what's being discussed, this may need a change to both the pipeline and blue ocean as the pipeline is where the name is defined and blue ocean is where it is visualized (along with the Pipeline Steps visual in the standard Jenkins UI).
I vote that this improvement request be reopened and re-discussed with both pipeline and blue-ocean teams involved.
As has been said, even when not using Blue Ocean, this improvement is necessary for using the normal pipeline view efficiently.
I've only been using Jenkins pipelines for a few hours now and already this is a serious concern that I have for when the build flow that we're constructing actually needs maintenance.
Please make this high priority
I don't feel like the intent of this ticket is handled by nesting stages. This would be incredibly useful for us and do a lot for the usability of the pipeline views (whether pipeline-stage-view or blue ocean). Would really like to see this reopened.
Already in progress. Please do not reopen. (Also, generally, do not add “me too” comments to JIRA—that is what the vote list is for.)
jglick Where is the progress being tracked? I am also very interested in this functionality, it'll help make builds so much clearer.
Somethins is unclear to me: this bug is still marked as resolved as not-a-defect but reading the last comments I think it should be marked as OPEN.
I read the linked ticket but I didn't see any API for naming a the tasks. If one can imagine that using the the first line of the script as part of the description, please think twice as most well written bash scripts usually start with:
#!/bin/bash set -euo pipefail ...
So I am inclined to say that being able to specify a "name" is key as we can have a lot of boilerplate code around the most important command really being executed.
Any multiline scripts should be saved into a file in the workspace and invoked as sh './whatever' which is what the UI will display.
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.
One more vote for this (as I can't use the vote link due to this issue being resolved)
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)
jglick ^^
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.
Sorry jglick 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.
Doing as
JENKINS-26107.