Created
November 7, 2018 15:02
-
-
Save garethahealy/f884c75a90d8b53170549479dbc0f7cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generateJinja2DashboardStep(index, openshiftMap) { | |
echo "$index == $openshiftMap" | |
openshiftMap.each { project -> | |
sh """ | |
echo "hello${project}" >> batch${index}.tmp | |
""" | |
} | |
def batchName = "batch${index}" | |
stash includes: '*.tmp', name: "$batchName" | |
} | |
node('maven') { | |
stage('stepsForParallel') { | |
script { | |
def openshiftMap = [0, 1, 2, 3, 4] | |
def openshiftMapSplit = openshiftMap.collate(2) | |
echo "openshiftMapSplit = $openshiftMapSplit" | |
def parallelSteps = [:] | |
openshiftMapSplit.eachWithIndex { currentMap, index -> | |
parallelSteps += ["batch${index}": { | |
node('maven') { | |
stage("batch${index}") { | |
generateJinja2DashboardStep(index, currentMap) | |
} | |
} | |
}] | |
} | |
parallel parallelSteps | |
dir("dashboards") { | |
openshiftMapSplit.eachWithIndex { it2, index -> | |
unstash "batch${index}" | |
sh "cat batch${index}.tmp" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment