该错误是由于只允许您在
steps指令中使用管道步骤。我知道一种解决方法是使用
scriptstep并将任意管道脚本包装在其中,并将结果保存在环境变量中,以便以后使用。
因此,在您的情况下:
pipeline { agent any stages { stage("foo") { steps { script { env.FILENAME = readFile 'output.txt' } echo "${env.FILENAME}" } } }}


