我正在开发声明性管道并希望使用文件参数来读取其内容,但它没有按预期工作
parameters{
file(fileLocation:'list.txt', description:'contains list of projects to be build')
}
我收到以下错误
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 12: Invalid parameter "fileLocation", did you mean "description"? @ line 12, column 14.
file(fileLocation:'release-list.txt', description:'contains list of projects to be build')
以下是基本步骤插件提到的另一个选项
readFile: Read file from workspace
Reads a file from a relative path (with root in current directory, usually workspace) and returns its content as a plain string.
file
Relative ( /-separated) path to file within a workspace to read.
Type: String
encoding (optional)
Type: String
它在脚本步骤中工作,例如
def myfile = readFile('list.txt')
echo "${myfile}"
但是如何在声明性脚本中直接使用它,因为我们使用了其他基本步骤,如 dir??