Adding stepname to Jenkins pipeline scripts

When you are writing Jenkins pipeline scripts, especially when writing pipelines for clouds or kubernetes, often you will end up calling quite a few 1-some liner bash scripts.

After a while when you investigate build&deploy failures you realize that Jenkins is hiding the scripts behind a very generic “Shell script” step-name.

If you have all of these steps happening within a single stage and you have lots of them, it can be very frustrating and hard to se which script is failing. You will have to open the logs and kind of take the context from there.

After searching stackoverflow realized that I was not the only one that had this problem/request and that the feature of giving scripts a name or step name, simply doesnt exist.

What I ended up doing was taking the hack suggested in the stackoverflow post and writing a wrapper function, so that all my scripts can have step names and posted it on github

The code is fairly simple, and you can cut and paste if you do not like to add it as a library to jenkins

With the wrapper scripts now has more meaningful names :)

Software developer and cloud enthusiast

Software developer and cloud enthusiast