Add vars/deployViaFtp.groovy
This commit is contained in:
42
vars/deployViaFtp.groovy
Normal file
42
vars/deployViaFtp.groovy
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
def call(Map cfg = [:]) {
|
||||||
|
|
||||||
|
// -------- 参数校验 --------
|
||||||
|
if (!cfg.configName) {
|
||||||
|
error "deployViaFtp: configName is required"
|
||||||
|
}
|
||||||
|
if (!cfg.sourceFiles) {
|
||||||
|
error "deployViaFtp: sourceFiles is required"
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------- 默认值 --------
|
||||||
|
String removePrefix = cfg.get('removePrefix', '')
|
||||||
|
String remoteDirectory = cfg.get('remoteDirectory', '/')
|
||||||
|
boolean flatten = cfg.get('flatten', false)
|
||||||
|
boolean cleanRemote = cfg.get('cleanRemote', false)
|
||||||
|
boolean verbose = cfg.get('verbose', false)
|
||||||
|
|
||||||
|
// -------- FTP 发布 --------
|
||||||
|
ftpPublisher(
|
||||||
|
alwaysPublishFromMaster: false,
|
||||||
|
continueOnError: false,
|
||||||
|
failOnError: false,
|
||||||
|
masterNodeName: '',
|
||||||
|
paramPublish: null,
|
||||||
|
|
||||||
|
publishers: [[
|
||||||
|
configName: cfg.configName,
|
||||||
|
verbose: verbose,
|
||||||
|
|
||||||
|
transfers: [[
|
||||||
|
sourceFiles: cfg.sourceFiles,
|
||||||
|
removePrefix: removePrefix,
|
||||||
|
remoteDirectory: remoteDirectory,
|
||||||
|
flatten: flatten,
|
||||||
|
cleanRemote: cleanRemote,
|
||||||
|
makeEmptyDirs: false,
|
||||||
|
noDefaultExcludes: false,
|
||||||
|
patternSeparator: '[, ]+'
|
||||||
|
]]
|
||||||
|
]]
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user