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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • groovy-plugin
    • None
    • 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?

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

              Created:
              Updated:
              Resolved: