gCubeBuilder/Jenkinsfile_withFunctions

58 lines
1.2 KiB
Plaintext

import groovy.json.JsonSlurper
//locate where this jenkinsfile is
String releaseURL = "https://code-repo.d4science.org/gCubeCI/gCubeRelease/raw/branch/feature/17273/releases/gcube-4.14.5.json"
//check and parse the release file
println "Querying ${releaseURL}"
def text = releaseURL.toURL().getText()
echo text
def jsonText = readJSON text:text
print(jsonText)
def object = new JsonSlurper().parseText '''
{
"gCube.version": "4.14.5",
"Components": {
"SmartGear": [
"maven-parent",
"gcube-bom",
"maven-smartgears-bom",
"authorization-client",
"gxRest"
],
"Enabling": [
"information-system-bom",
"information-system-model",
"resource-registry-api",
"resource-registry-client"
],
"Data": [
""
]
}
}'''
echo "gcube v. ${object['gCube.version']}"
pipeline {
agent any
stages {
stage('build') {
steps {
buildComponents items: ("a".."f").collect { "Stage ${it}" }
}
}
stage('build2') {
steps {
buildComponents items: ("g".."p").collect { "Stage ${it}" }
}
}
}
}
def buildComponents(args) {
parallel args.items.collectEntries { name -> [ "${name}": {
stage("${name}") {
echo name
}
}]}
}