36 lines
881 B
Plaintext
36 lines
881 B
Plaintext
|
def apps = "app1,app2,app3".split(",").findAll { it }.collect { it.trim() }
|
||
|
def jobs = "job1,job2,job3,job4,job5".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}"] = {
|
||
|
node {
|
||
|
stage("Build ${app}") {
|
||
|
for (int i2 = 0; i2 < jobs.size(); i2++) {
|
||
|
build "${i2}"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pipeline {
|
||
|
agent none
|
||
|
stages {
|
||
|
stage('Build apps(s)') {
|
||
|
steps {
|
||
|
script {
|
||
|
parallel dynamicStages
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|