Created
May 30, 2017 19:20
-
-
Save plukevdh/3c1822fb1b9baea5f6fede218cbb1d28 to your computer and use it in GitHub Desktop.
Demonstrative Jenkinsfile to troubleshoot https://issues.jenkins-ci.org/browse/JENKINS-44493
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
def envs = [ | |
[env: "stage", region: "us-east-1"] | |
] | |
stage("Plan") { | |
def planJobs = [:] | |
for(int i = 0; i < envs.size(); i++) { | |
def details = envs.get(i) | |
planJobs["${details.env}-${details.region}"] = { | |
node() { | |
echo "Running!" | |
} | |
} | |
} | |
parallel(planJobs) | |
} | |
stage("Apply") { | |
def applyJobs = [:] | |
for(int i = 0; i < envs.size(); i++) { | |
def details = envs.get(i) | |
def confirmedUser = "Auto" | |
applyJobs["${details.env}-${details.region}"] = { | |
def apply = false | |
try { | |
confirmedUser = input message: 'Apply Plan?', ok: 'Apply', submitterParameter: 'confirmedUser' | |
apply = true | |
} catch (err) { | |
apply = false | |
currentBuild.result = 'ABORTED' | |
} | |
if(apply) { | |
node() { | |
echo "Applying! Confirmed by ${confirmedUser}" | |
} | |
} | |
} | |
} | |
parallel(applyJobs) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment