diff --git a/Jenkinsfile b/Jenkinsfile index 96bb4fc..64f1295 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 -} \ No newline at end of file +} + +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 +} + + +