fixing parsing function

This commit is contained in:
Roberto Cirillo 2022-04-26 16:53:55 +02:00
parent d4b7687246
commit b7d8d91403
1 changed files with 18 additions and 9 deletions

27
Jenkinsfile vendored
View File

@ -16,11 +16,10 @@ if (params.deployFile) {
println "Using custom deploy file" println "Using custom deploy file"
deployList = params.deployFile deployList = params.deployFile
} else { } else {
println "Using local deploy file" String reportURL = "https://code-repo.d4science.org/gCubeCI/gCubeReleases/raw/branch/master/closed/5.5.0/build_commits.1069.csv"
//load the report from local println "Pulling the report from Git at ${reportURL}"
deployList = agent_root_folder+'/'+agent_deploy_filename; //load the report from the URL
println "Load from local file ${deployList}" text = reportURL.toURL().getText()}
}
// parse the report and extract the data // parse the report and extract the data
def components = parseDeployComponent(deployList) def components = parseDeployComponent(deployList)
assert 0 < components.size(): "No component found" assert 0 < components.size(): "No component found"
@ -145,8 +144,18 @@ pipeline {
//a non CPS method is necessary for the usage of splitEachLine() //a non CPS method is necessary for the usage of splitEachLine()
@NonCPS @NonCPS
def parseDeployComponent(def deployList) { def parseBuildCommits(def text) {
println "Going to parsing file ${deployList}" def components = []
String deploy= new File("${deployList}").text "${text}".splitEachLine(',') { columns ->
println "deploying: ${deploy}" if (columns[0].startsWith('#') || columns[0].startsWith('GroupID'))
return
components.add([
name : columns[1],
version : columns[2],
gitRepo : columns[3],
commitID: columns[4]
]
)
}
return components
} }