Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/worker/HarbormasterTargetWorker.php
| Show All 32 Lines | final class HarbormasterTargetWorker extends HarbormasterWorker { | ||||
| public function doWork() { | public function doWork() { | ||||
| $target = $this->loadBuildTarget(); | $target = $this->loadBuildTarget(); | ||||
| $build = $target->getBuild(); | $build = $target->getBuild(); | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| try { | try { | ||||
| $implementation = $target->getImplementation(); | $implementation = $target->getImplementation(); | ||||
| if (!$implementation->validateSettings()) { | if (!$implementation->validateSettings()) { | ||||
| $target->setDetail('__failed__', true); | $target->setTargetStatus(HarbormasterBuildTarget::STATUS_FAILED); | ||||
| $target->save(); | $target->save(); | ||||
| } else { | } else { | ||||
| $implementation->execute($build, $target); | $implementation->execute($build, $target); | ||||
| $target->setDetail('__done__', true); | $target->setTargetStatus(HarbormasterBuildTarget::STATUS_PASSED); | ||||
| $target->save(); | $target->save(); | ||||
| } | } | ||||
| } catch (Exception $ex) { | } catch (Exception $ex) { | ||||
| $target->setDetail('__failed__', true); | $target->setTargetStatus(HarbormasterBuildTarget::STATUS_FAILED); | ||||
| $target->save(); | $target->save(); | ||||
| } | } | ||||
| id(new HarbormasterBuildEngine()) | id(new HarbormasterBuildEngine()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->setBuild($build) | ->setBuild($build) | ||||
| ->continueBuild(); | ->continueBuild(); | ||||
| } | } | ||||
| } | } | ||||