title: Jenkins Publish Over SSh pipeline parameterized
body: <p>I am using Publish over SSH plugin in Jenkins to deploy the jar file which is created from the build process. I have created a pipeline like this</p>
  <pre><code>node {
   {
          stage('Checkout') {
              git([url: '.............', branch: 'myBranch', credentialsId: 'mycredentials'])
          }
          stage('Build') {
              script{
                  sh 'chmod a+x mvnw'
                  sh './mvnw clean package'
              }
          }
          stage('Deploy to Server'){
              def pom = readMavenPom file: 'pom.xml'
              script {
                  sshPublisher(publishers: [sshPublisherDesc(configName: 'server-instance1',
                          transfers: [sshTransfer(cleanRemote:true,
                                  sourceFiles: &quot;target/${env.PROJECT_NAME}-${pom.version}.jar&quot;,
                                  removePrefix: &quot;target&quot;,
                                  remoteDirectory: &quot;${env.PROJECT_NAME}&quot;,
                                  execCommand: &quot;mv ${env.PROJECT_NAME}/${env.PROJECT_NAME}-${pom.version}.jar ${env.PROJECT_NAME}/${env.PROJECT_NAME}.jar&quot;),
                                      sshTransfer(
                                              execCommand: &quot;/etc/init.d/${env.PROJECT_NAME} restart -Dspring.profiles.active=${PROFILE}&quot;
                                      )
                          ])
                  ])
              }
          }
      }
  }
  </code></pre>
  <p>This works. I have a SSH Server configured under Manage Jenkins &gt;&gt; Configure System &gt;&gt; Publish Over SSH.</p>
  <p>Now I want to deploy on multiple servers. Lets say I create multiple ssh configurations by name server-instance1, server-instance2. How do I make this Jenkins job parameterized ? I tried with checking the checkbox and selecting a Choice Parameter. But I am not able to figure out how to make the values for this dropdown come from the SSH server list(instead of hardcoding)</p>
  <p>I tried few things as mentioned here(<a href="https://stackoverflow.com/questions/13411489/how-to-control-parametrized-publishing-in-jenkins-using-publish-over-ssh-plugin">How to Control Parametrized publishing in Jenkins using Publish over SSH plugin&#39;s Label field</a>). Unfortunately none of the articles talks about doing this from a pipeline.</p>
  <p>Any help is much appreciated.</p>