Last active
April 4, 2018 11:14
-
-
Save cccaternberg/da5a3461a3eeaa039ff620f344316e09 to your computer and use it in GitHub Desktop.
This file contains 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
node (){ | |
stage ("prepare"){ | |
["1", "2", "3"].each { | |
println "Item: $it" | |
// Write a text file there. | |
dir ("output"){ | |
writeFile file: "${it}-test.txt", text: "$it",encoding: "UTF-8" | |
} | |
} | |
stash name: "myTestFiles", includes: "output/*.*" | |
} | |
stage('run-parallel') { | |
unstash "myTestFiles" | |
def files = findFiles glob: '**/*-test.txt' | |
files.each {file -> println file} | |
def parallelBranches = files.collectEntries { n -> | |
[(n): { | |
node('docker-cloud') { | |
sh "sleep 10" | |
echo "Done" | |
} | |
}] | |
} | |
parallel parallelBranches | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment