Hello này mình mới được chỉ 1 chít để show các password trên jenkin.
Kiểu như bạn quên mật khẩu và muốn lấy lại.
Link tham khảo:
https://devops.stackexchange.com/questions/2191/how-to-decrypt-jenkins-passwords-from-credentials-xml
println(hudson.util.Secret.decrypt("<input_secret>"))
println(hudson.util.Secret.decrypt("{AQAAABAAAAAgrSaR/992HtLIyDGgQAjZit6VCvvGlh6yQfPZPS7dpg6vPxy7VnITt/yXDtQF5MYG}"))
Ý hà mình được chỉ 1 script bạn chỉ cần dán vào console là được
import java.nio.charset.StandardCharsets; def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials( com.cloudbees.plugins.credentials.Credentials.class ) for (c in creds) { println(c.id) if (c.properties.description) { println(" description: " + c.description) } if (c.properties.username) { println(" username: " + c.username) } if (c.properties.password) { println(" password: " + c.password) } if (c.properties.passphrase) { println(" passphrase: " + c.passphrase) } if (c.properties.secret) { println(" secret: " + c.secret) } if (c.properties.secretBytes) { println(" secretBytes: ") println("\n" + new String(c.secretBytes.getPlainData(), StandardCharsets.UTF_8)) println("") } if (c.properties.privateKeySource) { println(" privateKey: " + c.getPrivateKey()) } if (c.properties.apiToken) { println(" apiToken: " + c.apiToken) } if (c.properties.token) { println(" token: " + c.token) } println("") }
Reference Link:
https://stackoverflow.com/questions/34795050/how-do-i-list-all-of-my-jenkins-credentials-in-the-script-console
There’s certainly a lot to know about this issue.
I really like all the points you have made.