Agent fails to run the job because working directory doesn't exist

2,262 views
Skip to first unread message

Marcos de Vera Piquero

unread,
Jul 21, 2017, 12:20:48 PM7/21/17
to jenkins...@googlegroups.com
Hi,

I'm trying to move our current Jenkins setup based on one single master to a distributed one.  My first tests were unsuccessful because the agent is unable to move into the working directory because it doesn't exist[0].

I don't know why it doesn't exist, if the agent is unable to create it or whatever, it's my first time working with agents.  If I manually create the directory and I replay the job, it works flawlessly.  It doesn't seem to be a permissions issue because as the jenkins user I can create the directory to make it work.

If there's anything else that may help to find out the issue, please ask.


Any help will be appreciated.  Thanks.


[0] Error log:

Branch indexing
 > git rev-parse --is-inside-work-tree # timeout=10
Setting origin to g...@bitbucket.org:team/repo.git
 > git config remote.origin.url g...@bitbucket.org:team/repo.git # timeout=10
Fetching origin...
Fetching upstream changes from origin
 > git --version # timeout=10
using GIT_SSH to set credentials Bitbucket's SSH key for gitbuilder user
 > git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
Seen branch in repository origin/master
Seen 1 remote branches
Obtained Jenkinsfile from 921e5f009081e94a3e0fdca8ebff348eb6fe9f42
[Pipeline] node
Running on ci-agent in /var/lib/jenkins/workspace/repo-master-NAAVC2GRFCXXGFYOR2UC7EUBACPEPHI5FP4BDIYXDKLTKAQ7Y6CA
[Pipeline] {
[Pipeline] nvm
[repo-master-NAAVC2GRFCXXGFYOR2UC7EUBACPEPHI5FP4BDIYXDKLTKAQ7Y6CA] $ bash -c "export > before.env"
[Pipeline] // nvm
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.io.IOException: Process working directory '/var/lib/jenkins/workspace/repo_master-NAAVC2GRFCXXGFYOR2UC7EUBACPEPHI5FP4BDIYXDKLTKAQ7Y6CA' doesn't exist!
at hudson.Proc$LocalProc.<init>(Proc.java:247)
at hudson.Proc$LocalProc.<init>(Proc.java:218)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:930)
at hudson.Launcher$ProcStarter.start(Launcher.java:450)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1299)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1260)
at hudson.remoting.UserRequest.perform(UserRequest.java:181)
at hudson.remoting.UserRequest.perform(UserRequest.java:52)
at hudson.remoting.Request$2.run(Request.java:336)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at ......remote call to ci-agent(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1554)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:281)
at hudson.remoting.Channel.call(Channel.java:839)
at hudson.Launcher$RemoteLauncher.launch(Launcher.java:1053)
at hudson.Launcher$ProcStarter.start(Launcher.java:450)
at hudson.Launcher$ProcStarter.join(Launcher.java:461)
at org.jenkinsci.plugins.nvm.NvmWrapperUtil.getExport(NvmWrapperUtil.java:103)
at org.jenkinsci.plugins.nvm.NvmWrapperUtil.getNpmEnvVars(NvmWrapperUtil.java:60)
at org.jenkinsci.plugins.nvm.NvmStep$Execution.start(NvmStep.java:121)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:224)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:150)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
at sun.reflect.GeneratedMethodAccessor231.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:151)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
at WorkflowScript.run(WorkflowScript:3)
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.GeneratedMethodAccessor223.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.ClosureBlock.eval(ClosureBlock.java:46)
at com.cloudbees.groovy.cps.Next.step(Next.java:83)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:173)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:162)
at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122)
at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:261)
at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:162)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:19)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:35)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:32)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:32)
at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:330)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:82)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:242)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:230)
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:112)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
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:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Finished: FAILURE


--
Marcos de Vera Piquero
Software Engineer @ Quobis | e: marcos...@quobis.com | t: +34902999465 

Marcos

unread,
Jul 21, 2017, 12:20:48 PM7/21/17
to jenkins...@googlegroups.com
Hi,

I'm trying to move our current Jenkins setup based on one single
master to a distributed one. My first tests were unsuccessful
because the agent is unable to move into the working directory
because it doesn't exist[0].

I don't know why it doesn't exist, if the agent is unable to
create it or whatever, it's my first time working with agents.
If I manually create the directory and I replay the job, it
works flawlessly. It doesn't seem to be a permissions issue
because as the jenkins user I can create the directory to make
it work.

If there's anything else that may help to find out the issue,
please ask.


Any help will be appreciated. Thanks.


[0] Full log:

Björn Pedersen

unread,
Jul 24, 2017, 1:54:26 AM7/24/17
to Jenkins Users, mar...@tenak.net


Am Freitag, 21. Juli 2017 18:20:48 UTC+2 schrieb Marcos:
Hi,

I'm trying to move our current Jenkins setup based on one single
master to a distributed one.  My first tests were unsuccessful
because the agent is unable to move into the working directory
because it doesn't exist[0].

You need to make sure the configured workspace base directory exists on  the slave node (check yuor slave configs, it should be /var/lib/jenkins/workspace ).

Björn 
 
--
Marcos

Marcos

unread,
Jul 24, 2017, 3:33:21 AM7/24/17
to jenkins...@googlegroups.com
Hi,

A 2017-07-24 07:54, 'Björn Pedersen' via Jenkins Users escrigué:

> You need to make sure the configured workspace base directory exists
> on the slave node (check yuor slave configs, it should be
> /var/lib/jenkins/workspace ).

It actually exists and it made no difference moving it to build on
master, where it also exists. And permissions are OK for the user
running Jenkins, double checked.

What I've found is that removing the nvm() { ... } wrap from my
Jenkinsfile it works OK, so I've filled a bug[0] for nvm-wrapper-plugin,
also after some chat in #jenkins with some other users.

Thanks,

[0] https://issues.jenkins-ci.org/browse/JENKINS-45742
--
Marcos
Reply all
Reply to author
Forward
0 new messages