The Active Choices Jenkins plugin (https://plugins.jenkins.io/uno-choice/) allows someone to write a groovy script to return some dynamic options.
My script is something like this:
static String getDockerHubToken(String username, String password) {
return ...;
}
static List getDockerHubTags(String jwtToken) {
return ...;
}
def token = getDockerHubToken('myusername', 'mypassword')
def tagNames = getDockerHubTags(token)
return tagNames
(The implementation follows the pattern in Jenkins: Active Choices Parameter + Groovy to build a list based on REST responde)
So the question is:
- How can I get the username and password into this script from Jenkins credentials (instead of hard-coding them into the script, as I did above)?
Thanks!
As M B wrote above, the way to do this is to:
At the end, my code is: