Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/worker/HarbormasterTargetWorker.php
Show All 31 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()) { | |||||
$target->setTargetStatus(HarbormasterBuildTarget::STATUS_FAILED); | |||||
$target->save(); | |||||
} else { | |||||
$implementation->execute($build, $target); | $implementation->execute($build, $target); | ||||
$target->setTargetStatus(HarbormasterBuildTarget::STATUS_PASSED); | $target->setTargetStatus(HarbormasterBuildTarget::STATUS_PASSED); | ||||
$target->save(); | $target->save(); | ||||
} | |||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
phlog($ex); | phlog($ex); | ||||
try { | try { | ||||
$log = $build->createLog($target, 'core', 'exception'); | $log = $build->createLog($target, 'core', 'exception'); | ||||
$start = $log->start(); | $start = $log->start(); | ||||
$log->append((string)$ex); | $log->append((string)$ex); | ||||
$log->finalize($start); | $log->finalize($start); | ||||
Show All 15 Lines |