gCubeBuilder/Jenkinsfile_yaml

46 lines
1.4 KiB
Plaintext

import org.yaml.snakeyaml.Yaml
//locate where this jenkinsfile is
String releaseURL = "https://code-repo.d4science.org/gCubeCI/gCubeRelease/raw/branch/feature/17273/releases/gcube-4.14.5.yaml"
//check and parse the release file
println "Querying ${releaseURL}"
def text = releaseURL.toURL().getText()
//parsing
def jsonConfig = new Yaml().load(text)
println jsonConfig.inspect()
echo "gCube v. ${jsonConfig.gCube_release.Version}"
echo "Found components:"
jsonConfig.gCube_release.Components.each{println it.key}
pipeline {
// see https://jenkins.io/doc/book/pipeline/syntax/#agent
agent {
label 'pipeline-agent'
}
//see https://jenkins.io/doc/book/pipeline/syntax/#stages
stages {
stage('build SmartGears components') {
steps {
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}": {
build name
}]}
}