Peter Kahn
Peter Kahn

Reputation: 13036

Why does Jenkins calls getLastSuccessfulBuild consider unstable to be succesfull when there's a call for getLastUnstableBuild

Can someone tell me how I'd find last green build for jenkins 2.277?

After upgrading I found a behavior change where getLastSuccessfulBuild() returns the same value as getLastUnstableBuild()

Which means, when I promote, I can't trust these functions and need to write something to walk back through builds checking status.

In the scenario below:

last                Experiments/exp.Stability #6
last successful     Experiments/exp.Stability #6
last unstable       Experiments/exp.Stability #6
last failed         Experiments/exp.Stability #4

Upvotes: 0

Views: 120

Answers (1)

Peter Kahn
Peter Kahn

Reputation: 13036

To get the last "green" build getLastStableBuild() needs to be used

Upvotes: 1

Related Questions