Jenkins Pipeline 流水线 – 上传文件 Publish over SSH 执行命令
Jenkins插件安装
- Publish over SSH
系统配置
生成代码
sshPublisher: Send build artifacts over SSH
需要在 生成 sshPublisher 代码时选择:Verbose output in console,否则不会打印远程服务上的日志
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' } } }}
打印远程日志
Publish Over SSH 插件打印远程ssh的日志,需要在 生成 sshPublisher 代码时选择:Verbose output in console