mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Allow build steps to explicitly fail the build
Summary: We've received feedback that the "core - exception" is incredibly confusing, to the point where developers see this and write off the build failure as a Phabricator error that is unrelated to their changes. Test Plan: Ran a build with a `exit 1` run step, didn't see the "core - exception" appear. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D10090
This commit is contained in:
parent
c4cbc1a32d
commit
aa87a524e2
4 changed files with 12 additions and 1 deletions
|
@ -654,6 +654,7 @@ phutil_register_library_map(array(
|
||||||
'HarbormasterBuildCommand' => 'applications/harbormaster/storage/HarbormasterBuildCommand.php',
|
'HarbormasterBuildCommand' => 'applications/harbormaster/storage/HarbormasterBuildCommand.php',
|
||||||
'HarbormasterBuildDependencyDatasource' => 'applications/harbormaster/typeahead/HarbormasterBuildDependencyDatasource.php',
|
'HarbormasterBuildDependencyDatasource' => 'applications/harbormaster/typeahead/HarbormasterBuildDependencyDatasource.php',
|
||||||
'HarbormasterBuildEngine' => 'applications/harbormaster/engine/HarbormasterBuildEngine.php',
|
'HarbormasterBuildEngine' => 'applications/harbormaster/engine/HarbormasterBuildEngine.php',
|
||||||
|
'HarbormasterBuildFailureException' => 'applications/harbormaster/exception/HarbormasterBuildFailureException.php',
|
||||||
'HarbormasterBuildGraph' => 'applications/harbormaster/engine/HarbormasterBuildGraph.php',
|
'HarbormasterBuildGraph' => 'applications/harbormaster/engine/HarbormasterBuildGraph.php',
|
||||||
'HarbormasterBuildItem' => 'applications/harbormaster/storage/build/HarbormasterBuildItem.php',
|
'HarbormasterBuildItem' => 'applications/harbormaster/storage/build/HarbormasterBuildItem.php',
|
||||||
'HarbormasterBuildItemPHIDType' => 'applications/harbormaster/phid/HarbormasterBuildItemPHIDType.php',
|
'HarbormasterBuildItemPHIDType' => 'applications/harbormaster/phid/HarbormasterBuildItemPHIDType.php',
|
||||||
|
@ -3394,6 +3395,7 @@ phutil_register_library_map(array(
|
||||||
'HarbormasterBuildCommand' => 'HarbormasterDAO',
|
'HarbormasterBuildCommand' => 'HarbormasterDAO',
|
||||||
'HarbormasterBuildDependencyDatasource' => 'PhabricatorTypeaheadDatasource',
|
'HarbormasterBuildDependencyDatasource' => 'PhabricatorTypeaheadDatasource',
|
||||||
'HarbormasterBuildEngine' => 'Phobject',
|
'HarbormasterBuildEngine' => 'Phobject',
|
||||||
|
'HarbormasterBuildFailureException' => 'Exception',
|
||||||
'HarbormasterBuildGraph' => 'AbstractDirectedGraph',
|
'HarbormasterBuildGraph' => 'AbstractDirectedGraph',
|
||||||
'HarbormasterBuildItem' => 'HarbormasterDAO',
|
'HarbormasterBuildItem' => 'HarbormasterDAO',
|
||||||
'HarbormasterBuildItemPHIDType' => 'PhabricatorPHIDType',
|
'HarbormasterBuildItemPHIDType' => 'PhabricatorPHIDType',
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class HarbormasterBuildFailureException extends Exception {
|
||||||
|
|
||||||
|
}
|
|
@ -68,7 +68,7 @@ final class HarbormasterCommandBuildStepImplementation
|
||||||
$log_stderr->finalize($start_stderr);
|
$log_stderr->finalize($start_stderr);
|
||||||
|
|
||||||
if ($err) {
|
if ($err) {
|
||||||
throw new Exception(pht('Command failed with error %d.', $err));
|
throw new HarbormasterBuildFailureException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,10 @@ final class HarbormasterTargetWorker extends HarbormasterWorker {
|
||||||
// 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) {
|
||||||
|
// A build step wants to fail explicitly.
|
||||||
|
$target->setTargetStatus(HarbormasterBuildTarget::STATUS_FAILED);
|
||||||
|
$target->save();
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
phlog($ex);
|
phlog($ex);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue