Pipeline set pipeline name from Jenkinsfile

326 views
Skip to first unread message

Suresh Avadhanula

unread,
May 25, 2016, 2:25:47 PM5/25/16
to Jenkins Users
Hi,

I have multi branch pipeline that scans SVN repository for Jenkinsfile.  The build jobs are created with names as

foo/bar/somemodule/projectA
foo/bar/somemodule/projectB

Jenkins configures the workspace for the jobs as

${WORKSPACE_ROOT}/${PIPELINE_NAME}/foo%2Fbar%2Fsomemodule%2FprojectA

${WORKSPACE_ROOT}/${PIPELINE_NAME}/foo%2Fbar%2Fsomemodule%2FprojectB

This creates a problem for the build as maven encodes %2F again %252F while accessing a file from build target directory.


I tried setting the JOB_NAME to BRANCH_NAME in the Jenkinsfile



env
.JOB_NAME = env.BRANCH_NAME.substring(env.BRANCH_NAME.lastIndexOf("/")+1)
echo  "JOB NAME is ${env.JOB_NAME}"


This did not help.

Is there a way to set the build job's name , not just display name, so that I can have the workspace directory as

${WORKSPACE_ROOT}/${PIPELINE_NAME}/foo_bar_somemodule_projectA 


Thanks

-Suresh
Reply all
Reply to author
Forward
0 new messages