Yes - that fixed it.
Thanks Daniel.

> -----Original Message-----
> From: [email protected] [mailto:jenkinsci-
> [email protected]] On Behalf Of Daniel Beck
> Sent: 15 August 2014 18:33
> To: [email protected]
> Subject: Re: workflow issue with "dir"
> 
> From the error message, it seems "dir" requires a block containing the
> commands to run in the specified directory. Try something like
> 
> dir ('foobar') {
>    sh 'pwd'
> }
> 
> On 15.08.2014, at 19:02, James Nord (jnord) <[email protected]> wrote:
> 
> > Hi all,
> >
> > There seems to be an issue with the workflow "Change Directory" step (or
> me...)
> >
> > With the following workflow
> > node() {
> >   sh 'rm -fr -- *'
> >   sh 'mkdir foobar'
> >   echo 'about to change dir'
> >   dir 'foobar'
> >   echo 'changed dir'
> > }
> >
> > I get the following output
> >
> > Running: Allocate node : Start
> > Running on master in /opt/jenkins/data/jobs/changedir/workspace
> > Running: Allocate node : Body : Start
> > Running: Shell Script
> > [workspace] $ nohup sh -c
> "'/opt/jenkins/data/jobs/changedir/workspace/.8e7bf62b/script.sh' >
> '/opt/jenkins/data/jobs/changedir/workspace/.8e7bf62b/jenkins-log.txt'
> 2>&1; echo $? >
> '/opt/jenkins/data/jobs/changedir/workspace/.8e7bf62b/jenkins-result.txt'"
> > + rm -fr -- '*'
> > Running: Shell Script
> > [workspace] $ nohup sh -c
> "'/opt/jenkins/data/jobs/changedir/workspace/.22ea1fbb/script.sh' >
> '/opt/jenkins/data/jobs/changedir/workspace/.22ea1fbb/jenkins-log.txt'
> 2>&1; echo $? >
> '/opt/jenkins/data/jobs/changedir/workspace/.22ea1fbb/jenkins-result.txt'"
> > + mkdir foobar
> > Running: Print Message
> > about to change dir
> > Running: Change Directory
> > Running in /opt/jenkins/data/jobs/changedir/workspace/foobar
> > Running: Allocate node : Body : End
> > Running: Allocate node : End
> > Running: End of Workflow
> > java.lang.IllegalStateException: There's no body to invoke
> >   at
> org.jenkinsci.plugins.workflow.cps.CpsStepContext.invokeBodyLater(CpsSte
> pContext.java:226)
> >   at
> org.jenkinsci.plugins.workflow.cps.CpsStepContext.invokeBodyLater(CpsSte
> pContext.java:217)
> >   at
> org.jenkinsci.plugins.workflow.steps.PushdStep$Execution.start(PushdStep.
> java:77)
> >   at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:131)
> >   at
> org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:7
> 9)
> >   at
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClass
> Site.java:45)
> >   at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.j
> ava:42)
> >   at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.ja
> va:108)
> >   at
> com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvo
> ker.java:15)
> >   at Script1.run(Script1.groovy:5)
> >   at Unknown.Unknown(Unknown)
> >   at ___cps.transform___(Native Method)
> >   at
> com.cloudbees.groovy.cps.impl.ContinuationGroup$1.call(ContinuationGrou
> p.java:66)
> >   at
> com.cloudbees.groovy.cps.impl.ContinuationGroup$1.call(ContinuationGrou
> p.java:62)
> >   at sun.reflect.GeneratedMethodAccessor366.invoke(Unknown Source)
> >   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:43)
> >   at java.lang.reflect.Method.invoke(Method.java:606)
> >   at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 90)
> >   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
> >   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1079)
> >   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:903)
> >   at
> org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClass
> Site.java:44)
> >   at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.ja
> va:112)
> >   at
> com.cloudbees.groovy.cps.CategorySupport$_use_closure1.doCall(Category
> Support.groovy:15)
> >   at sun.reflect.GeneratedMethodAccessor365.invoke(Unknown Source)
> >   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:43)
> >   at java.lang.reflect.Method.invoke(Method.java:606)
> >   at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 90)
> >   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
> >   at
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(Cl
> osureMetaClass.java:272)
> >   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:903)
> >   at
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoM
> etaClassSite.java:66)
> >   at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCal
> lSite.java:141)
> >   at
> com.cloudbees.groovy.cps.CategorySupport$_use_closure1.doCall(Category
> Support.groovy)
> >   at sun.reflect.GeneratedMethodAccessor364.invoke(Unknown Source)
> >   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:43)
> >   at java.lang.reflect.Method.invoke(Method.java:606)
> >   at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> 90)
> >   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
> >   at
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(Cl
> osureMetaClass.java:272)
> >   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:903)
> >   at groovy.lang.Closure.call(Closure.java:415)
> >   at groovy.lang.Closure.call(Closure.java:409)
> >   at
> org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.
> use(GroovyCategorySupport.java:106)
> >   at
> org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.
> access$400(GroovyCategorySupport.java:64)
> >   at
> org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategory
> Support.java:246)
> >   at
> org.codehaus.groovy.runtime.GroovyCategorySupport$use.call(Unknown
> Source)
> >   at
> com.cloudbees.groovy.cps.CategorySupport.use(CategorySupport.groovy:14
> )
> >   at
> com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(Continuatio
> nGroup.java:62)
> >   at
> com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatc
> hOrArg(FunctionCallBlock.java:100)
> >   at
> com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(F
> unctionCallBlock.java:76)
> >   at sun.reflect.GeneratedMethodAccessor290.invoke(Unknown Source)
> >   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:43)
> >   at java.lang.reflect.Method.invoke(Method.java:606)
> >   at
> com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(C
> ontinuationPtr.java:72)
> >   at
> com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
> >   at com.cloudbees.groovy.cps.Next.step(Next.java:53)
> >   at com.cloudbees.groovy.cps.Next.run(Next.java:44)
> >   at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:109)
> >   at
> org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.jav
> a:155)
> >   at
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.ja
> va:252)
> >   at
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadG
> roup.java:68)
> >   at
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.
> java:168)
> >   at
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.
> java:166)
> >   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> >   at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.jav
> a:1145)
> >   at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
> va:615)
> >   at java.lang.Thread.run(Thread.java:745)
> > Finished: FAILURE
> >
> > I'm not entirely sure what's wrong here..
> >
> > /James

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to