generated from gCubeCI/Pipeline-Docker-Template
add empty folder check
This commit is contained in:
parent
9ac38b137e
commit
c87343479e
|
@ -291,27 +291,29 @@ def cleanup(def DEPLOY_FILE, def BACKUP_FILE){
|
|||
//experimental test
|
||||
|
||||
def getComponentsFromCSVDir(def dirPath){
|
||||
File folder = new File(dirPath)
|
||||
println "folder ready "
|
||||
folder.eachFileRecurse FileType.FILES, { file ->
|
||||
// check it if the file ends with a .csv extension
|
||||
if (file.name.endsWith(".csv")) {
|
||||
println "Processing file "
|
||||
readFile(file).split('\n').each { line, count->
|
||||
if (line.startsWith('#'))
|
||||
return
|
||||
def fields = line.split(',')
|
||||
components.add([
|
||||
name : fields[0],
|
||||
version : fields[1],
|
||||
host : fields[2]
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
println "removing current deploy file"
|
||||
// remove the file here if possible
|
||||
// file.delete();
|
||||
}
|
||||
return components
|
||||
File folder = new File(dirPath)
|
||||
println "folder ready "
|
||||
if (folder){
|
||||
folder.eachFileRecurse FileType.FILES, { file ->
|
||||
// check it if the file ends with a .csv extension
|
||||
if (file.name.endsWith(".csv")) {
|
||||
println "Processing file "
|
||||
readFile(file).split('\n').each { line, count->
|
||||
if (line.startsWith('#'))
|
||||
return
|
||||
def fields = line.split(',')
|
||||
components.add([
|
||||
name : fields[0],
|
||||
version : fields[1],
|
||||
host : fields[2]
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
println "removing current deploy file: "+file.name
|
||||
// remove the file here if possible
|
||||
// file.delete();
|
||||
}
|
||||
}
|
||||
return components
|
||||
}
|
Loading…
Reference in New Issue