Add new option to pipeline - sshagent

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Would be nice to be able to define sshagent as an option for stage or global pipeline. Here are examples:

       

      // Global option
      pipeline {
        options {
          sshagent('credential-id')
        }
        stages {
          stage('ssh-deploy') {
            steps {
              sh 'ssh user@host command'
            }
          }
      }

       

      // option for single stage
      pipeline {
        stages {
          stage('ssh-deploy') {
            options {
              sshagent('credential-id')
            }
            steps {
              sh 'ssh user@host command'
            }
          }
        }
      }
      // option for single stage + docker
      pipeline {
       stages {
         stage('ssh-deploy') {
           agent {
             docker { image 'ubuntu:16.04' }
           }
           options {
             sshagent('credential-id')
           }
           steps {
             sh 'ssh user@host command'
           }
          }
        }
      }
      

       

       

            Assignee:
            Unassigned
            Reporter:
            Kamil Grabowski
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: