add method for extracting components from a cdv folder

This commit is contained in:
Roberto Cirillo 2022-08-03 17:32:20 +02:00
parent f6b9b58930
commit 2485ec13c8
1 changed files with 32 additions and 4 deletions

30
Jenkinsfile vendored
View File

@ -1,5 +1,5 @@
#!groovy
import groovy.io.FileType
/**
* Deploy components to the D4Science Infrastructure (dev-only)
*
@ -119,11 +119,14 @@ pipeline {
}
stage('Nothing to do ') {
when{
anyOf{
allOf{
triggeredBy 'TimerTrigger'
environment name: 'IS_CRON', value: 'False'
}
}
}
steps {
echo 'Do Nothing: cron build disabled'
}
@ -283,3 +286,28 @@ def cleanup(def DEPLOY_FILE, def BACKUP_FILE){
fi
'''
}
#experimental test
def getComponentsFromCSVDir(def dirPath){
File folder = new File(dirPath)
folder.eachFileRecurse FileType.FILES, { file ->
// do nothing if the file ends with a .txt extension
if (file.name.endsWith(".csv")) {
println "Processing file ${file.absolutePath}"
readFile(file).split('\n').each { line, count->
if (line.startsWith('#'))
return
def fields = line.split(',')
components.add([
name : fields[0],
version : fields[1],
host : fields[2]
]
)
}
}
}
return components
}