generated from gCubeCI/Pipeline-Docker-Template
new test method for parsing the file
This commit is contained in:
parent
6ea001f0f6
commit
eec8436621
|
@ -99,7 +99,7 @@ pipeline {
|
|||
// parse the report and extract the data
|
||||
// def components = getComponentsFromCSV(deployList)
|
||||
println "Going to check the deploy file in ${DEPLOY_FILE_ROOT_FOLDER}"
|
||||
def components =getComponentsFromCSVDir("${DEPLOY_FILE_ROOT_FOLDER}")
|
||||
def components =getComponentsFromCSVDir2("${DEPLOY_FILE_ROOT_FOLDER}")
|
||||
if (components.size() > 0) {
|
||||
def componentSet=components.toSet();
|
||||
for (component in componentSet) {
|
||||
|
@ -319,4 +319,35 @@ def getComponentsFromCSVDir(def dirPath){
|
|||
}
|
||||
}
|
||||
return components
|
||||
}
|
||||
}
|
||||
|
||||
def getComponentsFromCSVDir2(def dirPath){
|
||||
File folder = new File(dirPath)
|
||||
println ("folder ready ");
|
||||
if (folder){
|
||||
println (" processing folder "+folder);
|
||||
folder.eachFileRecurse( FileType.FILES) {
|
||||
if (it.name.endsWith(".csv")) {
|
||||
println ("Processing file "+it);
|
||||
readFile(it).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: "+it.name);
|
||||
// remove the file here if possible
|
||||
// file.delete();
|
||||
}
|
||||
}
|
||||
return components
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue