Probably you simply want to allow that finding call.
Open the /scriptApproval screen for that purpose.

Depending on what you're trying to do. Maybe using long start =
System.currentTimeMillis() would suit your needs and be already whitelisted
(can't check just now).

HTH
Le 7 juil. 2016 9:51 PM, "Greg Smith" <[email protected]> a écrit :

>
> Hi,
>
> I would like to set a timestamp at the beginning of my pipeline build, put
> it into the environment, and reuse it throughout my build.
>
> I found some sample code - but it no longer seems to work because of
> sandboxing of the groovy pipeline scripts.
>
> The code is:
> env.TIMESTAMP = new
> java.text.SimpleDateFormat('yyyyMMddHHmmss').format(new Date())
>
> But I get this error now:
>
> org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts 
> not permitted to use new java.text.SimpleDateFormat java.lang.String
>       at 
> org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectNew(StaticWhitelist.java:185)
>
> How should I be setting a timestamp value that I can reuse over throughout 
> the rest of my build?
>
> Thanks,
> Greg
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/fae69470-a517-4167-a9fb-655170f92084%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/fae69470-a517-4167-a9fb-655170f92084%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS7QRTgx6fm%3DJkLpJ6trZe8WUiys_ti0xoaN8bSY4Y_qQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to