本文介绍了在詹金斯传递生成步骤之间的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的线沿线的东西:

这是过于简单,只是证明了我想要做什么。基本上,我希望能够将多个构建步骤之间的一个工作范围内的存储和访问的变量。另外,我可以避开由数据存储到一个文件,后来读它,但我喜欢的东西更容易,更哈克

生成步骤#1 - 执行shell

  $ START =时间戳

生成步骤#2 - 运行高就

生成步骤#3 - 执行shell

  $ END =时间戳
TIME_LAPSED = $ END-START $
(后失效时间的地方)


解决方案

有一件事情依然壳之间:在工作区结果。
简单和愚蠢的解决方案:使用文件(S)

巨大的额外的好处:它的工作原理,当你在多个作业分开你的工作,并使用克隆工作区插件

生成步骤#1 - 执行shell

  START =时间戳
...
回声$开始> env_start.txt

...

生成步骤#3 - 执行shell

  START =`猫env_start.txt`
END =时间戳
TIME_LAPSED = $ END-START $

I'd like to do something along the lines of:

This is overly simple and just demonstrates what I'd like to do. Basically, I want to be able to store and access variables within a single job scope between multiple build steps. Also, I can get around by storing the data to a file and reading it later, but I'd like something easier and less 'hacky'

Build Step #1 - Execute shell

$START=timestamp

Build Step #2 - Run another job

Build Step #3 - Execute Shell

$END=timestamp
TIME_LAPSED=$END-$START
(post lapsed time somewhere)
解决方案

One thing remains between shells: the workspace.
Simple and stupid solution: use file(s)!

Huge additional advantage: it works when you split your job in several jobs and use the Clone Workspace plugin

Build Step #1 - Execute shell

START=timestamp
...
echo $START > env_start.txt

...

Build Step #3 - Execute Shell

START=`cat env_start.txt`
END=timestamp
TIME_LAPSED=$END-$START

这篇关于在詹金斯传递生成步骤之间的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 22:45