From 41b3f9236a770c17dabd2f5364f2199d2560ae0e Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 21 Jun 2015 10:55:08 -0700 Subject: [PATCH] Allow lint and unit results to be reported via `harbormaster.sendmessage` Summary: Ref T8095. When build results are reported for a target, allow them to include unit and lint results. There is no real way to see this stuff in the UI yet, either in Harbormaster or Differential. Test Plan: Manually called this method with some results, saw Harbormaster update appropriately. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8095 Differential Revision: https://secure.phabricator.com/D13380 --- ...DifferentialCreateDiffConduitAPIMethod.php | 3 +- ...arbormasterSendMessageConduitAPIMethod.php | 31 ++++++++++++++++--- .../HarbormasterBuildableViewController.php | 8 ++++- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php index 91b5ca8653..686f7cba83 100644 --- a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php @@ -160,7 +160,8 @@ final class DifferentialCreateDiffConduitAPIMethod return array( 'diffid' => $diff->getID(), - 'uri' => $uri, + 'phid' => $diff->getPHID(), + 'uri' => $uri, ); } diff --git a/src/applications/harbormaster/conduit/HarbormasterSendMessageConduitAPIMethod.php b/src/applications/harbormaster/conduit/HarbormasterSendMessageConduitAPIMethod.php index f6752f08fb..9590f90cec 100644 --- a/src/applications/harbormaster/conduit/HarbormasterSendMessageConduitAPIMethod.php +++ b/src/applications/harbormaster/conduit/HarbormasterSendMessageConduitAPIMethod.php @@ -18,7 +18,9 @@ final class HarbormasterSendMessageConduitAPIMethod return array( 'buildTargetPHID' => 'required phid', - 'type' => 'required '.$type_const, + 'lint' => 'optional list', + 'unit' => 'optional list', + 'type' => 'required '.$type_const, ); } @@ -40,10 +42,31 @@ final class HarbormasterSendMessageConduitAPIMethod throw new Exception(pht('No such build target!')); } - $message = HarbormasterBuildMessage::initializeNewMessage($viewer) + $save = array(); + + $lint_messages = $request->getValue('lint', array()); + foreach ($lint_messages as $lint) { + $save[] = HarbormasterBuildLintMessage::newFromDictionary( + $build_target, + $lint); + } + + $unit_messages = $request->getValue('unit', array()); + foreach ($unit_messages as $unit) { + $save[] = HarbormasterBuildUnitMessage::newFromDictionary( + $build_target, + $unit); + } + + $save[] = HarbormasterBuildMessage::initializeNewMessage($viewer) ->setBuildTargetPHID($build_target->getPHID()) - ->setType($message_type) - ->save(); + ->setType($message_type); + + $build_target->openTransaction(); + foreach ($save as $object) { + $object->save(); + } + $build_target->saveTransaction(); // If the build has completely paused because all steps are blocked on // waiting targets, this will resume it. diff --git a/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php b/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php index ecb7605657..8fa65d0350 100644 --- a/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php +++ b/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php @@ -248,7 +248,13 @@ final class HarbormasterBuildableViewController $build_list->addItem($item); } - return $build_list; + $build_list->setFlush(true); + + $box = id(new PHUIObjectBoxView()) + ->setHeaderText(pht('Builds')) + ->appendChild($build_list); + + return $box; } }