Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use build timestamp in setting build description Jenkins

Tags:

jenkins

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!

like image 344
Maria Avatar asked Dec 27 '25 16:12

Maria


1 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
like image 91
mszalbach Avatar answered Dec 31 '25 17:12

mszalbach



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!