A recent change (or bug) in either Docker and/or Jenkins is breaking most tutorials in the Jenkins User Documentation.

1,081 views
Skip to first unread message

Giles Gaskell

unread,
Jan 21, 2018, 9:04:15 PM1/21/18
to Jenkins Users
Hi all,

I recently saw someone raise this issue in the GitHub repository that the Build a Java app with Maven tutorial uses.

This issue shows the output of the Pipeline run with the typical failures that happen fairly early on:

sh: can't create /var/jenkins_home/workspace/sjma@tmp/durable-cd13b59e/jenkins-log.txt: nonexistent directory
sh: can't create /var/jenkins_home/workspace/sjma@tmp/durable-cd13b59e/jenkins-result.txt: nonexistent directory

I even began running though this tutorial myself and encountered the same problem... I would also expect the same problematic output in most of the other tutorials.

Essentially, the tutorial asks the reader to do the following:
  1. Install Jenkins in Docker (locally on your computer).
  2. Fork the sample GitHub repository and clone it locally to your computer.
  3. Create your Jenkinsfile within your locally cloned repo on the your computer.
  4. Run the declarative Pipeline in Jenkins.
Puzzled as to why this might be happening, I found this closed issue in the jenkinsci/docker GitHub project which seems to shed a bit of light on the problem. However, I wasn't quite sure if the actual problem (be it a change or issue with the Jenkins Docker image or Docker itself) was clearly identified.

Since lots of people use these tutorials (i.e. from September/October last year, over 900 people have forked the simple-java-maven-app repository used by this first tutorial), I am keen to identify the cause of this issue (and potentially fix the tutorial content asap so that the tutorials will start working again).

Therefore, does anyone here have any suggestions as what might be the cause of this issue and/or how I might amend the tutorials to get them working again. For example, are there additional options I could add to the docker run ... command?

Many thanks,
Giles.

P.S. I am keen to keep using the Jenkins Docker container method for running Jenkins since this is a convenient way to get Jenkins up and running locally.

Mark Waite

unread,
Jan 21, 2018, 10:03:31 PM1/21/18
to jenkins...@googlegroups.com
That sounds like a bug.  

Is this with the long-term support release (2.89.3) or with a weekly release (like 2.102).

If it is a weekly release, is the same problem visible in a weekly release prior to 2.102?  The 2.102 release includes a security improvement (JEP-200) which detected several places that need further changes.

If it is with LTS or an earlier weekly release, submit a bug report ( https://wiki.jenkins.io/display/JENKINS/How+to+report+an+issue ).
 
Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/841d29f5-2ea5-48a0-bb2b-339a6f11a918%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Giles Gaskell

unread,
Jan 21, 2018, 11:49:08 PM1/21/18
to Jenkins Users
Thanks for your speedy reply Mark,

I ended up raising a bug report here: https://issues.jenkins-ci.org/browse/JENKINS-49063

This behavior is definitely manifesting itself through the Jenkins LTS release 2.89.3. In fact, I'm using a recent update of the "jenkinsci/blueocean" Docker image - see the "Environment" details in the bug report above.

Incidentally, I also tried this out on the latest weekly release of the "jenkins/jenkins" Docker image (i.e. 2.103) but received a different error because unlike the "jenkinsci/blueocean" Docker image's container, the "docker" command doesn't appear to be available in the "jenkins/jenkins" container. Hence, I got the error:

...
 
[simple-java-maven-app] Running shell script
+ docker pull maven:3-alpine
/var/jenkins_home/workspace/simple-java-maven-app@tmp/durable-9030abcd/script.sh: 2: /var/jenkins_home/workspace/simple-java-maven-app@tmp/durable-9030abcd/script.sh: docker: not found 

[Pipeline] } 
 
...

Giles

Damien Duportal

unread,
Jan 23, 2018, 8:47:37 AM1/23/18
to Jenkins Users
This issue is related to the "Docker Pipeline" plugin ("docker-workflow") which has an issue when trying to determine if the executor (master or agent) is running inside a container.

See issue/PR #120 of "docker-workflow-plugin", in particular https://github.com/jenkinsci/docker-workflow-plugin/pull/120#issuecomment-357284756 which is for the standard "docker".

Here is my work list items to diagnose this:

* The tutorials are working quite well with some older version of Docker (example: 17.09)
* When the tutorial is not working, wee the build failing, and before the error message "sh....not found...", we have a difference in the logs: it says "Jenkins does not seem to be running inside a container".
  - We can also see the "docker run" commands issued by the docker-workflow plugin: 
    > BEFORE: "--volumes-from <SOME_CONTAINER_ID>"
    > AFTER: "-v /var/jenkins_home/....:/var/jenkins_home/....."
* As Far as I Understand, The function "getContainerIdIfContainerized()" is returning the Optional.absent() String when it is not working, so the condition is false.
* Before diving in the code (and because I really suck at reading/writing code), I first checked my cgroup self file to see what it looks like (smelling Pattern issue...): https://gist.github.com/dduportal/67f965dd935b4fb7d316b798f2a6c2ef
  - While someone with the tutorial working got this: https://gist.github.com/dduportal/0ac5e5c76043e95fa0b5ff85c1b0c93e
* See the diff? "/docker/" vs. "/docker-ce/".
* Searching the Internet made it easy to catch https://github.com/jenkinsci/docker-workflow-plugin/pull/120 .

=> The constant used to get the cgroup pattern to catch has to be improved (short term) in order to catch the new patterns: "docker-ce", "docker-ee", "kubernetes" ones and "ecs".
=> This to be solved need to see an update of the plugin with this fix at least. Long term would be to find another way of detecting the container inception, or providing customizable configs for this.

Giles Gaskell

unread,
Jan 23, 2018, 8:10:09 PM1/23/18
to jenkins...@googlegroups.com
Thanks so much for all the sleuthing work Damien - you've hit the nail on the head with this one.

Cheers,
Giles.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/4HqDdTmRV2A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a7be4835-a68c-4502-8071-827a3ccb0a4b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Giles Gaskell
Senior Technical Writer
Cloudbees, Inc.

Giles Gaskell

unread,
Jan 23, 2018, 10:12:58 PM1/23/18
to Jenkins Users
Hi everyone,

Just a quick follow-up ...

It's possible that this issue may have resulted from recent changes in Docker behavior (i.e. in recent Docker versions) which were no longer being handled correctly by the Jenkins Docker Pipeline plugin.

Once this PR (https://github.com/jenkinsci/docker-workflow-plugin/pull/128) is merged and a new version of this plugin released, then these tutorials should start working again (as documented).

Cheers,
Giles.

desmo...@docdoc.com

unread,
Jan 29, 2018, 10:10:52 PM1/29/18
to Jenkins Users
Hi All,

I've updated all the plug-in for jenkins but I still can't get the tutorial to work. I'm getting this error when it runs

[simple-java-maven-app] Running shell script
sh: can't create /var/jenkins_home/workspace/simple-java-maven-app@tmp/durable-3b228035/jenkins-log.txt: nonexistent directory
sh: can't create /var/jenkins_home/workspace/simple-java-maven-app@tmp/durable-3b228035/jenkins-result.txt: nonexistent directory
script returned exit code -2

I've even tried reinstall everything, but I'm still getting this error.

Is it still an issue or am I the only one having this problem

I'm using a MacBook Pro on High Sierra.

Thanks.
Giles.

To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.

Carlos Sanchez

unread,
Jan 30, 2018, 4:40:05 AM1/30/18
to Jenkins Users
This is biting a lot of users and reporting it as a bug https://github.com/jenkinsci/docker/issues/626 



To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/77a76a26-07d6-48f4-8b60-bf1db9377149%40googlegroups.com.

Damien Duportal

unread,
Jan 30, 2018, 5:56:01 AM1/30/18
to jenkins...@googlegroups.com
Hi,

you did everything good, it is just that the plugin had not been released yet with the fix (it is "merged" on the master branch, but not released yet).

The releases at the "Code" level can be found here: https://github.com/jenkinsci/docker-workflow-plugin/releases .
=> The last one is 1.1.4.

On the plugin website, where the plugins you install in Jenkins generally come from, it is also at the 1.14 version: https://plugins.jenkins.io/docker-workflow .

With the FOSDEM at the end of the week, I suppose the maintainers are busy travelling / sleeping. Let's wait a bit on this.

Thanks for taking time for putting the feedback together!

Damien


For more options, visit https://groups.google.com/d/optout.
--

Damien DUPORTAL
Training Engineer
CloudBees, Inc.

CloudBees-Logo.png


M: +33650833776 | +32472972006
E: ddup...@cloudbees.com

Skype: damien.duportal
Twitter: @DamienDuportal

Giles Gaskell

unread,
Jan 31, 2018, 5:59:55 PM1/31/18
to Jenkins Users
Hi all and thanks Damien,

Just letting everyone know that a new version of the Docker Pipeline plugin (i.e. version 1.15) was released yesterday (https://plugins.jenkins.io/docker-workflow) and so if you update this plugin on your Jenkins instances (via Manage Jenkins > Manage Plugins) to this version (or later), these tutorials will resume running successfully again.

Cheers,
Giles.

desmo...@docdoc.com

unread,
Jan 31, 2018, 10:18:39 PM1/31/18
to Jenkins Users
Thanks Giles for the update.

Hi All,

I have another issue, I'm doing the deliver (from the tutorial) and I'm getting this error

./jenkins/scripts/deliver.sh: not found
Do I need to put the file in?

Desmond

desmo...@docdoc.com

unread,
Jan 31, 2018, 10:27:20 PM1/31/18
to Jenkins Users
Hi All,

Thanks for everyone's help. I made a big mistake. So it was my problem.

Thank you.

Desmond
Reply all
Reply to author
Forward
0 new messages