Skip to content

Instantly share code, notes, and snippets.

@phgeraldeli
Created January 8, 2021 13:47
Show Gist options
  • Save phgeraldeli/44ecce47c576119266ca61abc3d4a365 to your computer and use it in GitHub Desktop.
Save phgeraldeli/44ecce47c576119266ca61abc3d4a365 to your computer and use it in GitHub Desktop.
Jenkins credentials discover
// Execute in jenkins script console
String saida = new ProcessBuilder( 'sh', '-c','''
grep -A4 CredentialName credentials.xml | tail -1 | cut -d'>' -f2 | cut -d'<' -f1
''').redirectErrorStream(true).start().text
saida = saida.replaceAll('\\s','')
println( saida )
println( hudson.util.Secret.decrypt(saida) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment