Reputation: 4016
We have some jobs set up which share a workspace. The workflow for the various branches is:
foo
.foo
.We accomplish this by assigning the Use custom workspace
field of the downstream jobs to the build workspace.
Recently, we took one branch and assigned it to be build on a Jenkins slave machine rather than on the master. I was surprised to find that on master, the foo
repository was cloned to $JENKINS_JOBS_PATH/FOO/workspace/foo_repo
- while on the slave, the repository was cloned to $JENKINS_JOBS_PATH/FOO/foo_repo
.
Is this by design, or have we somehow configured master and slave inconsistently?
Upvotes: 4
Views: 17678
Reputation: 5319
Older versions of Jenkins put the workspace under the ${JENKINS_HOME}/jobs/JOB/workspace
directories. After upgrading, this pattern stays with the Jenkins instance. New versions put the workspaces in ${JENKINS_HOME}/workspace/
. I suspect the slaves don't need to follow the old pattern (especially if it is a newer slave), so the directories may not be consistent across machines.
You can change the location of the workspaces on the master in Jenkins -> Configure Jenkins -> Advanced.
I think the safe way to handle this... If you are going to use a custom workspace, you should use that for all of your jobs, including the first one that builds the big honking c++ project.
If you did this all in a pipeline, you can run all of this in a single job and have more control over where all the files are, and you have the option of stash
and unstash
, but if the files are huge, stash may not be the way to go.
Upvotes: 5
Reputation: 75
You can omit 'Use custom workspace' option for each job and instead change master and/or slave workspace paths and use
%WORKSPACE%/../foo_repo path
or (that equal)
./../foo_repo path
In that case
%WORKSPACE% = [master or slave node workspace]/[job name]
and
%WORKSPACE%/../ = [master or slave node workspace]
Upvotes: 0