首页 > 其他分享 >Jenkins Pipeline 流水线 - 上传文件 Publish over SSH 执行命令

Jenkins Pipeline 流水线 - 上传文件 Publish over SSH 执行命令

时间:2022-11-02 14:37:37浏览次数:55  
标签:Pipeline false over Publish SSH Jenkins sshPublisher

Jenkins Pipeline 流水线 - 上传文件 Publish over SSH 执行命令

Jenkins插件安装

  • Publish over SSH

系统配置

image
image
image

生成代码

sshPublisher: Send build artifacts over SSH
需要在 生成 sshPublisher 代码时选择:Verbose output in console,否则不会打印远程服务上的日志
image
image
image

pipeline {
    agent any
 
    stages {  
        stage('上传文件') { 
            steps {
                sshPublisher(publishers: [sshPublisherDesc(configName: 'DockerPublishSSH', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'docker --version', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: 'PipelineDemo', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '**/demojenkins*.jar')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
                echo 'Credentials SUCCESS'
            }
        } 
    }
}

image
image

打印远程日志

Publish Over SSH 插件打印远程ssh的日志,需要在 生成 sshPublisher 代码时选择:Verbose output in console
image
image

标签:Pipeline,false,over,Publish,SSH,Jenkins,sshPublisher
From: https://www.cnblogs.com/vipsoft/p/16850899.html

相关文章