Page MenuHomePhabricator

D10090.diff
No OneTemporary

D10090.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -654,6 +654,7 @@
'HarbormasterBuildCommand' => 'applications/harbormaster/storage/HarbormasterBuildCommand.php',
'HarbormasterBuildDependencyDatasource' => 'applications/harbormaster/typeahead/HarbormasterBuildDependencyDatasource.php',
'HarbormasterBuildEngine' => 'applications/harbormaster/engine/HarbormasterBuildEngine.php',
+ 'HarbormasterBuildFailureException' => 'applications/harbormaster/exception/HarbormasterBuildFailureException.php',
'HarbormasterBuildGraph' => 'applications/harbormaster/engine/HarbormasterBuildGraph.php',
'HarbormasterBuildItem' => 'applications/harbormaster/storage/build/HarbormasterBuildItem.php',
'HarbormasterBuildItemPHIDType' => 'applications/harbormaster/phid/HarbormasterBuildItemPHIDType.php',
@@ -3394,6 +3395,7 @@
'HarbormasterBuildCommand' => 'HarbormasterDAO',
'HarbormasterBuildDependencyDatasource' => 'PhabricatorTypeaheadDatasource',
'HarbormasterBuildEngine' => 'Phobject',
+ 'HarbormasterBuildFailureException' => 'Exception',
'HarbormasterBuildGraph' => 'AbstractDirectedGraph',
'HarbormasterBuildItem' => 'HarbormasterDAO',
'HarbormasterBuildItemPHIDType' => 'PhabricatorPHIDType',
diff --git a/src/applications/harbormaster/exception/HarbormasterBuildFailureException.php b/src/applications/harbormaster/exception/HarbormasterBuildFailureException.php
new file mode 100644
--- /dev/null
+++ b/src/applications/harbormaster/exception/HarbormasterBuildFailureException.php
@@ -0,0 +1,5 @@
+<?php
+
+final class HarbormasterBuildFailureException extends Exception {
+
+}
diff --git a/src/applications/harbormaster/step/HarbormasterCommandBuildStepImplementation.php b/src/applications/harbormaster/step/HarbormasterCommandBuildStepImplementation.php
--- a/src/applications/harbormaster/step/HarbormasterCommandBuildStepImplementation.php
+++ b/src/applications/harbormaster/step/HarbormasterCommandBuildStepImplementation.php
@@ -68,7 +68,7 @@
$log_stderr->finalize($start_stderr);
if ($err) {
- throw new Exception(pht('Command failed with error %d.', $err));
+ throw new HarbormasterBuildFailureException();
}
}
diff --git a/src/applications/harbormaster/worker/HarbormasterTargetWorker.php b/src/applications/harbormaster/worker/HarbormasterTargetWorker.php
--- a/src/applications/harbormaster/worker/HarbormasterTargetWorker.php
+++ b/src/applications/harbormaster/worker/HarbormasterTargetWorker.php
@@ -56,6 +56,10 @@
// If the target wants to yield, let that escape without further
// processing. We'll resume after the task retries.
throw $ex;
+ } catch (HarbormasterBuildFailureException $ex) {
+ // A build step wants to fail explicitly.
+ $target->setTargetStatus(HarbormasterBuildTarget::STATUS_FAILED);
+ $target->save();
} catch (Exception $ex) {
phlog($ex);

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 15, 9:16 AM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7626760
Default Alt Text
D10090.diff (2 KB)

Event Timeline