Hi,
Yes I was trying to write a new plugin. A simple one to add new credentials 
into the credentials.xml file programmatically. It was supposed to mimic 
the credentials plugin, like a subset of it.
I went through the SystemCredentialsProviderTest.java#L36 
<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fjenkinsci%2Fcredentials-plugin%2Fblob%2Fe4f1234fe1b3c35e322782d4d005df38de29d943%2Fsrc%2Ftest%2Fjava%2Fcom%2Fcloudbees%2Fplugins%2Fcredentials%2FSystemCredentialsProviderTest.java%23L36&sa=D&sntz=1&usg=AFQjCNEp-aLYpX4Q1-L0ytik-XiVmkF_Bg>
 and 
found exactly what i was looking for which is the following code snippet:

*SystemCredentialsProvider.getInstance().getCredentials().add(new 
UsernamePasswordCredentialsImpl(scope, id, description, name, passwd));*
 after this i used the 

*SystemCredentialsProvider.getInstance().save();*
and got the results i wanted.

This took in the credentials I wanted to add to the xml file and updated 
the same.
Thanks so much for the really quick and extremely helpful reply.

On Thursday, July 30, 2015 at 10:32:12 PM UTC+5:30, Jesse Glick wrote:
>
> On Thu, Jul 30, 2015 at 8:51 AM, Tanya Fernandez 
> <[email protected] <javascript:>> wrote: 
> > I have tried to create a plugin for implement this. This I based on the 
> > credentials plugin using the Jenkins CLI commands. 
>
> You mean, you are trying to implement 
> https://issues.jenkins-ci.org/browse/JENKINS-28407? I am not really 
> clear on what you are trying to accomplish. Write a new plugin? 
> Enhance an existing plugin? Run something from a particular server’s 
> script console? Something else? 
>
> For the simplest cases you can use something like: 
>
>
> https://github.com/jenkinsci/credentials-plugin/blob/e4f1234fe1b3c35e322782d4d005df38de29d943/src/test/java/com/cloudbees/plugins/credentials/SystemCredentialsProviderTest.java#L36
>  
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fjenkinsci%2Fcredentials-plugin%2Fblob%2Fe4f1234fe1b3c35e322782d4d005df38de29d943%2Fsrc%2Ftest%2Fjava%2Fcom%2Fcloudbees%2Fplugins%2Fcredentials%2FSystemCredentialsProviderTest.java%23L36&sa=D&sntz=1&usg=AFQjCNEp-aLYpX4Q1-L0ytik-XiVmkF_Bg>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" 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-dev/a16a3862-d7b9-4e15-a41b-75a04e48eb81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to