def runDocker(image, cmd) { powershell """ docker run ` --rm ` -w "${env.WORKSPACE}" ` -v "${env.WORKSPACE}:${env.WORKSPACE}:rw" ` -e "WORKSPACE=${env.WORKSPACE}" ` -e "BUILD_NUMBER=${env.BUILD_NUMBER}" ` $image powershell -C "$cmd" """ } pipeline { agent none stages { stage("Smoke on openjdks") { parallel { stage("Smoke JDK8") { agent { label "windows-server-2019" } steps { runDocker( "openjdk:8-windowsservercore", ".\\gradlew build integrationTest acceptanceTest referenceTest" ) } post { always { junit "**\\build\\test-results\\**\\*.xml" } } } stage("Smoke JDK11") { agent { label "windows-server-2019" } steps { runDocker( "openjdk:11-windowsservercore", ".\\gradlew build integrationTest acceptanceTest referenceTest" ) } post { always { junit "**\\build\\test-results\\**\\*.xml" } } } stage("Smoke JDK12") { agent { label "windows-server-2019" } steps { runDocker( "openjdk:12-windowsservercore", ".\\gradlew build integrationTest acceptanceTest referenceTest" ) } post { always { junit "**\\build\\test-results\\**\\*.xml" } } } } } } }