From 3c928cd070fcd9e27979c01fe2a1c13e9b25ba75 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Thu, 29 Sep 2022 17:08:00 +0200 Subject: [PATCH] add script function --- Jenkinsfile | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8ffdb1d..6a371b5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -105,7 +105,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("${WORKSPACE}/CD") + def components =getComponentsFromCSVDir4("${WORKSPACE}/CD") if (components.size() > 0) { def componentSet=components.toSet(); for (component in componentSet) { @@ -381,6 +381,24 @@ def getComponentsFromCSVDir3(def dirPath){ // } } +def getComponentsFromCSVDir4(def dirPath){ + sh ''' + echo "parsing $dirPath"; + for entry in `ls $dirPath`; do + INPUT=$entry + OLDIFS=$IFS + IFS=',' + [ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; } + while read componentname version + do + echo "Name : $componentname" + echo "DOB : $version" + done < $INPUT + IFS=$OLDIFS + done + ''' +} +