Closed venkatesh-cv closed 6 years ago
#sudo docker rm $CONTAINER
in the shell script in the jenkins job.-v /var/jenkins_home:/var/jenkins_home
on the jenkins container. The use of the same name to the mapped volume in the container allows us to use the same path /var/jenkins_home
inside the shell script we add in the jenkins job. /var/jenkins_home
be used exactly as-is is very important because as stated in the first two points, the build-container runs on the host machine & looks for /var/home path. Since the jenkins used the very same as a mapped volume, the files pulled by it would be sitting on the host machine for the build-container to access from and also the path name remains the same for the script to work.
This was not elucidated in the book and hence my having to rough it out a bit!
I'm jotting it down here hoping that this helps someone.I encountered another issue when running the jenkins job multiple times. git had trouble checking out code the second time as it got permission denied on the /spec/report/*.xml folder
rm -rf /var/jenkins_home/jobs/test_build/workspace/spec
folder
Building in workspace /var/jenkins_home/jobs/test_build/workspace
Wiping out workspace first.
java.nio.file.AccessDeniedException: /var/jenkins_home/jobs/test_build/workspace/spec/reports/SPEC-These-are-sample-RSpec-tests.448.xml
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
at java.nio.file.Files.deleteIfExists(Files.java:1165)
at hudson.Util.tryOnceDeleteFile(Util.java:290)
at hudson.Util.deleteFile(Util.java:245)
Caused: java.io.IOException: Unable to delete '/var/jenkins_home/jobs/test_build/workspace/spec/reports/SPEC-These-are-sample-RSpec-tests.448.xml'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
at hudson.Util.deleteFile(Util.java:250)
at hudson.FilePath.deleteRecursive(FilePath.java:1211)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1220)
at hudson.FilePath.deleteRecursive(FilePath.java:1202)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1220)
at hudson.FilePath.deleteRecursive(FilePath.java:1202)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1220)
at hudson.FilePath.access$1100(FilePath.java:197)
at hudson.FilePath$15.invoke(FilePath.java:1194)
at hudson.FilePath$15.invoke(FilePath.java:1191)
at hudson.FilePath.act(FilePath.java:998)
at hudson.FilePath.act(FilePath.java:976)
at hudson.FilePath.deleteContents(FilePath.java:1191)
at hudson.plugins.git.extensions.impl.WipeWorkspace.beforeCheckout(WipeWorkspace.java:30)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1157)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:560)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:485)
at hudson.model.Run.execute(Run.java:1735)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:405)
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: Test reports were found but none of them are new. Did leafNodes run?
For example, /var/jenkins_home/jobs/test_build/workspace/spec/reports/SPEC-These-are-sample-RSpec-tests.0.xml is 9 min 31 sec old
Finished: FAILURE
Context
I'm reading the Continuous Integration Chapter and following the Jenkins + Ruby setup. I'm able to launch Jenkins and configure & run the build. However, the build fails. Appreciate your help to understand what is going on.
Error Description
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
Debugging attempts
` Tagged the imag as 'myapp' to see whats happening. Noticed that the image is actually getting created on the host machine & not inside the jenkins container. I'm not sure if this should the case. Having created a docker server inside Jenkins container, the image should have been created in there. Is suspect that possibly this could be the a reason for issue described above
Container startup script
Execute Shell Script
JENKINS-OUTPUT
Images on the host machine (trimmed list)