詹金斯管道阶段-传递整个文件
运行带有包含多个节点的阶段的Jenkins管道(基于Groovy),我需要将列表从stageA上NodeA上的某个文件传递到StageB上的nodeB.
Running a Jenkins pipeline (based on Groovy) with stages containing many nodes, I need to pass a list from some file on NodeA on stageA to nodeB on StageB.
在stageA NodeA中,我运行
In stageA NodeA I run
DEVenv = readFile 'somefile.txt'
我在StageB中奔跑
In stageB I run
println DEVenv
到目前为止,我已经在控制台中获得了输出.
So far so good, I get the output in the console.
现在如何将println DEVenv
的输出传递到文件?
Now how to pass the output of that println DEVenv
to a file?
println DEVenv > otherfile.txt
不能解决问题:-(
我确定这没什么大不了的,但是我已经花了几个小时来搅动互联网了.
I'm sure it's not such a big deal but I've been churning the internet for a couple of hours to no avail.
You can write content to a file using the writeFile
step:
writeFile file: 'otherfile.txt', text: DEVenv
顺便说一句.为了将工作空间内容传输到另一个节点,您应该使用 stash/unstash
步骤(不确定,如果您已经使用过的话).
Btw. In order to transfer workspace contents to another node, you are supposed to use the stash/unstash
steps (not sure, if you use that already).