lib/jenkins/builder/app.rb in jenkins-builder-0.2.3 vs lib/jenkins/builder/app.rb in jenkins-builder-0.2.4

- old
+ new

@@ -83,12 +83,22 @@ end end def build_each(jobs) if @options[:failfast] - jobs.find { |job| build(job).nil? } + failed_job = jobs.find { |job| build(job).nil? } + if failed_job + exit 1 + else + exit 0 + end else - jobs.each { |job| build(job) } + results = jobs.map { |job| build(job) } + if results.any? { |r| r.nil? } + exit 1 + else + exit 0 + end end end def build(job) job_name, branch = job.split(':')