简体   繁体   English

如何获得或通过其他职位建立持续时间到当前职位

[英]How to get or pass other job build duration to current job

I have two test jobs(say job A and job B), and will run the test report job(say job C) after job A and job B finished, and will send test report with the email template which I want to contain job A and job B duration string. 我有两个测试作业(例如作业A和作业B),并且将在作业A和作业B完成后运行测试报告作业(例如作业C),并且将发送包含我要包含作业A的电子邮件模板的测试报告和作业B持续时间字符串。 So how to get the job A and job B duration string in job C? 那么,如何获取作业C中的作业A和作业B持续时间字符串?

You can curl the api for the json for the build to get the duration and convert it to human readable format: 您可以卷曲json的api以进行构建,以获取持续时间并将其转换为人类可读的格式:

https://<jenkins-url>:<port>/job/<job-name>/lastBuild/api/json

If you want to see a 'pretty' version of the json, you can append the below to the above url: 如果要查看json的“漂亮”版本,可以将以下内容附加到上面的url:

?pretty=true

There will be a duration variable within the json that will contain the time spent building (not sure if it highlights any 'waiting' time). json中将有一个duration变量,其中包含花费的构建时间(不确定是否突出显示任何“等待”时间)。

Some examples of people doing similar things: 人们在做类似事情的一些例子:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM