Unable to get value of password parameter into another parameter

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to get value of password parameter into another parameter

Gajanan Mahajan
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.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f212facd-7252-4722-97ec-e773761a9bf7o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

RE: Unable to get value of password parameter into another parameter

Jérôme Godbout

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.

 

From: [hidden email] <[hidden email]> On Behalf Of Gajanan Mahajan
Sent: June 21, 2020 11:18 PM
To: Jenkins Users <[hidden email]>
Subject: Unable to get value of password parameter into another parameter

 

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.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f212facd-7252-4722-97ec-e773761a9bf7o%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YQBPR0101MB1074EA33D79EAA188D589B0CCD970%40YQBPR0101MB1074.CANPRD01.PROD.OUTLOOK.COM.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to get value of password parameter into another parameter

Martin Schmude-2
In reply to this post by Gajanan Mahajan
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.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7e0280ff-1a9b-4dc4-b33a-871a942b4ffdo%40googlegroups.com.