Naming steps in Declarative Pipeline-As-Code

20 views
Skip to first unread message

Ram D

unread,
Jul 23, 2018, 8:53:18 AM7/23/18
to Jenkins Users
I am trying to give names to different steps in a stage using Declarative pipeline, but unable to do that. This was reported and fixed as part of JENKINS-37324, but I am unable to find any documentation that shows how to use this.

I tried to use following, based on a SO answer, but it does not work:
sh cmd: "mvn -U versions:set versions:update-child-modules -DnewVersion=${MAJOR_VERSION}.${SVN_REVISION}-SNAPSHOT" , name: "Update Versions"


This gives following error:
WorkflowScript: 49: Invalid parameter "cmd", did you mean "script"? @ line 49, column 11.
   							sh cmd: "mvn -U versions:set versions:update-child-modules -DnewVersion=${MAJOR_VERSION}.${SVN_REVISION}-SNAPSHOT" , name: "Update Versions"
             ^

Please note that I am using Declarative pipeline, not scripted.

Stuart Rowe

unread,
Jul 23, 2018, 3:04:32 PM7/23/18
to Jenkins Users
I'm not familiar with JENKINS-37324. To fix the specific error you posted, use 'script' instead of 'cmd':

See: https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#-sh-%20shell%20script
sh script: "mvn -U versions:set versions:update-child-modules -DnewVersion=${MAJOR_VERSION}.${SVN_REVISION}-SNAPSHOT" , name: "Update Versions"
Reply all
Reply to author
Forward
0 new messages