詹金斯管道阶段-传递整个文件 [英] Jenkins pipeline stages - passing whole file

查看:144
本文介绍了詹金斯管道阶段-传递整个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行带有包含多个节点的阶段的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).

这篇关于詹金斯管道阶段-传递整个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆