I have a declarative pipeline script for my multibranch project in which I would like to read a text file and store the result as a string variable to be accessed by a later step in the pipeline. Using the snippet generator I tried to do something like this:
filename = readFile 'output.txt'
For which filename
would be my string.
I get an error in the Jenkins console output:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 30: Expected a step @ line 30, column 5.
filename = readFile 'output.txt'
Do I need to use a withEnv
step to set the output of readFile
to a Jenkins environment variable? If so, how?
Thanks