The simplest solution is to approve that method for use in your Jenkins. Then you can use the URLEncoder class in Jenkinsfile on that instance.
Mark Waite On Thu, Oct 27, 2016 at 7:57 AM Daniel Collette <[email protected]> wrote: > Using multibranch pipeline plugin and credentials binding plugin and using > this method > <https://github.com/jenkinsci/pipeline-examples/blob/master/pipeline-examples/push-git-repo/pushGitRepo.Groovy> > to git tag, it is failing due to a character that requires url encoding in > the password. > > To push to a git repo, it's required to URL encode (for example @'s in the > username and password for "http://username:password@<gitrepo>" are not read > properly) > > > When i import java.net.URLEncoder and URLEncoder.encode(password) in the > groovy file i get this: > > org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts > not permitted to use staticMethod java.net.URLEncoder encode java.lang.String > > > So, the question is, is there a way to URL encode the password that is > idiomatic for Jenkinsfiles? > > I would like to avoid something dirty like piping the parameter into bash > and sed-ing the password to replace special characters if there is a > cleaner and more readable solution. > > -- > 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/b3b97111-84d4-4a4b-82fa-2f2d6eb97750%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/b3b97111-84d4-4a4b-82fa-2f2d6eb97750%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/CAO49JtGP5RThoSKSS6q9SX0cMcnSp-vCjVXu0WaHvuM2NpM5Cw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
