readFile not working for workspace folder: java.nio.file.NoSuchFileException

XMLWordPrintable

    • Type: Bug
    • Resolution: Not A Defect
    • Priority: Major
    • Component/s: groovy-plugin
    • None
    • Environment:
      v3.11.394

      The minimal Pipeline script results in an error:
      java.nio.file.NoSuchFileException: /var/lib/jenkins/jobs/.../.../workspace

      pipeline {
          agent any    stages {
              stage('Read file') {
                  steps {
                      script {
                          readFile("${WORKSPACE}")
                      }
                  }
              }
          }
      }
      

      Total unclear to me because readFile should be the method to read a file on the slave where new File("${WORKSPACE}") will allways read it on the master. Any hint?

            Assignee:
            Adrian
            Reporter:
            Adrian
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: