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

Can't read file with Groovy API

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Critical
    • Resolution: Not A Defect
    • pipeline
    • None
    • OSX 10.11.6

    Description

      I have a file in my workspace that was generated by a Maven plugin. When I try to read it with

      new File(filename).text

      a FileNotFoundException was thrown although the file exists. The pipeline doesn't run in a sandbox and there's no method to approve at the In-process Script Approval view.

      But I'm able to read that file using the pipeline's readFile method.

      I tried both a relative as well as an absolute path to the file.

      Is there anything I'm missing or is this a bug?

      Attachments

        Activity

          jglick Jesse Glick added a comment -

          Reference to readFile indicates that this was misfiled.

          jglick Jesse Glick added a comment - Reference to readFile indicates that this was misfiled.
          jglick Jesse Glick added a comment -

          …and, as designed. Use of java.io.File is prohibited for security reasons, and would not work with agents anyway, since all Groovy code runs on the master. Use readFile.

          jglick Jesse Glick added a comment - …and, as designed. Use of java.io.File is prohibited for security reasons, and would not work with agents anyway, since all Groovy code runs on the master. Use readFile .

          People

            Unassigned Unassigned
            maxzilla Max Wahler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: