Created
          November 7, 2018 13:59 
        
      - 
      
- 
        Save garethahealy/0a02d8bc92de689eb28729113a4a4374 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 echoAndStash(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] | |
| def openshiftMapSplit = openshiftMap.collate(2) | |
| echo "openshiftMapSplit = $openshiftMapSplit" | |
| parallel ( | |
| 'batch0': { | |
| node('maven') { | |
| stage('batch0') { | |
| echoAndStash(0, openshiftMapSplit[0]) | |
| } | |
| } | |
| }, | |
| 'batch1': { | |
| node('maven') { | |
| stage('batch1') { | |
| echoAndStash(1, openshiftMapSplit[1]) | |
| } | |
| } | |
| } | |
| ) | |
| dir("dashboards") { | |
| unstash 'batch0' | |
| unstash 'batch1' | |
| sh "cat batch0.tmp" | |
| sh "cat batch1.tmp" | |
| } | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment