def apps = "SmartGears,Enabling,Data".split(",").findAll { it }.collect { it.trim() } def jobs = "maven-parent,gcube-bom".split(",").findAll { it }.collect { it.trim() } def environment = env.ENVIRONMENT def version = env.VERSION def dynamicStages = [:] if (apps.size() < 1) { error("ERROR: APPLICATIONS must be a comma-delimited list of applications to build") } for (int i = 0; i < apps.size(); i++) { def app = apps[i] dynamicStages["stage-${app}"] = ["${app}":{ node { stage("Build ${app}") { for (int i2 = 0; i2 < jobs.size(); i2++) { build "${i2}" } } } }] } pipeline { agent none stages { stage('Build SmartGears components') { steps { script { parallel dynamicStages['stage-SmartGears'] } } } stage('Build enabling components') { steps { script { parallel dynamicStages['stage-Enabling'] } } } stage('Build data components') { steps { script { parallel dynamicStages['stage-Data'] } } } } }