Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-40424

mkdir failing for folders with no existing parent on windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • Jenkins 2.35 java 1.8.0_111-b14 (slave and master), Debian master, Windows 7 slave

      When my jenkins pipeline job needs to create a folder on my windows slave (be it the workspace folder, a temporary folder to hold a batch file, whatever) , such as

      C:\Jenkins\workspace\pipeline-test2@tmp\durable-487de3d5

      Then it will fail if the parent does not exist

      So in the above case, if

      C:\Jenkins\workspace\pipeline-test2@tmp

      already exists (e.g. I created it manually), then durable-487de3d5 will be created correctly, and the script will work.

      But if the parent does not exist, then I get the exception

      Failed to mkdirs: C:\Jenkins\workspace\pipeline-test2@tmp\durable-487de3d5
      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)
      

      Please note a couple of things
      1) This is not a remote drive (I've noticed a number of tickets referring to mkdir problems which involve remote drives with windows)
      2) This issue did not originally exist on this machine, previously folders were created as expected, so something changed. I have no idea if that was Jenkins, some windows update, a change in windows config... unfortunately the problem didn't manifest itself straight away because I was testing with workspaces which had already been successfully created before the problem began.
      3) If I run a different windows machine as a slave, it does not have this issue.

      I have no idea how to investigate this further, is there a way to step through the slave code in a debugger?

            Unassigned Unassigned
            jonhodgson Jon Hodgson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: