Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running continuous integration (jenkins) #7

Open
sdave2 opened this issue Nov 22, 2016 · 3 comments
Open

Error running continuous integration (jenkins) #7

sdave2 opened this issue Nov 22, 2016 · 3 comments

Comments

@sdave2
Copy link

sdave2 commented Nov 22, 2016

I am going through the Docker book (Version: v1.12.3 (32f7583)) on OSx version 10.10.5
Going though the continuous-integration examples I am running into a few errors.

  1. Running the build job, I always get a failure.
    In order to debug why, here are the steps I followed:
1. docker run -it -v /srv/docker/jenkins/jenkins:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock jamtur01/jenkins /bin/bash
jenkins@081198b5b3d3:/$ls -la /var/jenkins_home/jobs/Docker_Test_Job/workspace/..
total 16
drwxr-xr-x  8 jenkins jenkins  272 Nov 22 21:24 .
drwxr-xr-x  3 jenkins jenkins  102 Nov 22 21:19 ..
drwxr-xr-x  9 jenkins jenkins  306 Nov 22 21:26 builds
-rw-r--r--  1 jenkins jenkins 2227 Nov 22 21:23 config.xml
lrwxrwxrwx  1 jenkins jenkins   22 Nov 22 21:24 lastStable -> builds/lastStableBuild
lrwxrwxrwx  1 jenkins jenkins   26 Nov 22 21:24 lastSuccessful -> builds/lastSuccessfulBuild
-rw-r--r--  1 jenkins jenkins    2 Nov 22 21:24 nextBuildNumber
drwxr-xr-x 14 jenkins jenkins  476 Nov 22 21:24 workspace

-- Checking the workspace folder --

jenkins@081198b5b3d3:/$ ls -la /var/jenkins_home/jobs/Docker_Test_Job/workspace/
total 36
drwxr-xr-x 14 jenkins jenkins   476 Nov 22 21:24 .
drwxr-xr-x  8 jenkins jenkins   272 Nov 22 21:24 ..
drwxr-xr-x 13 jenkins jenkins   442 Nov 22 21:24 .git
-rw-r--r--  1 jenkins jenkins   159 Nov 22 21:24 .gitignore
-rw-r--r--  1 jenkins jenkins   202 Nov 22 21:24 Dockerfile
-rw-r--r--  1 jenkins jenkins    61 Nov 22 21:24 Gemfile
-rw-r--r--  1 jenkins jenkins   418 Nov 22 21:24 Gemfile.lock
-rw-r--r--  1 jenkins jenkins 10273 Nov 22 21:24 LICENSE
-rw-r--r--  1 jenkins jenkins   142 Nov 22 21:24 README.md
-rw-r--r--  1 jenkins jenkins   265 Nov 22 21:24 Rakefile
drwxr-xr-x  3 jenkins jenkins   102 Nov 22 21:24 centos
drwxr-xr-x  3 jenkins jenkins   102 Nov 22 21:24 debian
drwxr-xr-x  3 jenkins jenkins   102 Nov 22 21:24 spec
drwxr-xr-x  3 jenkins jenkins   102 Nov 22 21:24 ubuntu
  1. sudo docker run -it -v /var/jenkins_home/jobs/Docker_Test_Job/workspace/..:/opt/project/ /bin/bash

root@2fc88b826ef7: cd /opt/project/workspace
root@2fc88b826ef7:/opt/project/workspace# ls -la
total 8
drwxr-xr-x 2 root root 4096 Nov 18 21:01 .
drwxr-xr-x 3 1000 1000 4096 Nov 18 21:01 ..

It looks like after running step# 3,
-v /var/jenkins_home/jobs/Docker_Test_Job/workspace/..:/opt/project/

this doesn't work as expected.
It doesn't look like the directory /var/jenkins_home/jobs/Docker_Test_Job/workspace/ is mounted to
/opt/project/

Do you have any insight on this?

@declanjryan
Copy link

declanjryan commented May 23, 2017

I'm having the same problem using v17.03.0 of the book on macOS 10.12.5. I followed these instructions, but couldn't make it work:

> sudo mkdir -p /var/jenkins_home
> cd /var/jenkins_home
> sudo chown -R 1000 /var/jenkins_home

I successfully completed the chapter using a VirtualBox CentOS as host (i.e., CentOS VM running docker that creates a Jenkins container that itself uses docker to create a test run) and file sharing from macOS with the CentOS host (and sharing internally with Jenkins).

That may work for others who want to work through the chapters while waiting for this issue to resolve.

@sspat
Copy link

sspat commented Jul 2, 2018

Same problem on Windows 10 using Docker Toolbox with Virtualbox, book version v17.12.0-ce.
opt/project/workspace directory is created during mounting but is empty, build fails on rake spec

@hubmeister
Copy link

hubmeister commented Dec 10, 2018

Similar problem as declanjryan while making the home directories and changing ownership.

Using book version:
Version: v18.03.1-ce (d498111)

The only way I could get the jenkins web interface to work on MacOSX, was to run docker like this:
sudo docker run -u root -d -p 8080:8080 -p 50000:50000
-v jenkins-data:/var/jenkins_home
-v /var/run/docker.sock:/var/run/docker.sock
--name jenkins
jamtur01/jenkins

Interesting that the first -v flag in listing 5.70 in the book calls for:
-v /var/jenkins_home:/var/jenkins_home

but I could not get this to work for the life of me, changing permissions and ownership and even trying /private/var/jenkins_home as James recommended for the Mac OS X users in Listing 5.68 on page 184, to no avail. Being new to docker, I'm not sure of the significance of the jenkin-data:/var/jenkins_home mapping but that seemed to at least get the container up and running so I could log into the web interface.

However, another thing I suggest is to select the "Install Suggested plugins" options on the Customize Jenkins, during the initial setup, otherwise, when James has you create your first build job on page 190, selecting the Git repository option under "Source Code Management" is not there as an option and to a rookie such as myself, you are left baffled, wondering how to enable this option.

Having said that, even after I was able to specify the git repository James setup for us, I was getting errors on the first build:

...
Commit message: "Update Dockerfile"
First time build. Skipping changelog.
FATAL: jenkins/scm/RunWithSCM
java.lang.NoClassDefFoundError: jenkins/scm/RunWithSCM
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at jenkins.util.AntClassLoader.defineClassFromData(AntClassLoader.java:1139)
	at hudson.ClassicPluginStrategy$AntClassLoader2.defineClassFromData(ClassicPluginStrategy.java:878)
	at jenkins.util.AntClassLoader.getClassFromStream(AntClassLoader.java:1310)
	at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1366)
	at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326)
	at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1079)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at org.jenkinsci.plugins.workflow.job.WorkflowJob$SCMListenerImpl.onCheckout(WorkflowJob.java:653)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:609)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
	at hudson.model.Run.execute(Run.java:1741)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:410)
Caused by: java.lang.ClassNotFoundException: jenkins.scm.RunWithSCM
	at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1376)
	at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326)
	at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1079)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 17 more
Finished: FAILURE

Looks like something to do with Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants