Wow that was really simple. I never noticed that before. 

For anyone as ignorant as me:
in Jenkins web ui
Manage Jenkins >
In-process Script Approval >
Approve the signature

It worked great. 
The only issue is that now, instead of the credentials displaying as ***, 
it is url encoded in plain text in the logs. 

Thanks for the quick reply and simple solution. 

On Thursday, October 27, 2016 at 10:24:17 AM UTC-4, Mark Waite wrote:
>
> 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] 
> <javascript:>> 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] <javascript:>.
>> 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/906c69a3-6654-4375-8848-268479e8e001%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to