Reputation: 1037
I use Invoke top-level Maven targets to make a deploy to the artifactory.
I need to use a UNIX timestamp as a maven deployment property in the pom.xml.
Is there a variable in Jenkins, that keeps timestamp in UNIX format? I've tried BUILD_TIMESTAMP, but the format is wrong. Or maybe there are any better ways to do it?
Thanks in advance.
Please, don't advice me Promote artifactory plugin. There are some reasons, that now allow me to use it.
Upvotes: 0
Views: 1018
Reputation: 3759
If your Jenkins runs on a UNIX system you could run a shell command and store the output in a variable:
def unixTs = sh(
script: 'date -uIseconds',
returnStdout: true
).trim()
Upvotes: 1