diff --git a/Jenkinsfile b/Jenkinsfile index 48719ad..4eaf80a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,11 @@ import groovy.json.JsonSlurper +//check and parse the release file def inputFile = new File(".\releases\gcube-${params.gCube_release_number}.json") +assert inputFile.exists() : "Release file not found (expected gcube-${params.gCube_release_number}.json)" +assert inputFile.canRead() : "Release file cannot be read" def gcubeJSON = new JsonSlurper().parseText(inputFile) + //check that the release number parameter is the one expected assert gcubeJSON["gCube.version"] == params.gCube_release_number : "Release versions do not match!" @@ -47,13 +51,13 @@ echo "Use settings file at ${maven_settings_file}" echo "Use local repo at ${maven_local_repo_path}" echo "Release number: ${params.gCube_release_number}" -def apps = gcubeJSON['Components'] +def components = gcubeJSON['Components'] def dynamicStages = [:] //let's build the stages closures -apps.each { entry -> echo "App name: $entry.key = Jobs: $entry.value" } -apps.each { entry -> +components.each { entry -> echo "App name: $entry.key = Jobs: $entry.value" } +components.each { entry -> def app = entry.key dynamicStages["stage-${app}"] = ["${app}":{ node {