Reputation: 1274
How to checkout to a specific path in jenkins node setup. I am using ubuntu14.04 and go language.
What I have followed is below:
Created a jenkins user in my slave machine and created folder called jenkins_slave
so, my pwd is /home/jenkins/jenkins_slave
. I have provided this in my node configuration in Jenkins master. My GOPATH is set to /home/jenkins/jenkins_slave/go
.
When I execute my build step, jenkins is cloning my master branch git repo into /home/jenkins/jenkins_slave/workspace/pipeline
(pipeline is my job name).. But what I am looking is my git repo should be checkout to a custom path like /home/jenkins/jenkins_slave/go/src/github.com/username/repository
.
What are all the options to keep my git code into the above repository?
Upvotes: 2
Views: 2597
Reputation: 291
If you are cloning your repo using git under Source Code Management then you can clone your repo to specified directory using below:
Under Additional Behaviours : Check out to sub directory
URL of the GIT plugin: https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin
If you are doing it in command line then you can do like below:
git clone <git_repo> /home/jenkins/jenkins_slave/go/src/github.com/username/repository
Upvotes: 0
Reputation: 8610
You need to configure your job to use custom workspace - in the job configuration under restrict where this job can run you have an advance button on the right, click on it and then you'll see the custom workspace option.
If it's a maven project you have in the advance section "use custom workspace"
Your custom workspace should be : go/src/github.com/username/repository
Good luck!
Upvotes: 1