I'm trying to read some file in a certain job. Using Script Console in Jenkins I see the follow:
- Jenkins can access the necessary build in a job
file = new File ("${Jenkins.instance.getItemByFullName('Build mac pipelines/sand box').lastBuild}")
The result will be:
Result: Build mac pipelines/sand box #44
- But when I try to read the file groovy1.txt like this:
file = new File ("${Jenkins.instance.getItemByFullName('Build mac pipelines/sand box').lastBuild}/groovy1.txt").text
then Jenkins can't find groovy1.txt file
Build mac pipelines/sand box #44/groovy1.txt (No such file or directory)
It happens while such file exists, screenshot
Why it happens and how to read the file ?