Unable to get value of password parameter into another parameter

20 views
Skip to first unread message

Gajanan Mahajan

unread,
Jun 21, 2020, 11:17:30 PM6/21/20
to Jenkins Users
In Jenkins pipeline parameter say `Branches` of type `Active Choice Reactive Parameter`, I've to auto-populate branch names hence I've following command, which I can execute in parameter's Groovy script -

    svn ls <url> --non-interactive --no-auth-cache --trust-server-cert --username <username>--password <password>

`username` can be retrieved using `User.current().getId()`

I've `Password` parameter of `Password Parameter` type. To use value of this parameter in Groovy script of `Branches`, I've added `Password` parameter in `Referenced parameters` of `Branches` 

But I cannot see its value reflected in `Branches` parameter. Can you please suggest how this can be handled?

Or any other way to pass Password value or authentication details so I can execute svn command.

Jérôme Godbout

unread,
Jun 22, 2020, 8:54:44 AM6/22/20
to jenkins...@googlegroups.com

You should use the credtentials,

 

withCredentials() {

}

 

Add the credentials to you Jenkins config then use the command above, it will also prevent the print output of the password into the log and change it for *****.

 

https://www.jenkins.io/doc/pipeline/steps/credentials-binding/

https://www.jenkins.io/doc/book/using/using-credentials/

 

 


une compagnie 

RAPPROCHEZ LA DISTANCE

Jérôme Godbout
Développeur Logiciel Sénior / 
Senior Software Developer

p: +1 (418) 800-1073 ext.:109

amotus.ca
statum-iot.com

   

COVID-19 : we are glad to inform you that Amotus are up and running with limited impact on our performance. We will keep you informed of any changes as they occur.

COVID-19 : nous sommes fiers d’informer nos collaborateurs que Amotus opèrent adéquatement et que l’impact sur notre productivité est minimisé. Nous vous tiendrons au courant de tout changement.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f212facd-7252-4722-97ec-e773761a9bf7o%40googlegroups.com.

Martin Schmude

unread,
Jul 2, 2020, 5:14:33 AM7/2/20
to Jenkins Users
Jerome: can withCredentials() be used in the script of a job parameter of type 'Active Choice Reactive Parameter'?

Gajanan: there is a job parameter type 'List Subversion tags (and more)'.
May be this satifies your needs. You will have to setup a credential (name+password) in the Jenkins credentials store. Then you can pass the ID of that credential to the job parameter, so that the parameter will be able to access your SVN.
Reply all
Reply to author
Forward
0 new messages