Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.cloudbees.plugins.credentials.*
- import com.cloudbees.plugins.credentials.common.*
- def credential_id = 'test'
- def id_matcher = CredentialsMatchers.withId(credential_id)
- def available_credentials = CredentialsProvider.lookupCredentials(StandardCredentials.class, Jenkins.getInstance(), null, null)
- String streamToSring(InputStream input) {
- Scanner s = new Scanner(input);
- StringBuilder builder = new StringBuilder();
- while (s.hasNextLine()) {
- builder.append(s.nextLine() +"\n");
- }
- return builder.toString();
- }
- println streamToSring(CredentialsMatchers.firstOrNull(available_credentials, id_matcher).getContent())
Add Comment
Please, Sign In to add comment