如何从詹金斯(Jenkins)构建变量获取构建时间戳记? [英] How to get build time stamp from Jenkins build variables?

查看:119
本文介绍了如何从詹金斯(Jenkins)构建变量获取构建时间戳记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从Jenkins获取最新版本的构建时间戳记? 我想在后期制作操作中将此值插入电子邮件"主题.

How can I get build time stamp of the latest build from Jenkins? I want to insert this value in the Email subject in post build actions.

推荐答案

注意:在詹金斯1.597中已更改,请参阅

NOTE: This changed in Jenkins 1.597, Please see here for more info regarding the migration

通过导航到https://<your-jenkins>/env-vars.html,您应该能够查看在构建过程中可用的所有全局环境变量.

You should be able to view all the global environment variables that are available during the build by navigating to https://<your-jenkins>/env-vars.html.

https://<your-jenkins>/替换为用于获取Jenkins网页的URL(例如,可能为http://localhost:8080/env-vars.html).

Replace https://<your-jenkins>/ with the URL you use to get to Jenkins webpage (for example, it could be http://localhost:8080/env-vars.html).

其中一个环境变量是:

BUILD_ID
    The current build id, such as "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)

如果您使用jenkins可编辑的电子邮件通知,则应该能够在电子邮件的主题行中使用${ENV, var="BUILD_ID"}.

If you use jenkins editable email notification, you should be able to use ${ENV, var="BUILD_ID"} in the subject line of your email.

这篇关于如何从詹金斯(Jenkins)构建变量获取构建时间戳记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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