To quote R. Tyler Croy. NEVER DISABLE THE SANDBOX.

If you really want to do what you are trying to do, you can whitelist the
toTimestamp method of the java.util.Date class in the global configuration
area of Jenkins, or create the getTimeStamp function in a shared library.

On Wed, May 9, 2018 at 9:46 AM niristotle okram <[email protected]>
wrote:

> i am getting a failure calling the below function in a pipeline
>
>     def getTimeStamp(str) {
>        d = new Date(str).toTimestamp();
>        return d
>     }
>
>
> Exception Caught: 
> org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts 
> not permitted to use staticMethod 
> org.codehaus.groovy.runtime.SqlGroovyMethods toTimestamp java.util.Date
>
>
>
> If i unchecked the "groovy sandbox" and paste the pipeline - it WORKS
> while if i checkout the jenkinsfile from the repo, the same error comes
> back. Is there a way where i can disable "sandbox" while retrieving the
> pi[eline script from a git repo?
>
> Note: the method doesnt show up for approval too
>
>
>
> --
> Regards
> nirish okram
>
> --
> 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/CAPzcO4gxDR0idMzm8n9Y0W-5OoK4s7tty_uNGDzeQLvAija_wQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-users/CAPzcO4gxDR0idMzm8n9Y0W-5OoK4s7tty_uNGDzeQLvAija_wQ%40mail.gmail.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/CAPiUgVe%2BaU-HUcHvys2Oy-rwUQnqbr8AdxAKjk7joySX3zJTNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
  • [no subject] niristotle okram
    • Re: Slide
      • Re: niristotle okram
        • Re: Victor Martinez
          • Re: niristotle okram
            • Re: Victor Martinez
              • Re: niristotle okram

Reply via email to