I want to get Getting current timestamp in inline pipeline script using pipeline plugin of hudson. For setting up build display name.
Inline groovy script used:
def jobName = env.JOB_NAME + "_" + new Date()
currentBuild.displayName = "$jobName"
echo "job name $jobName"
Scripts not permitted to use new java.util.Date
Jenkins scripts are running in a sandbox, by default the Groovy script doesn't have permissions for some operations.
When you perform an operation without permissions the
RejectAccessException is thrown. So you've to execute your script, and then when the exception is thrown go to:
And approve the necessary permission: