Issue
How do I access the current date as a macro in Jenkins?
Caused by: org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'BUILD_TIMESTAMP' in 'sprint5-${BUILD_TIMESTAMP}'
${DATE}
didn't work either. Nothing in the glossary about macro
. https://jenkins.io/doc/book/glossary/
No useful search results. https://duckduckgo.com/?q=jenkins+date+macro&ia=web
Solution
You can check all default environment variables on http://<JENKINS_IP>:<JENKINS_PORT>/env-vars.html
or from official page.
By default there is no time environment variable. Previously it could be possible to use ${BUILD_ID}
, but now it is identical to ${BUILD_NUMBER}
for builds created in 1.597+ Jenkins.
For using ${BUILD_TIMESTAMP}
environment variable in your job, you need to install (and configure) Build Timestamp Plugin.
Note: I cannot check if you can use that plugin in Version Label Format
step exactly, so probably you can also look at Zentimestamp Plugin.
Answered By - biruk1230
Answer Checked By - Mildred Charles (JavaFixing Admin)