在设置构建描述Jenkins中使用构建时间戳记 [英] Use build timestamp in setting build description Jenkins

查看:931
本文介绍了在设置构建描述Jenkins中使用构建时间戳记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了Description Setter插件,但我不知道是否以及如何使用BUILD_ID,它在jenkins/env-vars.html/中以以下格式显示:"2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss). 有谁知道我是否可以使用它以及如何使用它?

I have installed Description Setter Plugin but I don't know if and how I can use the BUILD_ID which in jenkins/env-vars.html/ is displayed in the format: "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss). Does anyone know if I can use it and how?

显示BUILD_ID是向构建描述添加时间戳的最简单方法,但是,如果不可能,我如何实现呢?

Displaying the BUILD_ID would be the easiest way to add timestamp to the build description, but if not possible, how can I achieve that?

谢谢!

推荐答案

他们替换了${BUILD_ID}变量以包含内部版本号而不是此时间戳(从1.597开始).参见 https://issues.jenkins-ci.org/browse/JENKINS-26520

They replaced the ${BUILD_ID} variable to contain the build number instead of this timestamp (since 1.597+). See https://issues.jenkins-ci.org/browse/JENKINS-26520

其他插件(例如EnvInject)也有一些解决方法,或者您仅使用Description Setter插件的regexp功能,如下所示:

There are some workarounds with other plugins like EnvInject or you just use the regexp feature of the Description Setter Plugin like this:

  • 添加执行Shell博客(适用于Linux)
  • 插入命令echo "date:" $(date +'%Y-%m-%d_%H-%M-%S')
  • 将Description Setter插件设置为regexp date:(.*)
  • 将Description Setter插件设置为description \1
  • add execute shell blog (works for Linux)
  • insert command echo "date:" $(date +'%Y-%m-%d_%H-%M-%S')
  • Set Description Setter plugin to regexp date:(.*)
  • Set Description Setter plugin to description \1

这篇关于在设置构建描述Jenkins中使用构建时间戳记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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