Reputation: 16760
I am calling a shared library groovy script from my Jenkins pipeline.
Using the pwd()
method I can properly get the workspace path and I can even see the required file in the exact same location in the Jenkins node.
Still I am getting following error:
java.io.FileNotFoundException: C:\Jenkins\workspace\Demo\test\target\site\xyz\abc.csv (No such file or directory)
I have the groovy-scripts/vars/generateHtml.groovy
shared library which is being called from the pipeline as generateHtml()
. The relevant code snippet:
def call() {
def ws = pwd()
echo "path ${ws}: generateHtml>start"
def targetPath = "${ws}\\target\\"
def resultFile = targetPath + 'site\\xyz\\abc.csv'
def data = parseCsv(new File(resultFile).getText('UTF-8'))
...
Upvotes: 0
Views: 573
Reputation: 37600
Reading a file in Jenkins Pipelines goes via readFile
. Don't use plain groovy for I/O.
Upvotes: 1