0
votes

I have just started Jenkins setup on docker. I started docker container and am planning to run the ANT script I have written, this is where problems started.

Jenkins kept on reporting

ERROR: Unable to find build script at /var/jenkins_home/workspace/SampleSCM/.SampleProject/build.xml

I am not sure how to access /var/Jenkins_home in my local host. Can someone please help ?

Thanks.

1
Is /var/jenkins_home the jenkins home on the host (so not in docker)? If you use the jenkins docker plugin it should do it for you. If your run from a shell script, make sure you map the workspace (this is what the plugin does as well), like so: docker run -v /var/jenkins_home/workspace/SampleSCM:/var/jenkins_home/workspace/SampleSCM -w /var/jenkins_home/workspace/SampleSCM [other options] imagename:tag [optional commands] - Rik
Thanks for your help. /var/Jenkins_home should be a directory on the host, wasn't aware of the directory structure. Please bear with my illiteracy. I tried executing the command, where can I place the build file now ? I still couldn't find a directory in my machine to place the build file. - Sri
Your setup and what you try to achieve is not very clear to me. If I understand correctly you are running a jenkins instance in docker, and you want to be able to access it from the host to place files for a build? - Rik
Yes Rik, My aim is to build Continous integration with Jenkins instance and as you said I have Jenkins container on Docker. I have a sample build.xml file for ANT to run, Jenkins is expecting the build.xml in the location( /var/jenkins_home/workspace/SampleSCM/.SampleProject/build.xml). I am stuck on finding this location on my personal laptop.. Just want to let you know, Jenkins, Docker are all in my Windows laptop and docker is installed with windows tool box. - Sri
You won't find this location on your laptop, because it is not there. It is inside the docker container. Normally you would checkout out the sources as part of your build. You do not "put" them there yourself. So this is definitely not best practice. If you want to see the files you can use the jenkins gui, or ssh/attach your container and look in there. The idea about docker is that it runs isolated, unless you tell it to map volumes - Rik

1 Answers

0
votes

You won't find this location on your laptop, because it is not there. It is inside the docker container.

Normally you would checkout out the sources as part of your build. You do not put them there yourself.

If you want to see the files you can use the jenkins gui, or ssh/attach your container (docker attach) and look in there. The idea about docker is that it runs isolated, unless you tell it to map volumes (See here for a reference)