Hi,

I've been experiementing trying to get some information which might give a 
clue to the issues I'm having with my Windows slave.

It's rather confusing, since to start with it worked fine. and the errors 
aren't consistent (looking for past logs I see an error with unstashing 
which I don't seem to be getting now).

Anyway, I created a pipeline with this groovy script

@NonCPS def printException(err)
{
    message = err.getMessage()
    stacktrace = err.getStackTrace()
    stacktrace.each { stackElem ->
    message += "\n" + stackElem.toString()
    }
    print message
}

def batch(platform)
{
    try {
        if (isUnix())
        {
            sh script:"echo running shell script"
        }
        else
        {
            bat script:"echo running batch script"
        }
        echo "Batch file ran ok"
    }
    catch (Exception err)
    {
        echo "Failed to run batch file on $platform"
        printException(err)
    }    
}

def dirStep(platform)
{
    try {
        dir ("mySubDirectory")
        {
            echo "In subdirectory"
            writeFile file:"mySubFile.txt", text:"this is a file in 
$platform"
        }
    }
    catch (Exception err)
    {
        echo "Failed enter subdirectory on $platform"
        printException(err)
    }     
}

def writeFileStep(platform)
{
    try {
        writeFile file:"myFile.txt", text:"this is a file in $platform"
        echo "wrote File on $platform"
    }
    catch (Exception err)
    {
        echo "Failed to create file on $platform"
        printException(err)
    }   
}

def testUnstash(platform)
{
     try {
        unstash "myStash"
        echo "instashed on $platform"
    }
    catch (Exception err)
    {
        echo "Failed to unstash on $platform"
        printException(err)
    }      
}

def runTests(nodeID)
{
    node (nodeID)
    {
        batch(nodeID)
        writeFileStep(nodeID)
        dirStep(nodeID)
        testUnstash(nodeID)
    }
}

stage("testing")
{
    node ("master")
    {
        writeFile file:"toStash.txt",text:"Testing stashing and unstashing"
        stash name:"myStash", include:"toStash.txt"
    }
    runTests("master")
    runTests("XCode")
    runTests("VS2013")
}


And when I run it, everything seems to work fine, except for the batch file 
step on windows. which gives an error related to MkDir

Started by user Jonathan Hodgson 
<http://cranetechnology.dynalias.net/jenkins/user/Jon>[Pipeline] 
stage[Pipeline] { (testing)[Pipeline] nodeRunning on master in 
/var/lib/jenkins/workspace/pipeline-test2[Pipeline] {[Pipeline] 
writeFile[Pipeline] stashStashed 3 file(s)[Pipeline] }[Pipeline] // 
node[Pipeline] nodeRunning on master in 
/var/lib/jenkins/workspace/pipeline-test2[Pipeline] {[Pipeline] 
isUnix[Pipeline] sh[pipeline-test2] Running shell script
+ echo running shell script
running shell script[Pipeline] echoBatch file ran ok[Pipeline] 
writeFile[Pipeline] echowrote File on master[Pipeline] dirRunning in 
/var/lib/jenkins/workspace/pipeline-test2/mySubDirectory[Pipeline] {[Pipeline] 
echoIn subdirectory[Pipeline] writeFile[Pipeline] }[Pipeline] // dir[Pipeline] 
unstash[Pipeline] echoinstahsed on master[Pipeline] }[Pipeline] // 
node[Pipeline] nodeRunning on iMac in 
/Users/jon/jenkins/workspace/pipeline-test2[Pipeline] {[Pipeline] 
isUnix[Pipeline] sh[pipeline-test2] Running shell script
+ echo running shell script
running shell script[Pipeline] echoBatch file ran ok[Pipeline] 
writeFile[Pipeline] echowrote File on XCode[Pipeline] dirRunning in 
/Users/jon/jenkins/workspace/pipeline-test2/mySubDirectory[Pipeline] 
{[Pipeline] echoIn subdirectory[Pipeline] writeFile[Pipeline] }[Pipeline] // 
dir[Pipeline] unstash[Pipeline] echoinstahsed on XCode[Pipeline] }[Pipeline] // 
node[Pipeline] nodeRunning on Asus K51 in 
C:\Jenkins\workspace\pipeline-test2[Pipeline] {[Pipeline] isUnix[Pipeline] 
bat[Pipeline] echoFailed to run batch file on VS2013[Pipeline] echoFailed to 
mkdirs: C:\Jenkins\workspace\pipeline-test2@tmp\durable-97381953
hudson.FilePath.mkdirs(FilePath.java:1169)
org.jenkinsci.plugins.durabletask.FileMonitoringTask$FileMonitoringController.<init>(FileMonitoringTask.java:101)
org.jenkinsci.plugins.durabletask.WindowsBatchScript$BatchController.<init>(WindowsBatchScript.java:94)
org.jenkinsci.plugins.durabletask.WindowsBatchScript$BatchController.<init>(WindowsBatchScript.java:92)
org.jenkinsci.plugins.durabletask.WindowsBatchScript.doLaunch(WindowsBatchScript.java:60)
org.jenkinsci.plugins.durabletask.FileMonitoringTask.launchWithCookie(FileMonitoringTask.java:66)
org.jenkinsci.plugins.durabletask.FileMonitoringTask.launch(FileMonitoringTask.java:61)
org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.start(DurableTaskStep.java:158)
org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:184)
org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:18)
WorkflowScript.batch(WorkflowScript:20)
WorkflowScript.runTests(WorkflowScript:77)
___cps.transform___(Native Method)
com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
sun.reflect.GeneratedMethodAccessor365.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
sun.reflect.GeneratedMethodAccessor385.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
com.cloudbees.groovy.cps.Next.step(Next.java:58)
com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163)
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)[Pipeline] writeFile[Pipeline] echowrote 
File on VS2013[Pipeline] dirRunning in 
C:\Jenkins\workspace\pipeline-test2\mySubDirectory[Pipeline] {[Pipeline] echoIn 
subdirectory[Pipeline] writeFile[Pipeline] }[Pipeline] // dir[Pipeline] 
unstash[Pipeline] echoinstahsed on VS2013[Pipeline] }[Pipeline] // 
node[Pipeline] }[Pipeline] // stage[Pipeline] End of PipelineFinished: SUCCESS


I tried deleteing the pipeline-test2 folder, and it gets recreated fine, as 
does its subdirectory, but the tmp folder breaks everything.

If anyone has any suggestions they would be gratefully received, since 
Jenkins is largely useless to me until I get this working again, and I've 
invested a LOT of time in getting this far.

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8e0b2c17-a6ae-4517-8541-cadf6be1d0da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to