[JIRA] [docker-workflow-plugin] (JENKINS-33510) dir('foo') inside "docker.image().inside{}" does not affect CWD of launched processes

78 views
Skip to first unread message

jglick@cloudbees.com (JIRA)

unread,
Mar 15, 2016, 5:00:02 PM3/15/16
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
 
Jenkins / Bug JENKINS-33510
dir('foo') inside "docker.image().inside{}" does not affect CWD of launched processes
Change By: Jesse Glick
Summary: dir('foo') inside "docker.image().inside{}"  creates "foo@tmp" instead  does not affect CWD  of  changing dir  launched processes
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

cleclerc@cloudbees.com (JIRA)

unread,
Mar 15, 2016, 5:05:01 PM3/15/16
to jenkinsc...@googlegroups.com
Cyrille Le Clerc commented on Bug JENKINS-33510
 
Re: dir('foo') inside "docker.image().inside{}" does not affect CWD of launched processes

Jesse Glick it was unexpected to me but a folder "foo@tmp" was created. I can reproduce on a test environment if you want.

jglick@cloudbees.com (JIRA)

unread,
Mar 15, 2016, 5:30:02 PM3/15/16
to jenkinsc...@googlegroups.com

a folder "foo@tmp" was created

Well that part is expected, if you are using a new durable-tasks.

scm_issue_link@java.net (JIRA)

unread,
Mar 16, 2016, 2:07:02 AM3/16/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Jesse Glick
Path:
src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java
src/test/java/org/jenkinsci/plugins/docker/workflow/WithContainerStepTest.java
http://jenkins-ci.org/commit/docker-workflow-plugin/e1a32fc5628ce2197f3ee447372e0a7782487e69
Log:
JENKINS-33510 At least clearly diagnose failure to set CWD.

scm_issue_link@java.net (JIRA)

unread,
Mar 16, 2016, 2:07:03 AM3/16/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Nicolas De loof
Path:
src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java
src/test/java/org/jenkinsci/plugins/docker/workflow/WithContainerStepTest.java
http://jenkins-ci.org/commit/docker-workflow-plugin/e07ea8d7625a42a892d6f05810e331c69ea8af9a
Log:
Merge pull request #38 from jglick/diag-pwd-JENKINS-33510

JENKINS-33510 At least clearly diagnose failure to set CWD

mneale@cloudbees.com (JIRA)

unread,
Jun 14, 2016, 4:05:01 AM6/14/16
to jenkinsc...@googlegroups.com

This has been annoying me of late. I would like to work with multiple checked out repos using docker.inside, but this makes it difficult

This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

mneale@cloudbees.com (JIRA)

unread,
Jun 20, 2016, 6:59:01 PM6/20/16
to jenkinsc...@googlegroups.com
Michael Neale started work on Bug JENKINS-33510
 
Change By: Michael Neale
Status: Open In Progress

mneale@cloudbees.com (JIRA)

unread,
Jun 20, 2016, 7:00:01 PM6/20/16
to jenkinsc...@googlegroups.com

Jesse Glick I see the PR 38 for this was merged - so a new release of docker pipeline will close this right?

dothebart@citadel.org (JIRA)

unread,
Jul 22, 2016, 11:02:02 AM7/22/16
to jenkinsc...@googlegroups.com

This constellation:

docker.image('foo').inside {
node

{ sh 'pwd' }

fails for me too with:_
[ArangoDB_Devel_Build@2] Running shell script
JENKINS-33510: working directory will be /var/lib/jenkins/workspace/ArangoDB_Devel_Build not /var/lib/jenkins/workspace/ArangoDB_Devel_Build@2
sh: /var/lib/jenkins/workspace/ArangoDB_Devel_Build@2@tmp/durable-0b92a427/pid: No such file or directory
sh: /var/lib/jenkins/workspace/ArangoDB_Devel_Build@2@tmp/durable-0b92a427/jenkins-log.txt: No such file or directory
sh: /var/lib/jenkins/workspace/ArangoDB_Devel_Build@2@tmp/durable-0b92a427/jenkins-result.txt: No such file or directory_

I guess thats an artifact of this problem? is one discouraged to do that? Or will it be fixed?

jglick@cloudbees.com (JIRA)

unread,
Aug 29, 2016, 4:44:05 PM8/29/16
to jenkinsc...@googlegroups.com

tom.fennelly@gmail.com (JIRA)

unread,
Sep 15, 2016, 10:57:03 AM9/15/16
to jenkinsc...@googlegroups.com
Tom FENNELLY commented on Bug JENKINS-33510
 
Re: dir('foo') inside "docker.image().inside{}" does not affect CWD of launched processes

This had me scratching my head for a while. Glad to see there's a fix in progress.

scm_issue_link@java.net (JIRA)

unread,
Sep 23, 2016, 12:33:03 AM9/23/16
to jenkinsc...@googlegroups.com

scm_issue_link@java.net (JIRA)

unread,
Sep 23, 2016, 7:52:02 AM9/23/16
to jenkinsc...@googlegroups.com

nerd@gollygeewiz.com (JIRA)

unread,
Sep 23, 2016, 5:44:02 PM9/23/16
to jenkinsc...@googlegroups.com

Given this is cataloged as a "Minor" issue, is there a workaround for this? This appears to render this plugin unusable from what I observe. My fairly simple script:

docker.image("...").inside("--args...") {
   sh "gradle build"
}

can't get anywhere:

sh: /var/jenkins_home/workspace/job@tmp/durable-b85d7f08/pid: No such file or directory
sh: /var/jenkins_home/workspace/job@tmp/durable-b85d7f08/jenkins-log.txt: No such file or directory
sh: /var/jenkins_home/workspace/job@tmp/durable-b85d7f08/jenkins-result.txt: No such file or directory

aziz.alfoudari@gmail.com (JIRA)

unread,
Sep 23, 2016, 7:43:02 PM9/23/16
to jenkinsc...@googlegroups.com

Until there is a fix, a quick around is to append `cd foo &&` to each `sh` inside `dir('foo')`:

dir('foo') {
    sh 'cd foo && make'
}

nerd@gollygeewiz.com (JIRA)

unread,
Sep 23, 2016, 9:38:04 PM9/23/16
to jenkinsc...@googlegroups.com

I might have a different bug that has the same outcome but my script does not have any dir calls in it. With just a sh command I get this error.

scm_issue_link@java.net (JIRA)

unread,
Sep 26, 2016, 4:23:02 PM9/26/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Tom Fennelly
Path:
.printip.js
Dockerfile
Jenkinsfile
nightwatch.conf.js
package.json
run.sh
src/main/java/io/jenkins/blueocean/BOJUnitTest.java
src/main/java/io/jenkins/blueocean/BlueOceanWinstoneController.java
src/main/java/io/jenkins/blueocean/NightwatchRunner.java
src/main/js/custom_commands/moveClassicBottomStickyButtons.js
src/main/js/custom_commands/moveConfigpageButtons.js
src/main/js/custom_commands/removeBreadcrumbBar.js
src/main/js/custom_commands/removePageHead.js
src/main/js/globals.js
src/main/js/page_objects/blueocean/bluePipelineActivity.js
src/main/js/page_objects/classic_jenkins/folderCreate.js
src/main/js/page_objects/classic_jenkins/freestyleConfig.js
src/main/js/page_objects/classic_jenkins/freestyleCreate.js
src/main/js/page_objects/classic_jenkins/multibranchCreate.js
src/main/js/page_objects/classic_jenkins/pipelineCreate.js
src/main/nightwatch.json
src/test/java/utils/DevRunner.java
start-selenium.sh
stop-selenium.sh
http://jenkins-ci.org/commit/blueocean-acceptance-test/6aac5c09b5614833cb2bcd78bc346a7e4dd0c2da
Log:
More ATH shenanigans + a Jenkinsfile (#44)

  • Added a simple Jenkinsfile
  • Use docker-selenium images
  • Use official images in the local start selenium scripts
  • More tweaking of the Jenkinsfile
  • And more tweaking of the Jenkinsfile again
  • what's the pwd
  • what's the pwd
  • what's the pwd
  • Map in a volume for ~/.m2
  • Map in a volume for ~/.m2
  • No clue what I'm doing
  • revert BS tests
  • please show me something
  • dir doesn't work as you'd expect, it seems
  • come on
  • come on
  • come on
  • come on
  • come on
  • come on
  • come on
  • come on
  • come on
  • Ok ... needed plugins update and also see JENKINS-33510 .... ffs
  • Trying to get it to build ... rest-impl tests hanging
  • Changes to blueocean-ath-firefox
  • Changes to blueocean-ath-builder
  • Build BO and ATH on the executor
  • Try get it working on executor
  • Try get it working on executor
  • Nope .... must build inside a docker container so as to get node etc
  • Try and expose a port range
  • Back to not building in a container
  • Run the ATH
  • Back to not running selenium
  • printip
  • printip
  • printip
  • printip
  • printip
  • printip
  • printip
  • printip
  • Allow control of the http port used by the ATH Jenkins instance
  • Can I see variables inside the docker image ...
  • Allow spec of the blueocean host
  • Start selenium in the Jenkinsfile and try connecting
  • temp move build outside docker build container
  • More jiggery pokery
  • More jiggery pokery
  • More jiggery pokery
  • More jiggery pokery
  • removed dead comment
  • omg
  • Fixed build of bo
  • maven repo
  • maven repo - more
  • maven repo - more
  • maven repo - more
  • maven repo - more
  • maven repo - more
  • use a local nexus repo
  • use a local nexus repo
  • use a local nexus repo
  • use a local nexus repo
  • use a local nexus repo
  • use a local nexus repo
  • use a local nexus repo
  • use a local nexus repo
  • use a local nexus repo
  • use a local nexus repo
  • local repo binding
  • local repo binding
  • getting closer

the secret .... run on linux

  • print out the env
  • What is setting the env grrr
  • Fix jenkins_url file
  • bind the port for the jenskins server
  • Switch off selenium on the run script
  • Switch off selenium on the run script
  • Better messages on the start stop scripts
  • Updated the local docker file
  • Remove local .m2 binding
  • Build the docker image for building
  • See if it will work without an image name
  • Nope ... didn't work
  • Add docker label on node
  • use mvn tool
  • Can't run that node scrpit on a slave that already has an old node
  • export the selenium server container IP address
  • Connect using the docker bridge network
  • sudo source
  • Can't execute the script as source ... write IP to file
  • Trim process.env.BLUEO_SELENIUM_SERVER_ADDR
  • Try it on the CI Server
  • Cleaned up messages from selenium-docker start scripts
  • Use maven exit code for run script exit
  • removed echo of exception as it was causing an NPE
  • Trying to get the classic Jenkins pages working better
  • Make the target dir if not already there
  • Make moveClassicBottomStickyButtons complete more deterministic
  • Fix moveClassicBottomStickyButtons to complete if used on a non-classic Jenkins page
  • Remove the page head completely for classic Jenkins pages
  • Fix activity page object "Open" toast selector
  • Logging
  • Cleanup move sticky buttons complete
  • More cleanup of classic Jenkins page_object tweaks
  • Get an env
  • try checkout of branch by the same name
  • try checkout of branch by the same name
  • try checkout of branch by the same name
  • try checkout of branch by the same name
  • try checkout of branch by the same name
  • try checkout of branch by the same name
  • try checkout of branch by the same name
  • try checkout of branch by the same name
  • try checkout of branch by the same name
  • try checkout of branch by the same name
  • parameterise the branch name
  • parameterise the branch name - some comments in the Jenkinsfile
  • Output a message if we find a branch by that name
  • Fix comment in Jenkinsfile

aziz.alfoudari@gmail.com (JIRA)

unread,
Sep 26, 2016, 4:44:02 PM9/26/16
to jenkinsc...@googlegroups.com
Abdulaziz Alfoudari edited a comment on Bug JENKINS-33510
Until there is a fix, a quick around workaround is to append prepend `cd foo &&` to each `sh` inside `dir('foo')`:

{code}

dir('foo') {
    sh 'cd foo && make'
}
{code}

mneale@cloudbees.com (JIRA)

unread,
Sep 26, 2016, 7:30:01 PM9/26/16
to jenkinsc...@googlegroups.com

docwhat@gerf.org (JIRA)

unread,
Sep 26, 2016, 9:36:04 PM9/26/16
to jenkinsc...@googlegroups.com

I was trying to figure out if it was some weird spam or what...

mneale@cloudbees.com (JIRA)

unread,
Sep 26, 2016, 9:46:02 PM9/26/16
to jenkinsc...@googlegroups.com

Christian Höltje ha - no I think its just as this was referred to in a commit message in a pull request, and JIRA automatically picks it up (not directly related to this issue, but was impacted by it).

dene14@gmail.com (JIRA)

unread,
Feb 2, 2017, 1:15:02 AM2/2/17
to jenkinsc...@googlegroups.com

w.maleska@gmail.com (JIRA)

unread,
Feb 16, 2018, 9:42:03 AM2/16/18
to jenkinsc...@googlegroups.com
Waldek M commented on Bug JENKINS-33510
 
Re: dir('foo') inside "docker.image().inside{}" does not affect CWD of launched processes

I took the liberty to link JENKINS-38331 - per-stage `agent` declarations are also affected.

This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

mneale@cloudbees.com (JIRA)

unread,
Feb 18, 2018, 5:52:04 PM2/18/18
to jenkinsc...@googlegroups.com

thanks Waldek M - they most certainly are as they are using docker pipeline under the covers at the moment. 

attila@szeremi.org (JIRA)

unread,
Dec 31, 2018, 9:04:04 AM12/31/18
to jenkinsc...@googlegroups.com

This ticket is supposedly resolved... but then what do I need to write to make sure the `sh` commands are run in the correct working directory?

 

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

ddigtiar@cloudbees.com (JIRA)

unread,
Jan 1, 2019, 6:30:03 PM1/1/19
to jenkinsc...@googlegroups.com

Attila Szeremi If you Docker Pipeline plugin is 1.15 and Docker is 17.12 or newer then everything should just work no need to change the Pipeline

ddigtiar@cloudbees.com (JIRA)

unread,
Jan 1, 2019, 6:32:02 PM1/1/19
to jenkinsc...@googlegroups.com
Denys Digtiar edited a comment on Bug JENKINS-33510
[~amcsi] If you Docker Pipeline plugin is 1.15 and Docker is 17.12 or newer then everything should just work no need to change the Pipeline . That is if I understand the fix correctly.

attila@szeremi.org (JIRA)

unread,
Jan 2, 2019, 8:19:03 AM1/2/19
to jenkinsc...@googlegroups.com

Denys Digtiar I have Docker Pipeline plugin 1.17, and Docker version 18.09.0. And `sh 'pwd'` still gives me /var/jenkins_home/workspace/youtube-delete-tracker_cd rather than my expected Docker workdir which is /var/www.

attila@szeremi.org (JIRA)

unread,
Jan 2, 2019, 8:25:10 AM1/2/19
to jenkinsc...@googlegroups.com
Attila Szeremi edited a comment on Bug JENKINS-33510
[~duemir] I have Docker Pipeline plugin 1.17, and Docker version 18.09.0. And `sh 'pwd'` still gives me {{ doing dir in [my Jenkinsfile|https: / var / jenkins_home github.com / workspace amcsi /youtube-delete- tracker_cd tracker/blob/723ab7a9fcb508608141abbcd1615740c1d63264/Jenkinsfile.groovy] got me...

 

 
{code:java
} } rather than my expected Docker workdir which is
[Pipeline]
{
[Pipeline] stage
[Pipeline]
{ (Run tests)
[Pipeline] dir
Running in
/var/www
[Pipeline] {
[Pipeline] sh
[Pipeline]
}
[Pipeline] // dir
[Pipeline]
}
[Pipeline] // stage
[Pipeline] }
$ docker stop --time=1 baa0c2d74c1fdc4944eb4e0bb5eb57f8435caac1a2e28ab562140bb3e0daaf38
$ docker rm -f baa0c2d74c1fdc4944eb4e0bb5eb57f8435caac1a2e28ab562140bb3e0daaf38
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline

GitHub has been notified of this commit’s build result

java
. nio.file.AccessDeniedException: /var/www@tmp
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.createDirectory(UnixFileSystemProvider.java:384)
at java.nio.file.Files.createDirectory(Files.java:674)
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
at java.nio.file.Files.createDirectories(Files.java:767)
at hudson.FilePath.mkdirs(FilePath.java:3273)
at hudson.FilePath.access$1300(FilePath.java:213)
at hudson.FilePath$Mkdirs.invoke(FilePath.java:1254)
at hudson.FilePath$Mkdirs.invoke(FilePath.java:1250)
at hudson.FilePath.act(FilePath.java:1078)
at hudson.FilePath.act(FilePath.java:1061)
at hudson.FilePath.mkdirs(FilePath.java:1246)
at org.jenkinsci.plugins.durabletask.FileMonitoringTask$FileMonitoringController.<init>(FileMonitoringTask.java:174)
at org.jenkinsci.plugins.durabletask.BourneShellScript$ShellController.<init>(BourneShellScript.java:200)
at org.jenkinsci.plugins.durabletask.BourneShellScript$ShellController.<init>(BourneShellScript.java:192)
at org.jenkinsci.plugins.durabletask.BourneShellScript.launchWithCookie(BourneShellScript.java:110)
at org.jenkinsci.plugins.durabletask.FileMonitoringTask.launch(FileMonitoringTask.java:99)
at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.start(DurableTaskStep.java:278)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:270)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:178)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
at sun.reflect.GeneratedMethodAccessor312.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:157)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:155)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:129)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:129)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
at WorkflowScript.run(WorkflowScript:10)
at ___cps.transform___(Native Method)
at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
at sun.reflect.GeneratedMethodAccessor127.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
at com.cloudbees.groovy.cps.Next.step(Next.java:83)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$101(SandboxContinuable.java:34)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.lambda$run0$0(SandboxContinuable.java:59)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:58)
at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:182)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:332)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:83)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:244)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:232)
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE{code}
 

attila@szeremi.org (JIRA)

unread,
Jan 2, 2019, 8:25:20 AM1/2/19
to jenkinsc...@googlegroups.com
Attila Szeremi edited a comment on Bug JENKINS-33510
[~duemir] I have Docker Pipeline plugin 1.17, and Docker version 18.09.0. And doing dir in + [my Jenkinsfile|https://github.com/amcsi/youtube-delete-tracker/blob/723ab7a9fcb508608141abbcd1615740c1d63264/Jenkinsfile.groovy] + got me...

 

 
{code:java}

[Pipeline] {
[Pipeline] stage
[Pipeline] { (Run tests)
[Pipeline] dir
Running in /var/www
[Pipeline] {
[Pipeline] sh
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
$ docker stop --time=1 baa0c2d74c1fdc4944eb4e0bb5eb57f8435caac1a2e28ab562140bb3e0daaf38
$ docker rm -f baa0c2d74c1fdc4944eb4e0bb5eb57f8435caac1a2e28ab562140bb3e0daaf38
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline

GitHub has been notified of this commit’s build result

java.nio.file.AccessDeniedException: /var/www@tmp

ddigtiar@cloudbees.com (JIRA)

unread,
Jan 7, 2019, 2:02:04 AM1/7/19
to jenkinsc...@googlegroups.com

Attila Szeremi So the defect indeed looks fixed and the issue appears to be with the file access now. Jenkins is trying to create a temp working directory besides the current working directory to write a shell script to but doesn't seem to have access to the `/var` directory. I would recommend reaching out to the mailing list or StackOverflow to get help with it if you have not yet solved it.

attila@szeremi.org (JIRA)

unread,
Jan 7, 2019, 6:05:05 AM1/7/19
to jenkinsc...@googlegroups.com

Denys Digtiar oh, so it needs to create a directory like that as a sort of preparation.

But it doesn't make sense to me how it's expecting for the parent of the workdir to be writable.

I thought `/var/www` is fine for a workdir, but of course `/var` wouldn't be writable to the default user under normal circumstances. A popular article suggests to use `/app` as the workdir, where of course `/` wouldn't be writable. Why isn't Docker writing to `/var/tmp` instead which is writable? What am I (or others) expected to do instead?

 

attila@szeremi.org (JIRA)

unread,
Jan 7, 2019, 6:05:10 AM1/7/19
to jenkinsc...@googlegroups.com
Attila Szeremi edited a comment on Bug JENKINS-33510
[~duemir] oh, so it needs to create a directory like that as a sort of preparation.


But it doesn't make sense to me how it's expecting for the parent of the workdir to be writable.

I thought `/var/www` is fine for a workdir, but of course `/var` wouldn't be writable to the default user under normal circumstances. [ + A popular article + |https://buddy.works/guides/how-dockerize-node-application] suggests to use `/app` as the workdir, where of course `/` wouldn't be writable. Why isn't Docker writing to `/var/tmp` instead which is writable? What am I (or others) expected to do instead?

 

jglick@cloudbees.com (JIRA)

unread,
Jan 11, 2019, 4:56:03 PM1/11/19
to jenkinsc...@googlegroups.com

Attila Szeremi dir with an absolute path is not supported inside a Docker container. Not really related to this issue. Simply start your sh script with cd. Or avoid using the withDockerContainer step alogether—if it works perfectly for you out of the box, great, otherwise forget about it.

cowlinator@gmail.com (JIRA)

unread,
Jan 17, 2020, 5:08:05 PM1/17/20
to jenkinsc...@googlegroups.com

FYI, you need Docker Pipeline plugin v 1.15+ in order to see this fix.

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

cowlinator@gmail.com (JIRA)

unread,
Jan 17, 2020, 5:10:07 PM1/17/20
to jenkinsc...@googlegroups.com
p cowlinator edited a comment on Bug JENKINS-33510
FYI, you need Docker Pipeline plugin v 1.15+ and Docker v 17.12+ in order to see this fix.

jinzoo2013@gmail.com (JIRA)

unread,
Mar 11, 2020, 12:20:05 PM3/11/20
to jenkinsc...@googlegroups.com
john dow commented on Bug JENKINS-33510

I am still seeing this issue with Docker Pipeline v 1.22 and Docker v 19.03

Jenkinfile:

pipeline {
   agent { docker { 
     image 'ruby'
     args '-u root'
    } 
 }
 stages {
   stage('build') {
     steps {
       sh '$PWD'
       sh 'ruby --version'
     }
   }
 }

I get the following error:

 $ docker run -t -d -u 1000:996 -u root -w /var/jenkins_home/workspace/build-chef-pkgs --volumes-from 0d3a069ee976a6e027b7605d0b4d3abada6bcc9c1b1afcaf5ffa0610e4e83b76 -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** ruby cat $ docker top c9b3ddcd8df5ea3e447f163006cd42a057ca55eea49f6df1c806d0e010459bfc -eo pid,comm [Pipeline] { [Pipeline] stage [Pipeline] { (build) [Pipeline] sh + /var/jenkins_home/workspace/build-chef-pkgs /var/jenkins_home/workspace/build-chef-pkgs@tmp/durable-e13f4856/script.sh: 1: /var/jenkins_home/workspace/build-chef-pkgs@tmp/durable-e13f4856/script.sh: /var/jenkins_home/workspace/build-chef-pkgs: Permission denied

 

The working directory is mounted as root and I cannot override the default user or working directory arguments passed to the docker run command

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

w.maleska@gmail.com (JIRA)

unread,
Mar 11, 2020, 8:10:04 PM3/11/20
to jenkinsc...@googlegroups.com
Waldek M commented on Bug JENKINS-33510

john dow Have you given the example you wanted here? The Jenkinsfile you posted doesn't use dir () . Also, did you mean to use `sh "echo $PWD"` ?

w.maleska@gmail.com (JIRA)

unread,
Mar 11, 2020, 8:13:04 PM3/11/20
to jenkinsc...@googlegroups.com
Waldek M edited a comment on Bug JENKINS-33510
[~jinzoo] Have you given the example you wanted here? The Jenkinsfile you posted doesn't use dir () . Also, did you mean to use `sh "echo $PWD"` ?

 

Also, you did specify "-u root" in run args, which is exactly what you got.
Reply all
Reply to author
Forward
0 new messages