Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/engine/HarbormasterBuildEngine.php
| Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | public function continueBuild() { | ||||
| if (!$build->isBuilding()) { | if (!$build->isBuilding()) { | ||||
| $this->releaseAllArtifacts($build); | $this->releaseAllArtifacts($build); | ||||
| } | } | ||||
| } | } | ||||
| private function updateBuild(HarbormasterBuild $build) { | private function updateBuild(HarbormasterBuild $build) { | ||||
| if ($build->isAborting()) { | if ($build->isAborting()) { | ||||
| $this->releaseAllArtifacts($build); | $this->releaseAllArtifacts($build); | ||||
| $this->abortWaitingSteps($build); | |||||
| $build->setBuildStatus(HarbormasterBuild::STATUS_ABORTED); | $build->setBuildStatus(HarbormasterBuild::STATUS_ABORTED); | ||||
| $build->save(); | $build->save(); | ||||
| } | } | ||||
| if (($build->getBuildStatus() == HarbormasterBuild::STATUS_PENDING) || | if (($build->getBuildStatus() == HarbormasterBuild::STATUS_PENDING) || | ||||
| ($build->isRestarting())) { | ($build->isRestarting())) { | ||||
| $this->restartBuild($build); | $this->restartBuild($build); | ||||
| $build->setBuildStatus(HarbormasterBuild::STATUS_BUILDING); | $build->setBuildStatus(HarbormasterBuild::STATUS_BUILDING); | ||||
| ▲ Show 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | foreach ($runnable as $runnable_step) { | ||||
| $runnable_step, | $runnable_step, | ||||
| $build->retrieveVariablesFromBuild()); | $build->retrieveVariablesFromBuild()); | ||||
| $target->save(); | $target->save(); | ||||
| $this->queueNewBuildTarget($target); | $this->queueNewBuildTarget($target); | ||||
| } | } | ||||
| } | } | ||||
| private function abortWaitingSteps(HarbormasterBuild $build) { | |||||
| $targets = id(new HarbormasterBuildTargetQuery()) | |||||
| ->setViewer($this->getViewer()) | |||||
| ->withBuildPHIDs(array($build->getPHID())) | |||||
| ->withBuildGenerations(array($build->getBuildGeneration())) | |||||
| ->execute(); | |||||
| $targets = mgroup($targets, 'getBuildStepPHID'); | |||||
| $steps = id(new HarbormasterBuildStepQuery()) | |||||
| ->setViewer($this->getViewer()) | |||||
| ->withBuildPlanPHIDs(array($build->getBuildPlan()->getPHID())) | |||||
| ->execute(); | |||||
| foreach ($steps as $step) { | |||||
| $step_targets = idx($targets, $step->getPHID(), array()); | |||||
| foreach ($step_targets as $target) { | |||||
| if ($target->isWaiting()) { | |||||
| try { | |||||
| $step->abortWaitingForMessage(); | |||||
| } catch (Exception $ex) { | |||||
| // TODO ? | |||||
Lint: TODO Comment: This comment has a TODO. | |||||
| // We're already aborting, but we should try to stop all steps | |||||
| } | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Process messages which were sent to these targets, kicking applicable | * Process messages which were sent to these targets, kicking applicable | ||||
| * targets out of "Waiting" and into either "Passed" or "Failed". | * targets out of "Waiting" and into either "Passed" or "Failed". | ||||
| * | * | ||||
| * @param list<HarbormasterBuildTarget> List of targets to process. | * @param list<HarbormasterBuildTarget> List of targets to process. | ||||
| * @return void | * @return void | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines | |||||
This comment has a TODO.