Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/worker/HarbormasterTargetWorker.php
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | try { | ||||
$next_status = HarbormasterBuildTarget::STATUS_PASSED; | $next_status = HarbormasterBuildTarget::STATUS_PASSED; | ||||
if ($implementation->shouldWaitForMessage($target)) { | if ($implementation->shouldWaitForMessage($target)) { | ||||
$next_status = HarbormasterBuildTarget::STATUS_WAITING; | $next_status = HarbormasterBuildTarget::STATUS_WAITING; | ||||
} | } | ||||
$target->setTargetStatus($next_status); | $target->setTargetStatus($next_status); | ||||
if ($target->isComplete()) { | if ($target->isComplete()) { | ||||
$target->setDateCompleted(time()); | $target->setDateCompleted(PhabricatorTime::getNow()); | ||||
} | } | ||||
$target->save(); | $target->save(); | ||||
} catch (PhabricatorWorkerYieldException $ex) { | } catch (PhabricatorWorkerYieldException $ex) { | ||||
// If the target wants to yield, let that escape without further | // If the target wants to yield, let that escape without further | ||||
// processing. We'll resume after the task retries. | // processing. We'll resume after the task retries. | ||||
throw $ex; | throw $ex; | ||||
} catch (HarbormasterBuildFailureException $ex) { | } catch (HarbormasterBuildFailureException $ex) { | ||||
// A build step wants to fail explicitly. | // A build step wants to fail explicitly. | ||||
$target->setTargetStatus(HarbormasterBuildTarget::STATUS_FAILED); | $target->setTargetStatus(HarbormasterBuildTarget::STATUS_FAILED); | ||||
$target->setDateCompleted(time()); | $target->setDateCompleted(PhabricatorTime::getNow()); | ||||
$target->save(); | $target->save(); | ||||
} catch (HarbormasterBuildAbortedException $ex) { | } catch (HarbormasterBuildAbortedException $ex) { | ||||
// A build step is aborting because the build has been restarted. | // A build step is aborting because the build has been restarted. | ||||
$target->setTargetStatus(HarbormasterBuildTarget::STATUS_ABORTED); | $target->setTargetStatus(HarbormasterBuildTarget::STATUS_ABORTED); | ||||
$target->setDateCompleted(time()); | $target->setDateCompleted(PhabricatorTime::getNow()); | ||||
$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); | ||||
Show All 17 Lines |