jenkins配置ftp发布
来源:https://www.cnblogs.com/zz0412/p/jenkins_jj_04.html
来源:https://www.liujiajia.me/2020/3/26/jenkins-upload-to-ftp-server-with-pipeline
一、 GUI插件配置
系统设置
项目配置
Remote directory | Directories created |
---|---|
'qa-approved/'yyyyMMddHHmmss |
qa-approved/20101107154555 |
'builds/'yyyy/MM/dd/'build-${BUILD_NUMBER}' |
builds/2010/11/07/build-456 (if the build was number 456) |
yyyy_MM/'build'-EEE-d-HHmmss |
2010_11/build-Sun-7-154555 |
yyyy-MM-dd_HH-mm-ss |
2010-11-07_15-45-55 |
二、 Pipeline 脚本发布
1. 安装 Publish Over FTP 插件
2. 配置 FTP Server
3. Pipeline 脚本
masterNodeName 和 paramPublish 参数是必须的,自动生成的脚本中不知道为什么不含这两个参数;
publishers → configName 值为第二步中设置的 FTP Server Name;
remoteDirectory 指定上传的远端目录
sourceFiles 指定需要上传的文件
removePrefix 设置为需要过滤掉的文件前缀
下面的示例中会自动将 OctopusSoa/OctopusApi/target/ 目录下的所有文件上传到 FTP 服务器的 server 目录下。
如果 removePrefix 为空,则会上传到 server/OctopusSoa/OctopusApi/target/ 目录下。
stage('Upload') {
steps {
ftpPublisher alwaysPublishFromMaster: false,
continueOnError: false,
failOnError: false,
masterNodeName: '',
paramPublish: null,
publishers: [[
configName: 'SOA-D',
transfers: [[
asciiMode: false,
cleanRemote: false,
excludes: '',
flatten: false,
makeEmptyDirs: false,
noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: 'server',
remoteDirectorySDF: false,
removePrefix: 'OctopusSoa/OctopusApi/target',
sourceFiles: 'OctopusSoa/OctopusApi/target/*.jar'
]],
usePromotionTimestamp: false,
useWorkspaceInPromotion: false,
verbose: false
]]
}
}
‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧ END ‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧
评论