private function updateBuild(HarbormasterBuild $build)
 {
     if ($build->isAborting()) {
         $this->releaseAllArtifacts($build);
         $build->setBuildStatus(HarbormasterBuild::STATUS_ABORTED);
         $build->save();
     }
     if ($build->getBuildStatus() == HarbormasterBuild::STATUS_PENDING || $build->isRestarting()) {
         $this->restartBuild($build);
         $build->setBuildStatus(HarbormasterBuild::STATUS_BUILDING);
         $build->save();
     }
     if ($build->isResuming()) {
         $build->setBuildStatus(HarbormasterBuild::STATUS_BUILDING);
         $build->save();
     }
     if ($build->isPausing() && !$build->isComplete()) {
         $build->setBuildStatus(HarbormasterBuild::STATUS_PAUSED);
         $build->save();
     }
     $build->deleteUnprocessedCommands();
     if ($build->getBuildStatus() == HarbormasterBuild::STATUS_BUILDING) {
         $this->updateBuildSteps($build);
     }
 }