Skip to content

Instantly share code, notes, and snippets.

@rubberduck203
Created August 8, 2018 01:29
Show Gist options
  • Save rubberduck203/604822a166249d761b0c28d0cceefc5b to your computer and use it in GitHub Desktop.
Save rubberduck203/604822a166249d761b0c28d0cceefc5b to your computer and use it in GitHub Desktop.
Decrypt Jenkins Secret
// Run in the Jenkins script console
// https://stackoverflow.com/questions/37683143/extract-passphrase-from-jenkins-credentials-xml
// file containing value without surrounding curly braces
File file = new File("/path/to/file.txt")
hudson.util.Secret.decrypt("{${file.text}}")
// file with value including curly braces
File file = new File("/path/to/file.txt")
hudson.util.Secret.decrypt(file.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment