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