Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14012840
D13874.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D13874.id.diff
View Options
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
@@ -913,6 +913,7 @@
'FundInitiativeTransactionQuery' => 'applications/fund/query/FundInitiativeTransactionQuery.php',
'FundInitiativeViewController' => 'applications/fund/controller/FundInitiativeViewController.php',
'FundSchemaSpec' => 'applications/fund/storage/FundSchemaSpec.php',
+ 'HarbormasterAppendLogConduitAPIMethod' => 'applications/harbormaster/conduit/HarbormasterAppendLogConduitAPIMethod.php',
'HarbormasterArcLintBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterArcLintBuildStepImplementation.php',
'HarbormasterArcUnitBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterArcUnitBuildStepImplementation.php',
'HarbormasterAutotargetsTestCase' => 'applications/harbormaster/__tests__/HarbormasterAutotargetsTestCase.php',
@@ -982,6 +983,7 @@
'HarbormasterController' => 'applications/harbormaster/controller/HarbormasterController.php',
'HarbormasterDAO' => 'applications/harbormaster/storage/HarbormasterDAO.php',
'HarbormasterExternalBuildStepGroup' => 'applications/harbormaster/stepgroup/HarbormasterExternalBuildStepGroup.php',
+ 'HarbormasterFinalizeLogConduitAPIMethod' => 'applications/harbormaster/conduit/HarbormasterFinalizeLogConduitAPIMethod.php',
'HarbormasterHTTPRequestBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterHTTPRequestBuildStepImplementation.php',
'HarbormasterLeaseHostBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterLeaseHostBuildStepImplementation.php',
'HarbormasterLintMessagesController' => 'applications/harbormaster/controller/HarbormasterLintMessagesController.php',
@@ -1010,6 +1012,7 @@
'HarbormasterScratchTable' => 'applications/harbormaster/storage/HarbormasterScratchTable.php',
'HarbormasterSendMessageConduitAPIMethod' => 'applications/harbormaster/conduit/HarbormasterSendMessageConduitAPIMethod.php',
'HarbormasterSleepBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterSleepBuildStepImplementation.php',
+ 'HarbormasterStartLogConduitAPIMethod' => 'applications/harbormaster/conduit/HarbormasterStartLogConduitAPIMethod.php',
'HarbormasterStepAddController' => 'applications/harbormaster/controller/HarbormasterStepAddController.php',
'HarbormasterStepDeleteController' => 'applications/harbormaster/controller/HarbormasterStepDeleteController.php',
'HarbormasterStepEditController' => 'applications/harbormaster/controller/HarbormasterStepEditController.php',
@@ -4600,6 +4603,7 @@
'FundInitiativeTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'FundInitiativeViewController' => 'FundController',
'FundSchemaSpec' => 'PhabricatorConfigSchemaSpec',
+ 'HarbormasterAppendLogConduitAPIMethod' => 'HarbormasterConduitAPIMethod',
'HarbormasterArcLintBuildStepImplementation' => 'HarbormasterBuildStepImplementation',
'HarbormasterArcUnitBuildStepImplementation' => 'HarbormasterBuildStepImplementation',
'HarbormasterAutotargetsTestCase' => 'PhabricatorTestCase',
@@ -4701,6 +4705,7 @@
'HarbormasterController' => 'PhabricatorController',
'HarbormasterDAO' => 'PhabricatorLiskDAO',
'HarbormasterExternalBuildStepGroup' => 'HarbormasterBuildStepGroup',
+ 'HarbormasterFinalizeLogConduitAPIMethod' => 'HarbormasterConduitAPIMethod',
'HarbormasterHTTPRequestBuildStepImplementation' => 'HarbormasterBuildStepImplementation',
'HarbormasterLeaseHostBuildStepImplementation' => 'HarbormasterBuildStepImplementation',
'HarbormasterLintMessagesController' => 'HarbormasterController',
@@ -4729,6 +4734,7 @@
'HarbormasterScratchTable' => 'HarbormasterDAO',
'HarbormasterSendMessageConduitAPIMethod' => 'HarbormasterConduitAPIMethod',
'HarbormasterSleepBuildStepImplementation' => 'HarbormasterBuildStepImplementation',
+ 'HarbormasterStartLogConduitAPIMethod' => 'HarbormasterConduitAPIMethod',
'HarbormasterStepAddController' => 'HarbormasterController',
'HarbormasterStepDeleteController' => 'HarbormasterController',
'HarbormasterStepEditController' => 'HarbormasterController',
diff --git a/src/applications/harbormaster/conduit/HarbormasterAppendLogConduitAPIMethod.php b/src/applications/harbormaster/conduit/HarbormasterAppendLogConduitAPIMethod.php
new file mode 100644
--- /dev/null
+++ b/src/applications/harbormaster/conduit/HarbormasterAppendLogConduitAPIMethod.php
@@ -0,0 +1,46 @@
+<?php
+
+final class HarbormasterAppendLogConduitAPIMethod
+ extends HarbormasterConduitAPIMethod {
+
+ public function getAPIMethodName() {
+ return 'harbormaster.appendlog';
+ }
+
+ public function getMethodDescription() {
+ return pht(
+ 'Appends data to a Harbormaster log that was started '.
+ 'with harbormaster.startlog.');
+ }
+
+ protected function defineParamTypes() {
+ return array(
+ 'buildLogPHID' => 'required phid',
+ 'data' => 'required string',
+ );
+ }
+
+ protected function defineReturnType() {
+ return 'void';
+ }
+
+ protected function execute(ConduitAPIRequest $request) {
+ $viewer = $request->getUser();
+
+ $build_log_phid = $request->getValue('buildLogPHID');
+ $data = $request->getValue('data');
+
+ $build_log = id(new HarbormasterBuildLogQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($build_log_phid))
+ ->executeOne();
+ if (!$build_log) {
+ throw new Exception(pht('No such build log!'));
+ }
+
+ $build_log->append($data);
+
+ return null;
+ }
+
+}
diff --git a/src/applications/harbormaster/conduit/HarbormasterFinalizeLogConduitAPIMethod.php b/src/applications/harbormaster/conduit/HarbormasterFinalizeLogConduitAPIMethod.php
new file mode 100644
--- /dev/null
+++ b/src/applications/harbormaster/conduit/HarbormasterFinalizeLogConduitAPIMethod.php
@@ -0,0 +1,46 @@
+<?php
+
+final class HarbormasterFinalizeLogConduitAPIMethod
+ extends HarbormasterConduitAPIMethod {
+
+ public function getAPIMethodName() {
+ return 'harbormaster.finalizelog';
+ }
+
+ public function getMethodDescription() {
+ return pht(
+ 'Finalizes a Harbormaster log that was started '.
+ 'with harbormaster.startlog.');
+ }
+
+ protected function defineParamTypes() {
+ return array(
+ 'buildLogPHID' => 'required phid',
+ 'startTimestamp' => 'required int',
+ );
+ }
+
+ protected function defineReturnType() {
+ return 'void';
+ }
+
+ protected function execute(ConduitAPIRequest $request) {
+ $viewer = $request->getUser();
+
+ $build_log_phid = $request->getValue('buildLogPHID');
+ $start = $request->getValue('startTimestamp');
+
+ $build_log = id(new HarbormasterBuildLogQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($build_log_phid))
+ ->executeOne();
+ if (!$build_log) {
+ throw new Exception(pht('No such build log!'));
+ }
+
+ $build_log->finalize($start);
+
+ return null;
+ }
+
+}
diff --git a/src/applications/harbormaster/conduit/HarbormasterStartLogConduitAPIMethod.php b/src/applications/harbormaster/conduit/HarbormasterStartLogConduitAPIMethod.php
new file mode 100644
--- /dev/null
+++ b/src/applications/harbormaster/conduit/HarbormasterStartLogConduitAPIMethod.php
@@ -0,0 +1,54 @@
+<?php
+
+final class HarbormasterStartLogConduitAPIMethod
+ extends HarbormasterConduitAPIMethod {
+
+ public function getAPIMethodName() {
+ return 'harbormaster.startlog';
+ }
+
+ public function getMethodDescription() {
+ return pht(
+ 'Creates a new log artifact against a Harbormaster build target '.
+ 'and returns the log artifact PHID.');
+ }
+
+ protected function defineParamTypes() {
+ return array(
+ 'buildTargetPHID' => 'required phid',
+ 'logSource' => 'required string',
+ 'logType' => 'required string',
+ );
+ }
+
+ protected function defineReturnType() {
+ return 'array';
+ }
+
+ protected function execute(ConduitAPIRequest $request) {
+ $viewer = $request->getUser();
+
+ $build_target_phid = $request->getValue('buildTargetPHID');
+ $log_source = $request->getValue('logSource');
+ $log_type = $request->getValue('logType');
+
+ $build_target = id(new HarbormasterBuildTargetQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($build_target_phid))
+ ->executeOne();
+ if (!$build_target) {
+ throw new Exception(pht('No such build target!'));
+ }
+
+ $build = $build_target->getBuild();
+ $log = $build->createLog($build_target, $log_source, $log_type);
+
+ $start = $log->start();
+
+ return array(
+ 'buildLogPHID' => $log->getPHID(),
+ 'startTimestamp' => $start,
+ );
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 2, 7:46 PM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6746031
Default Alt Text
D13874.id.diff (8 KB)
Attached To
Mode
D13874: Implement methods for logging to Harbormaster via Conduit
Attached
Detach File
Event Timeline
Log In to Comment