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
|
// parse the report and extract the data
|
||||||
// def components = getComponentsFromCSV(deployList)
|
// def components = getComponentsFromCSV(deployList)
|
||||||
println "Going to check the deploy file in ${DEPLOY_FILE_ROOT_FOLDER}"
|
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) {
|
if (components.size() > 0) {
|
||||||
def componentSet=components.toSet();
|
def componentSet=components.toSet();
|
||||||
for (component in componentSet) {
|
for (component in componentSet) {
|
||||||
|
@ -320,3 +320,34 @@ def getComponentsFromCSVDir(def dirPath){
|
||||||
}
|
}
|
||||||
return components
|
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