diff --git a/Jenkinsfile b/Jenkinsfile index 35aaed4..9d3879f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,23 @@ // related jenkins job: https://jenkins.d4science.org/job/gCubeDeployer/ def agent_root_folder = '/var/lib/jenkins/.m2' +def agent_deploy_filename = 'deploy.csv' +def deployList +if (params.deployFile) { + println "Using custom deploy file" + deployList = params.deployFile +} else { + println "Using local deploy file" + //load the report from the URL + deployList = agent_root_folder+'/'+agent_deploy_filename; +} +// parse the report and extract the data +def components = parseDeployComponent(deployList) +assert 0 < components.size(): "No component found" +for (component in components) { + println "$component" +} pipeline { agent { @@ -126,3 +142,18 @@ pipeline { } } +//a non CPS method is necessary for the usage of splitEachLine() +@NonCPS +def parseDeployComponent(def deployList) { + def components = [] + "${deployList}".splitEachLine(',') { columns -> + if (columns[0].startsWith('#') || columns[0].startsWith('Components')) + return + components.add([ + name : columns[1], + version : columns[2], + ] + ) + } + return components +}