From 6fcd73a3567e1d902c24f089be0e231d1e308db8 Mon Sep 17 00:00:00 2001 From: Stephen Ball Date: Tue, 13 Oct 2015 13:09:24 +0100 Subject: [PATCH] Moving getLatest() before the new build is saved --- PHPCI/Builder.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PHPCI/Builder.php b/PHPCI/Builder.php index 27001164..d28557c6 100644 --- a/PHPCI/Builder.php +++ b/PHPCI/Builder.php @@ -181,6 +181,8 @@ class Builder implements LoggerAwareInterface */ public function execute() { + $previous_build = $this->build->getProject()->getLatestBuild(); + // Update the build in the database, ping any external services. $this->build->setStatus(Build::STATUS_RUNNING); $this->build->setStarted(new \DateTime()); @@ -188,7 +190,6 @@ class Builder implements LoggerAwareInterface $this->build->sendStatusPostback(); $success = true; - $previous_build = $this->build->getProject()->getLatestBuild(); if ($previous_build) { $previous_state = $previous_build->getStatus(); } else {