Early working version of YAML-based pipeline.

This commit is contained in:
Manuele Simi 2019-09-02 23:38:06 -04:00
parent 9758e483fa
commit 20750b77a3
1 changed files with 21 additions and 15 deletions

View File

@ -5,36 +5,42 @@ String releaseURL = "https://code-repo.d4science.org/gCubeCI/gCubeRelease/raw/br
//check and parse the release file //check and parse the release file
println "Querying ${releaseURL}" println "Querying ${releaseURL}"
def text = releaseURL.toURL().getText() def text = releaseURL.toURL().getText()
echo text
//parsing //parsing
def jsonConfig = new Yaml().load(text) def jsonConfig = new Yaml().load(text)
println jsonConfig.inspect() println jsonConfig.inspect()
echo "gCube v. ${jsonConfig.gCube_release.Version}" echo "gCube v. ${jsonConfig.gCube_release.Version}"
echo "Found components:"
echo "components:"
jsonConfig.gCube_release.Components.each{println it.key} jsonConfig.gCube_release.Components.each{println it.key}
pipeline { pipeline {
agent any // see https://jenkins.io/doc/book/pipeline/syntax/#agent
stages { agent {
stage('build') { label 'pipeline-agent'
steps {
buildComponents items: ("a".."f").collect { "Stage ${it}" }
}
} }
stage('build2') {
//see https://jenkins.io/doc/book/pipeline/syntax/#stages
stages {
stage('build SmartGears components') {
steps { steps {
buildComponents items: ("g".."p").collect { "Stage ${it}" } buildComponents items: jsonConfig.gCube_release.Components.SmartGears.collect { "${it}" }
} }
} }
} stage('build Enabling components') {
steps {
buildComponents items: jsonConfig.gCube_release.Components.Enabling.collect { "${it}" }
}
}
stage('build Data components') {
steps {
buildComponents items: jsonConfig.gCube_release.Components.Data.collect { "${it}" }
}
}
}
} }
def buildComponents(args) { def buildComponents(args) {
parallel args.items.collectEntries { name -> [ "${name}": { parallel args.items.collectEntries { name -> [ "${name}": {
stage("${name}") { build name
echo name
}
}]} }]}
} }