I've been looking into this as well and made a little progress by digging 
around https://github.com/jenkinsci/credentials-plugin

For store, I used "system::system::jenkins" like in their tests.  For 
domain I tried variations on the word "global" but none worked.  I then 
tried underscore '_' as a wild guess and that worked.  I tried that because 
it's in the url when you hover on (global) on the credentials page.

Anyway, I haven't tried creating creds yet, but I can at least get them 
like:

java -jar /usr/share/jenkins/jenkins-cli.jar -s http://localhost:8080 -i 
~jenkins/.ssh/id_rsa list-credentials system::system::jenkins

and

java -jar /usr/share/jenkins/jenkins-cli.jar -s http://localhost:8080 -i 
~jenkins/.ssh/id_rsa get-credentials-as-xml system::system::jenkins _ 
somecredname

(note that I require auth hence the -i. This might not be relevant in your 
case)

Hope this helps some.

On Saturday, August 6, 2016 at 12:32:22 AM UTC-7, Vishwanath V wrote:
>
> Hi all,
>
> I need to *automatedly* load sets of credentials to a Jenkins instance, 
> so that my jobs can pick up these credentials. 
>
> For this purpose I am using the Jenkins CLI, specifically the set of 
> commands provided by the Credentials Provider plugin:
>
>   create-credentials-by-xml
>     Create Credential by XML
>   create-credentials-domain-by-xml
>     Create Credentials Domain by XML
>   get-credentials-as-xml
>     Get a Credentials as XML (secrets redacted)
>   get-credentials-domain-as-xml
>     Get a Credentials Domain as XML
>   list-credentials
>     Lists the Credentials in a specific Store
>   list-credentials-context-resolvers
>     List Credentials Context Resolvers
>   list-credentials-providers
>     List Credentials Providers
>    update-credentials-by-xml
>     Update Credentials by XML
>   update-credentials-domain-by-xml
>     Update Credentials Domain by XML
>
> I am trying to understand how to use them, but there is literally no 
> documentation on this beyond the actual code (which I unfortunately am 
> unable to understand). 
>
> *Question 1. What is the "Store ID"?* 
>
> Based on the error messages, I understand it is 
> list-credentials [Store ID]
>
> I am unable to understand what the Store ID is. Another error message says 
> it should be in the format Provider::Resolver::ContextPath.
> But where would I get this information from?
>
> *Question 2: How do I load an XML for "create-credentials-by-xml"?*
>
> When I use the create-credentials-by-xml, I assume I need to provide an 
> XML file. How do I provide this ? i.e would it be as follows
> create-credentials-by-xml [Store ID] [Path to XML]
> ??
>
>

-- 
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/a3137f6b-9753-455d-871b-6e564bf9452f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to