add script function

This commit is contained in:
Roberto Cirillo 2022-09-29 17:08:00 +02:00
parent f48fbfc448
commit 3c928cd070
1 changed files with 19 additions and 1 deletions

20
Jenkinsfile vendored
View File

@ -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
'''
}