@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add `bin/harbormaster write-log` to write some arbitrary content into a new Harbormaster log

Summary: Ref T13088. This is currently minimal but the modify-execute development loop on build logs is extremely long without it.

Test Plan: Ran `echo hi | ./bin/harbormaster write-log --target 12345`, saw the log show up in the web UI.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13088

Differential Revision: https://secure.phabricator.com/D19130

+64
+2
src/__phutil_library_map__.php
··· 1311 1311 'HarbormasterManagementRestartWorkflow' => 'applications/harbormaster/management/HarbormasterManagementRestartWorkflow.php', 1312 1312 'HarbormasterManagementUpdateWorkflow' => 'applications/harbormaster/management/HarbormasterManagementUpdateWorkflow.php', 1313 1313 'HarbormasterManagementWorkflow' => 'applications/harbormaster/management/HarbormasterManagementWorkflow.php', 1314 + 'HarbormasterManagementWriteLogWorkflow' => 'applications/harbormaster/management/HarbormasterManagementWriteLogWorkflow.php', 1314 1315 'HarbormasterMessageType' => 'applications/harbormaster/engine/HarbormasterMessageType.php', 1315 1316 'HarbormasterObject' => 'applications/harbormaster/storage/HarbormasterObject.php', 1316 1317 'HarbormasterOtherBuildStepGroup' => 'applications/harbormaster/stepgroup/HarbormasterOtherBuildStepGroup.php', ··· 6614 6615 'HarbormasterManagementRestartWorkflow' => 'HarbormasterManagementWorkflow', 6615 6616 'HarbormasterManagementUpdateWorkflow' => 'HarbormasterManagementWorkflow', 6616 6617 'HarbormasterManagementWorkflow' => 'PhabricatorManagementWorkflow', 6618 + 'HarbormasterManagementWriteLogWorkflow' => 'HarbormasterManagementWorkflow', 6617 6619 'HarbormasterMessageType' => 'Phobject', 6618 6620 'HarbormasterObject' => 'HarbormasterDAO', 6619 6621 'HarbormasterOtherBuildStepGroup' => 'HarbormasterBuildStepGroup',
+62
src/applications/harbormaster/management/HarbormasterManagementWriteLogWorkflow.php
··· 1 + <?php 2 + 3 + final class HarbormasterManagementWriteLogWorkflow 4 + extends HarbormasterManagementWorkflow { 5 + 6 + protected function didConstruct() { 7 + $this 8 + ->setName('write-log') 9 + ->setExamples('**write-log** --target __id__ [__options__]') 10 + ->setSynopsis(pht('Write a new Harbormaster build log.')) 11 + ->setArguments( 12 + array( 13 + array( 14 + 'name' => 'target', 15 + 'param' => 'id', 16 + 'help' => pht( 17 + 'Build Target ID to attach the log to.'), 18 + ), 19 + )); 20 + } 21 + 22 + public function execute(PhutilArgumentParser $args) { 23 + $viewer = $this->getViewer(); 24 + 25 + $target_id = $args->getArg('target'); 26 + if (!$target_id) { 27 + throw new PhutilArgumentUsageException( 28 + pht('Choose a build target to attach the log to with "--target".')); 29 + } 30 + 31 + $target = id(new HarbormasterBuildTargetQuery()) 32 + ->setViewer($viewer) 33 + ->withIDs(array($target_id)) 34 + ->executeOne(); 35 + if (!$target) { 36 + throw new PhutilArgumentUsageException( 37 + pht( 38 + 'Unable to load build target "%s".', 39 + $target_id)); 40 + } 41 + 42 + 43 + $log = HarbormasterBuildLog::initializeNewBuildLog($target); 44 + $log->openBuildLog(); 45 + 46 + echo tsprintf( 47 + "%s\n", 48 + pht('Reading log from stdin...')); 49 + 50 + $content = file_get_contents('php://stdin'); 51 + $log->append($content); 52 + 53 + $log->closeBuildLog(); 54 + 55 + echo tsprintf( 56 + "%s\n", 57 + pht('Done.')); 58 + 59 + return 0; 60 + } 61 + 62 + }