Fix API breakage caused by OS Plugin version scan
[releng/global-jjb.git] / jenkins-admin / get_all_creds.groovy
1 /*****************
2 * Extracts all registered credentials and passwords
3 *
4 * Jenkins credentials are encrypted and passwords cannot be retrived easily.
5 * Run this script to get all credentials pairs in an "Id : Password" format.
6 * Note: This script will not display information for SSH and Certificate
7 * credential types.
8 *
9 *****************/
10
11 import com.cloudbees.plugins.credentials.*
12
13 println "Printing all the credentials and passwords..."
14 def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
15     com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.class,
16     Jenkins.instance,
17     null,
18     null
19 );
20
21 for (c in creds) {
22     try {
23         println(c.id + " : " + c.password )
24     } catch (MissingPropertyException) {}
25 }