From b7d8d91403cb4bd381bf3039708c19385c91608a Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 26 Apr 2022 16:53:55 +0200 Subject: [PATCH] fixing parsing function --- Jenkinsfile | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b0da628..9a8301b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 }