+1 someone please fix this - it's been bugging me for years at this point spewing shell step contents all over Blue Ocean.
I can find no consistency between when Blue Ocean chooses to respect the step label vs printing the shell script contents.
Look how similar these 2 functions are and yet even they're treated differently and I can't explain why:
https://github.com/HariSekhon/Jenkins/blob/master/vars/garDockerAuth.groovy
https://github.com/HariSekhon/Jenkins/blob/master/vars/gcrDockerAuth.groovy
The 3rd and 5 steps shown in the screenshot below are the final sh() step in garDockerAuth.groovy and gcrDockerAuth.groovy respectively which are almost identical and the same length - yet one prints the label, and the other prints the shell script contents which is ugly and leaks too much information.
![](/secure/attachment/60438/60438_Screenshot+2023-05-12+at+19.37.25.png)
garDockerAuth's final sh() step which uses the label nicely:
sh (
label: 'GCloud SDK Configure Docker Authentication for Google Artifact Registry',
script: """
set -eux
if [ -n "\${GAR_PROJECT:-}" ]; then
export CLOUDSDK_CORE_PROJECT="\$GCR_PROJECT"
fi
# XXX: fails without throwing non-zero exit code for invalid registries with
# WARNING: blah is not a supported registry
gcloud auth configure-docker --quiet '$registries'
"""
)
vs gcrDockerAuth()'s final sh() step which spews shell code all over the screen:
sh (
label: 'GCloud SDK Configure Docker Authentication for Google Container Registry',
script: """
set -eux
if [ -n "\${GCR_PROJECT:-}" ]; then
export CLOUDSDK_CORE_PROJECT="\$GCR_PROJECT"
fi
# XXX: fails without throwing non-zero exit code for invalid registries with
# WARNING: blah is not a supported registry
gcloud auth configure-docker --quiet '$registries'
"""
)
The diff is literally this - so it's not even a matter of sh() step content length mkemmerz (I did have this hunch previously but this seems to disprove it):
diff /tmp/tmp /tmp/tmp2
2c2
< label: 'GCloud SDK Configure Docker Authentication for Google Artifact Registry',
---
> label: 'GCloud SDK Configure Docker Authentication for Google Container Registry',
5c5
< if [ -n "\${GAR_PROJECT:-}" ]; then
---
> if [ -n "\${GCR_PROJECT:-}" ]; then
So basically... wtf blue ocean...
This issue is frustrating, I can't find a workaround to have a clean step name all the time in BlueOcean UI.