Pass parent workspace in build flow

413 views
Skip to first unread message

GS_L

unread,
Oct 1, 2015, 11:53:13 AM10/1/15
to Jenkins Users
Hi

I have a build flow that runs several builds.
I want that all builds workspace will be under the parent workspace.
I pass the parent workspace through DSL:
The parent workspace is 'NightlyBuild'.
 
build("job1", parent_workspace:build.workspace) 

In job1 - I changed the workspace by checking the 'Use custom workspace'
in 'Directory' I entered the $parent_workspace variable
Results:
The job1 workspace set to '/var/lib/jenkins/$parent_workspace/' instead of '/var/lib/jenkins/NightlyBuild'.

Thanks

Ginga, Dick

unread,
Oct 1, 2015, 12:11:06 PM10/1/15
to jenkins...@googlegroups.com

I’m not sure “workspace” is a field of “build”.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a1534aaa-604e-4a7d-973d-c084a28c2940%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

GS_L

unread,
Oct 4, 2015, 5:46:46 AM10/4/15
to Jenkins Users
You right I used this to get the parent work space:
workspace = build.properties["environment"]["JENKINS_HOME"]+"/"+build.properties["environment"]["JOB_NAME"]
build("job1", parent_workspace:build.workspace) 

But still cannot pass it to the downstream jobs.

Ginga, Dick

unread,
Oct 5, 2015, 11:44:44 AM10/5/15
to jenkins...@googlegroups.com

You might find this easier:

 

Build (“job1”, parent_workspace: build.properties["environment"]["WORKSPACE"])

James Nord

unread,
Oct 5, 2015, 6:22:22 PM10/5/15
to Jenkins Users
no matter what you do this is not really a good thing to do and does not scale (the workspace is tied to the node) - so you will require all the jobs to run on the same node (it is a good practice to have a single exectutor per node - so you can see where this is heading!).  

If you want to do multiple jobs with the same files then you should look at the Clone Workspace SCM Plugin or think about migrating to workflow (which may require you to rearchitect bits of your jobs).
Reply all
Reply to author
Forward
0 new messages