The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

SSH Pipeline Steps

sshCommand: SSH Steps: sshCommand - Execute command on remote node.

Takes a remote (map) of settings and command to execute it on the remote node and returns output. See docs on the README for more information.

    def remote = [:]
    remote.name = 'test'
    remote.host = 'test.domain.com'
    remote.user = 'root'
    remote.password = 'password'
    remote.allowAnyHosts = true
    stage('Remote SSH') {
      sshCommand remote: remote, command: "ls -lrt"
      sshCommand remote: remote, command: "for i in {1..5}; do echo -n \"Loop \$i \"; date ; sleep 1; done"
    }
  
  • command : String
  • dryRun : boolean (optional)
  • failOnError : boolean (optional)
  • remote (optional)
      Nested Choice of Objects
  • sudo : boolean (optional)

sshGet: SSH Steps: sshGet - Get a file/directory from remote node.

Takes a remote (map) of settings, local file/directory into to get the given file/directory from remote node. See docs on the README for more information.

    def remote = [:]
    remote.name = 'test'
    remote.host = 'test.domain.com'
    remote.user = 'root'
    remote.password = 'password'
    remote.allowAnyHosts = true
    stage('Remote SSH') {
      sshGet remote: remote, from: 'abc.sh', into: 'abc_get.sh', override: true
    }
  
  • from : String
  • into : String
  • dryRun : boolean (optional)
  • failOnError : boolean (optional)
  • filterBy : String (optional)
  • filterRegex : String (optional)
  • override : boolean (optional)
  • remote (optional)
      Nested Choice of Objects

sshPut: SSH Steps: sshPut - Put a file/directory on remote node.

Takes a remote (map) of settings, local file/directory from workspace and path to put this into remote node. See docs on the README for more information.

    def remote = [:]
    remote.name = 'test'
    remote.host = 'test.domain.com'
    remote.user = 'root'
    remote.password = 'password'
    remote.allowAnyHosts = true
    stage('Remote SSH') {
      writeFile file: 'abc.sh', text: 'ls -lrt'
      sshPut remote: remote, from: 'abc.sh', into: '.'
    }
  
  • from : String
  • into : String
  • dryRun : boolean (optional)
  • failOnError : boolean (optional)
  • filterBy : String (optional)
  • filterRegex : String (optional)
  • remote (optional)
      Nested Choice of Objects

sshRemove: SSH Steps: sshRemove - Remove a file/directory from remote node.

Takes a remote (map) of settings and path (file/directory) to remove from remote node. See docs on the README for more information.

    def remote = [:]
    remote.name = 'test'
    remote.host = 'test.domain.com'
    remote.user = 'root'
    remote.password = 'password'
    remote.allowAnyHosts = true
    stage('Remote SSH') {
      sshRemove remote: remote, path: "abc.sh"
    }
  
  • path : String
  • dryRun : boolean (optional)
  • failOnError : boolean (optional)
  • remote (optional)
      Nested Choice of Objects

sshScript: SSH Steps: sshScript - Execute script(file) on remote node.

Takes a remote (map) of settings and script a shell script file to execute it on the remote node and returns output. See docs on the README for more information.

    def remote = [:]
    remote.name = 'test'
    remote.host = 'test.domain.com'
    remote.user = 'root'
    remote.password = 'password'
    remote.allowAnyHosts = true
    stage('Remote SSH') {
      writeFile file: 'abc.sh', text: 'ls -lrt'
      sshScript remote: remote, script: "abc.sh"
    }
  
  • script : String
  • dryRun : boolean (optional)
  • failOnError : boolean (optional)
  • remote (optional)
      Nested Choice of Objects

反馈修改意见?

如果对此页的内容有修改意见,请通过下面的快速表格 快速表单反馈.

或者,你不想填表单,只需填写你要反馈的内容

    


看已有的反馈 这里.