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

Allocating a Node doesn't create a workspace

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core
    • None

      Hi,

       

      When using a scripted Pipeline with a node, there is no workspace directory created until you use a Jenkins built-in step which needs to write something.

       

      If you use plain Groovy code which write something, the workspace doesn't get created.

       

      The following simple Pipeline proves the bug:

      import groovy.json.JsonBuilder
      
      node {
          def token = [APPS: [
              [id: 1, app_name: "${APP_NAME}", version: "${APP_VERSION}"]
          ]]
          
          stage('Cleaning workspce') {
              cleanWs()
          }
      
          stage('Generating the token') {
              new File("${WORKSPACE}/mep.token").write(new JsonBuilder(token).toPrettyString())
          }
      }

       
      java.io.FileNotFoundException: /var/lib/jenkins/workspace/foobar/mep.token (Aucun fichier ou dossier de ce type)
       

      I'm not sure if it's a bug or if the documentation is wrong, but to me, it's a bug.

      Stating the documentation:

      A workspace is automatically allocated for you with the node step

            Unassigned Unassigned
            devantoine Antoine Descamps
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: