Use build timestamp in setting build description Jenkins
·
Answer a question
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?
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?
Thanks!
Answers
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
There are some workarounds with other plugins like EnvInject or you just use the regexp feature of the Description Setter Plugin like this:
- 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
更多推荐
所有评论(0)