I am trying to create a custom Environment variables in Jenkins by doing this
List of key-value pairs
Name: Build_Date Value: Date()
The value part is not resolving to a date - any ideas?
Here is where I am trying to config the above
Thanks
I am trying to create a custom Environment variables in Jenkins by doing this
List of key-value pairs
Name: Build_Date Value: Date()
The value part is not resolving to a date - any ideas?
Here is where I am trying to config the above
Thanks
I confirm that you can use the EnvInject plugin with a Groovy script:
Here is the Groovy script:
// Generate a global BUILD_ID_LONG variable with date and time
// =======================================
TimeZone.setDefault(TimeZone.getTimeZone('UTC'))
def now = new Date()
def map = [BUILD_ID_LONG: now.format("yyyyMMdd_HHmm")]
return map
Next, you can use the ${BUILD_ID_LONG} variable in your build steps.