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
println "Querying ${releaseURL}"
def text = releaseURL.toURL().getText()
echo text
//parsing
def jsonConfig = new Yaml().load(text)
println jsonConfig.inspect()
echo "gCube v. ${jsonConfig.gCube_release.Version}"
echo "components:"
echo "Found components:"
jsonConfig.gCube_release.Components.each{println it.key}
pipeline {
agent any
stages {
stage('build') {
steps {
buildComponents items: ("a".."f").collect { "Stage ${it}" }
}
// see https://jenkins.io/doc/book/pipeline/syntax/#agent
agent {
label 'pipeline-agent'
}
stage('build2') {
//see https://jenkins.io/doc/book/pipeline/syntax/#stages
stages {
stage('build SmartGears components') {
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) {
parallel args.items.collectEntries { name -> [ "${name}": {
stage("${name}") {
echo name
}
build name
}]}
}