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

36
Jenkinsfile vendored
View File

@ -1,5 +1,5 @@
#!groovy
import groovy.io.FileType
/**
* Deploy components to the D4Science Infrastructure (dev-only)
*
@ -119,10 +119,13 @@ pipeline {
}
stage('Nothing to do ') {
when{
allOf{
triggeredBy 'TimerTrigger'
environment name: 'IS_CRON', value: 'False'
anyOf{
allOf{
triggeredBy 'TimerTrigger'
environment name: 'IS_CRON', value: 'False'
}
}
}
steps {
echo 'Do Nothing: cron build disabled'
@ -282,4 +285,29 @@ def cleanup(def DEPLOY_FILE, def BACKUP_FILE){
echo "deploy file empty"
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
}