Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins: how to run builds in unique directories

Tags:

jenkins

I am configuring Jenkins for the first time, have been a user of it until now.

I read the documentation and understand what "$WORKSPACE" means on the slave.

I had a misconception that by default the jobs on Jenkins Slave run in a unique directory per job inside the workspace directory. This doesnt seem to be the case.

How do I assign a unique directory per job run? Will Jenkins automatically cleanup this job run directory after its done?

like image 909
sam Avatar asked Feb 04 '16 17:02

sam


People also ask

How do I change the build directory in Jenkins?

So if you wish to change the Jenkins workspace, all you've do is change the path of your JENKINS_HOME. For slave nodes, specify the default workspace on the slave machine in the slave configuration under Manage Jenkins > Manage Nodes > > Configure > Remote FS root.

How do I create a custom workspace in Jenkins?

Build section. Click on Advanced button on the right side of the page. Check "Use custom workspace" Fill in the path to the desired folder.


Video Answer


1 Answers

By default jenkins runs from $WORKSPACE/JOB Name ; here WORKSPACE is defined in the node configuration. This could be changed by choosing Advance Project options -> Use custom workspace under your job configuration.

Regarding cleanup: Choose Build Environment -> Delete workspace before build starts under jobs configuration if you like to cleanup for each new job.

like image 147
venpa Avatar answered Oct 18 '22 08:10

venpa