<p>Could <a href="https://www.jenkins.io/doc/pipeline/steps/credentials-binding/" rel="nofollow noreferrer">credentials binding plugin</a> be the answer?</p>
<p>The idea is to add svn user and password to Jenkins credentials store and then use it in the pipeline.</p>
<pre><code>withCredentials([
    usernamePassword(
        credentialsId: 'mySvnLogin',
        usernameVariable: 'USER',
        passwordVariable: 'PASSWORD')]) {
    sh '''
      svn ls &lt;url&gt; --non-interactive --no-auth-cache --trust-server-cert --username $USER 
 --password $PASSWORD
    ''''
</code></pre>

CC BY-SA 4.0
2020-06-22T01:22:26.673Z
Active Choice parameters use Groovy scripts which are not part of Pipeline code.  `withCredentials` is a Pipeline step and is therefore unavailable in the Groovy scripts for Active Choice parameters.
jayhendren
CC BY-SA 4.0
2020-06-23T12:19:36.427Z
Code and everything was correct. Only thing is I was not having correct password in Password parameter, hence expected result was not returned.
Alpha
CC BY-SA 4.0
2020-06-21T19:24:34.310Z
2020-06-21T19:24:34.310Z
clorz
<p>In Jenkins pipeline parameter say <code>Branches</code> of type <code>Active Choice Reactive Parameter</code>, I've to auto-populate branch names hence I've following command, which I can execute in parameter's Groovy script -</p>
<pre><code>svn ls &lt;url&gt; --non-interactive --no-auth-cache --trust-server-cert --username &lt;username&gt;--password &lt;password&gt;
</code></pre>
<p><code>username</code> can be retrieved using <code>User.current().getId()</code></p>
<p>I've <code>Password</code> parameter of <code>Password Parameter</code> type. To use value of this parameter in Groovy script of <code>Branches</code>, I've added <code>Password</code> parameter in <code>Referenced parameters</code> of <code>Branches</code></p>
<p>But I cannot see its value reflected in <code>Branches</code> parameter. Can you please suggest how this can be handled?</p>
<p>Or any other way to pass Password value or authentication details so I can execute svn command.</p>

CC BY-SA 4.0
2020-06-23T12:19:26.330Z
Code and everything was correct. Only thing is I was not having correct password in Password parameter, hence expected result was not returned.
Alpha
<jenkins><jenkins-pipeline>
Unable to get value of password parameter into another parameter
Alpha
# Unable to get value of password parameter into another parameter

(Asked by: username_0 on 2020-06-21)

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  --non-interactive --no-auth-cache --trust-server-cert --username --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.

**Tags:** jenkins, jenkins-pipeline

> **Comments:**
> **username_0**: Code and everything was correct. Only thing is I was not having correct password in Password parameter, hence expected result was not returned.  

---

## 1 answers

### Answer by username_1 on 2020-06-21. Score: -1

Could credentials binding plugin be the answer?
The idea is to add svn user and password to Jenkins credentials store and then use it in the pipeline.
withCredentials([
    usernamePassword(
        credentialsId: 'mySvnLogin',
        usernameVariable: 'USER',
        passwordVariable: 'PASSWORD')]) {
    sh '''
      svn ls  --non-interactive --no-auth-cache --trust-server-cert --username $USER 
 --password $PASSWORD
    ''''

> **Comments:**
> **username_2**: Active Choice parameters use Groovy scripts which are not part of Pipeline code.  `withCredentials` is a Pipeline step and is therefore unavailable in the Groovy scripts for Active Choice parameters.  
> **username_0**: Code and everything was correct. Only thing is I was not having correct password in Password parameter, hence expected result was not returned.  

---

