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

Job directory is empty when using pipeline multi-branch

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • pipeline
    • None

      We have a multi-branch pipeline setup with our repo in GitHub. Since yesterday, we started noticing that new branches created in GitHub were not passing the build because, of the three directories that get created for the build, the @script dir has the sources, the @tmp is also present but the actual workspace directory is just empty. So, in our case,

      DebugTool-SomeRandomNum directory is just empty
      DebugTool-SomeRandomNum@script dirctory has the sources

      This started happening yesterday. For the other 4 branches (that we already had in GitHub when setting up the multi-branch pipeline), I see that the both the workspace and workspace@script dir have sources in them.

      For now, I have a rather crude way of getting around this

      properties([disableConcurrentBuilds()])
      
      node {
        env.BUILDSPACE = pwd()
        
        echo "BUILDSPACE is ${env.BUILDSPACE}"
        
        // check to see if sources are available in current dir. Else switch to @script dir 
        if (fileExists('package.json')) {
          echo 'package.json exists'
        } else {
          echo 'No package.json. Switching to script dir'
          env.BUILDSPACE = "${env.BUILDSPACE}" + '@script'
          echo "BUILDSPACE is ${env.BUILDSPACE}"
        }
      
         stage "Build Step"
          sh '''cd ${BUILDSPACE}
          #Do stuff here
          '''
      }
      
      

      I have attached the console log from the failed build (sanitized to remove actual GitHub URL info).

      It says that its "Running on master in /var/lib/jenkins/workspace/ZULUSCHED_DebugTool-6RUZGOFIV76HNXGYFRPCOHJUYYIS5YA2O7JZQWZG2RYSCS4XFCJQ"

      but then that directory is just empty

            Unassigned Unassigned
            bijoyjth Bijoy Thomas
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: