@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.

Remove obsolete, confusing Harbormaster builds steps

Summary: Fixes T10458. These steps are obsolete and have not worked since the last updates to Drydock. They may eventually return in some form, but get rid of them for now since they're confusing.

Test Plan:
- Created a build plan with these steps.
- Removed these steps.
- Verified the build plan showed that the steps were invalid, and that I could delete them.
- Deleted them.
- Added new steps, no obsolete steps were available for selection.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10458

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

+42 -242
-4
src/__phutil_library_map__.php
··· 1094 1094 'HarbormasterBuildableTransactionQuery' => 'applications/harbormaster/query/HarbormasterBuildableTransactionQuery.php', 1095 1095 'HarbormasterBuildableViewController' => 'applications/harbormaster/controller/HarbormasterBuildableViewController.php', 1096 1096 'HarbormasterBuiltinBuildStepGroup' => 'applications/harbormaster/stepgroup/HarbormasterBuiltinBuildStepGroup.php', 1097 - 'HarbormasterCommandBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterCommandBuildStepImplementation.php', 1098 1097 'HarbormasterConduitAPIMethod' => 'applications/harbormaster/conduit/HarbormasterConduitAPIMethod.php', 1099 1098 'HarbormasterController' => 'applications/harbormaster/controller/HarbormasterController.php', 1100 1099 'HarbormasterCreateArtifactConduitAPIMethod' => 'applications/harbormaster/conduit/HarbormasterCreateArtifactConduitAPIMethod.php', ··· 1108 1107 'HarbormasterFileArtifact' => 'applications/harbormaster/artifact/HarbormasterFileArtifact.php', 1109 1108 'HarbormasterHTTPRequestBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterHTTPRequestBuildStepImplementation.php', 1110 1109 'HarbormasterHostArtifact' => 'applications/harbormaster/artifact/HarbormasterHostArtifact.php', 1111 - 'HarbormasterLeaseHostBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterLeaseHostBuildStepImplementation.php', 1112 1110 'HarbormasterLeaseWorkingCopyBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterLeaseWorkingCopyBuildStepImplementation.php', 1113 1111 'HarbormasterLintMessagesController' => 'applications/harbormaster/controller/HarbormasterLintMessagesController.php', 1114 1112 'HarbormasterLintPropertyView' => 'applications/harbormaster/view/HarbormasterLintPropertyView.php', ··· 5259 5257 'HarbormasterBuildableTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 5260 5258 'HarbormasterBuildableViewController' => 'HarbormasterController', 5261 5259 'HarbormasterBuiltinBuildStepGroup' => 'HarbormasterBuildStepGroup', 5262 - 'HarbormasterCommandBuildStepImplementation' => 'HarbormasterBuildStepImplementation', 5263 5260 'HarbormasterConduitAPIMethod' => 'ConduitAPIMethod', 5264 5261 'HarbormasterController' => 'PhabricatorController', 5265 5262 'HarbormasterCreateArtifactConduitAPIMethod' => 'HarbormasterConduitAPIMethod', ··· 5273 5270 'HarbormasterFileArtifact' => 'HarbormasterArtifact', 5274 5271 'HarbormasterHTTPRequestBuildStepImplementation' => 'HarbormasterBuildStepImplementation', 5275 5272 'HarbormasterHostArtifact' => 'HarbormasterDrydockLeaseArtifact', 5276 - 'HarbormasterLeaseHostBuildStepImplementation' => 'HarbormasterBuildStepImplementation', 5277 5273 'HarbormasterLeaseWorkingCopyBuildStepImplementation' => 'HarbormasterBuildStepImplementation', 5278 5274 'HarbormasterLintMessagesController' => 'HarbormasterController', 5279 5275 'HarbormasterLintPropertyView' => 'AphrontView',
+11 -11
src/applications/harbormaster/controller/HarbormasterPlanViewController.php
··· 105 105 $i++; 106 106 } 107 107 108 + $step_id = $step->getID(); 109 + $view_uri = $this->getApplicationURI("step/view/{$step_id}/"); 110 + 111 + $item = id(new PHUIObjectItemView()) 112 + ->setObjectName(pht('Step %d.%d', $depth, $i)) 113 + ->setHeader($step->getName()) 114 + ->setHref($view_uri); 115 + 116 + $step_list->addItem($item); 117 + 108 118 $implementation = null; 109 119 try { 110 120 $implementation = $step->getStepImplementation(); 111 121 } catch (Exception $ex) { 112 122 // We can't initialize the implementation. This might be because 113 123 // it's been renamed or no longer exists. 114 - $item = id(new PHUIObjectItemView()) 115 - ->setObjectName(pht('Step %d.%d', $depth, $i)) 116 - ->setHeader(pht('Unknown Implementation')) 124 + $item 117 125 ->setStatusIcon('fa-warning red') 118 126 ->addAttribute(pht( 119 127 'This step has an invalid implementation (%s).', 120 128 $step->getClassName())); 121 - $step_list->addItem($item); 122 129 continue; 123 130 } 124 - $item = id(new PHUIObjectItemView()) 125 - ->setObjectName(pht('Step %d.%d', $depth, $i)) 126 - ->setHeader($step->getName()); 127 131 128 132 $item->addAttribute($implementation->getDescription()); 129 - 130 - $step_id = $step->getID(); 131 - 132 - $view_uri = $this->getApplicationURI("step/view/{$step_id}/"); 133 133 $item->setHref($view_uri); 134 134 135 135 $depends = $step->getStepImplementation()->getDependencies($step);
+19 -2
src/applications/harbormaster/controller/HarbormasterStepViewController.php
··· 18 18 $plan_id = $plan->getID(); 19 19 $plan_uri = $this->getApplicationURI("plan/{$plan_id}/"); 20 20 21 - $implementation = $step->getStepImplementation(); 22 - 23 21 $field_list = PhabricatorCustomField::getObjectFields( 24 22 $step, 25 23 PhabricatorCustomField::ROLE_VIEW); ··· 64 62 $view = id(new PHUIPropertyListView()) 65 63 ->setUser($viewer) 66 64 ->setObject($step); 65 + 66 + try { 67 + $implementation = $step->getStepImplementation(); 68 + } catch (Exception $ex) { 69 + $implementation = null; 70 + } 71 + 72 + if ($implementation) { 73 + $type = $implementation->getName(); 74 + } else { 75 + $type = phutil_tag( 76 + 'em', 77 + array(), 78 + pht( 79 + 'Invalid Implementation ("%s")!', 80 + $step->getClassName())); 81 + } 82 + 83 + $view->addProperty(pht('Step Type'), $type); 67 84 68 85 $view->addProperty( 69 86 pht('Created'),
+6 -1
src/applications/harbormaster/customfield/HarbormasterBuildStepCoreCustomField.php
··· 9 9 } 10 10 11 11 public function createFields($object) { 12 - $impl = $object->getStepImplementation(); 12 + try { 13 + $impl = $object->getStepImplementation(); 14 + } catch (Exception $ex) { 15 + return array(); 16 + } 17 + 13 18 $specs = $impl->getFieldSpecifications(); 14 19 15 20 if ($impl->supportsWaitForMessage()) {
+6 -1
src/applications/harbormaster/engine/HarbormasterBuildGraph.php
··· 48 48 $map = array(); 49 49 foreach ($nodes as $node) { 50 50 $step = $this->stepMap[$node]; 51 - $deps = $step->getStepImplementation()->getDependencies($step); 51 + 52 + try { 53 + $deps = $step->getStepImplementation()->getDependencies($step); 54 + } catch (Exception $ex) { 55 + $deps = array(); 56 + } 52 57 53 58 $map[$node] = array(); 54 59 foreach ($deps as $dep) {
-149
src/applications/harbormaster/step/HarbormasterCommandBuildStepImplementation.php
··· 1 - <?php 2 - 3 - final class HarbormasterCommandBuildStepImplementation 4 - extends HarbormasterBuildStepImplementation { 5 - 6 - private $platform; 7 - 8 - public function getName() { 9 - return pht('Run Command'); 10 - } 11 - 12 - public function getGenericDescription() { 13 - return pht('Run a command on Drydock host.'); 14 - } 15 - 16 - public function getBuildStepGroupKey() { 17 - return HarbormasterPrototypeBuildStepGroup::GROUPKEY; 18 - } 19 - 20 - public function getDescription() { 21 - return pht( 22 - 'Run command %s on host %s.', 23 - $this->formatSettingForDescription('command'), 24 - $this->formatSettingForDescription('hostartifact')); 25 - } 26 - 27 - public function escapeCommand($pattern, array $args) { 28 - array_unshift($args, $pattern); 29 - 30 - $mode = PhutilCommandString::MODE_DEFAULT; 31 - if ($this->platform == 'windows') { 32 - $mode = PhutilCommandString::MODE_POWERSHELL; 33 - } 34 - 35 - return id(new PhutilCommandString($args)) 36 - ->setEscapingMode($mode); 37 - } 38 - 39 - public function execute( 40 - HarbormasterBuild $build, 41 - HarbormasterBuildTarget $build_target) { 42 - $viewer = PhabricatorUser::getOmnipotentUser(); 43 - 44 - $settings = $this->getSettings(); 45 - $variables = $build_target->getVariables(); 46 - 47 - $artifact = $build_target->loadArtifact($settings['hostartifact']); 48 - $impl = $artifact->getArtifactImplementation(); 49 - $lease = $impl->loadArtifactLease($viewer); 50 - 51 - $this->platform = $lease->getAttribute('platform'); 52 - 53 - $command = $this->mergeVariables( 54 - array($this, 'escapeCommand'), 55 - $settings['command'], 56 - $variables); 57 - 58 - $this->platform = null; 59 - 60 - $interface = $lease->getInterface('command'); 61 - 62 - $future = $interface->getExecFuture('%C', $command); 63 - 64 - $log_stdout = $build->createLog($build_target, 'remote', 'stdout'); 65 - $log_stderr = $build->createLog($build_target, 'remote', 'stderr'); 66 - 67 - $start_stdout = $log_stdout->start(); 68 - $start_stderr = $log_stderr->start(); 69 - 70 - $build_update = 5; 71 - 72 - // Read the next amount of available output every second. 73 - $futures = new FutureIterator(array($future)); 74 - foreach ($futures->setUpdateInterval(1) as $key => $future_iter) { 75 - if ($future_iter === null) { 76 - 77 - // Check to see if we should abort. 78 - if ($build_update <= 0) { 79 - $build->reload(); 80 - if ($this->shouldAbort($build, $build_target)) { 81 - $future->resolveKill(); 82 - throw new HarbormasterBuildAbortedException(); 83 - } else { 84 - $build_update = 5; 85 - } 86 - } else { 87 - $build_update -= 1; 88 - } 89 - 90 - // Command is still executing. 91 - 92 - // Read more data as it is available. 93 - list($stdout, $stderr) = $future->read(); 94 - $log_stdout->append($stdout); 95 - $log_stderr->append($stderr); 96 - $future->discardBuffers(); 97 - } else { 98 - // Command execution is complete. 99 - 100 - // Get the return value so we can log that as well. 101 - list($err) = $future->resolve(); 102 - 103 - // Retrieve the last few bits of information. 104 - list($stdout, $stderr) = $future->read(); 105 - $log_stdout->append($stdout); 106 - $log_stderr->append($stderr); 107 - $future->discardBuffers(); 108 - 109 - break; 110 - } 111 - } 112 - 113 - $log_stdout->finalize($start_stdout); 114 - $log_stderr->finalize($start_stderr); 115 - 116 - if ($err) { 117 - throw new HarbormasterBuildFailureException(); 118 - } 119 - } 120 - 121 - public function getArtifactInputs() { 122 - return array( 123 - array( 124 - 'name' => pht('Run on Host'), 125 - 'key' => $this->getSetting('hostartifact'), 126 - 'type' => HarbormasterHostArtifact::ARTIFACTCONST, 127 - ), 128 - ); 129 - } 130 - 131 - public function getFieldSpecifications() { 132 - return array( 133 - 'command' => array( 134 - 'name' => pht('Command'), 135 - 'type' => 'text', 136 - 'required' => true, 137 - 'caption' => pht( 138 - "Under Windows, this is executed under PowerShell. ". 139 - "Under UNIX, this is executed using the user's shell."), 140 - ), 141 - 'hostartifact' => array( 142 - 'name' => pht('Host'), 143 - 'type' => 'text', 144 - 'required' => true, 145 - ), 146 - ); 147 - } 148 - 149 - }
-74
src/applications/harbormaster/step/HarbormasterLeaseHostBuildStepImplementation.php
··· 1 - <?php 2 - 3 - final class HarbormasterLeaseHostBuildStepImplementation 4 - extends HarbormasterBuildStepImplementation { 5 - 6 - public function getName() { 7 - return pht('Lease Host'); 8 - } 9 - 10 - public function getGenericDescription() { 11 - return pht('Obtain a lease on a Drydock host for performing builds.'); 12 - } 13 - 14 - public function getBuildStepGroupKey() { 15 - return HarbormasterPrototypeBuildStepGroup::GROUPKEY; 16 - } 17 - 18 - public function execute( 19 - HarbormasterBuild $build, 20 - HarbormasterBuildTarget $build_target) { 21 - 22 - $settings = $this->getSettings(); 23 - 24 - // Create the lease. 25 - $lease = id(new DrydockLease()) 26 - ->setResourceType('host') 27 - ->setOwnerPHID($build_target->getPHID()) 28 - ->setAttributes( 29 - array( 30 - 'platform' => $settings['platform'], 31 - )) 32 - ->queueForActivation(); 33 - 34 - // Wait until the lease is fulfilled. 35 - // TODO: This will throw an exception if the lease can't be fulfilled; 36 - // we should treat that as build failure not build error. 37 - $lease->waitUntilActive(); 38 - 39 - // Create the associated artifact. 40 - $artifact = $build_target->createArtifact( 41 - PhabricatorUser::getOmnipotentUser(), 42 - $settings['name'], 43 - HarbormasterHostArtifact::ARTIFACTCONST, 44 - array( 45 - 'drydockLeasePHID' => $lease->getPHID(), 46 - )); 47 - } 48 - 49 - public function getArtifactOutputs() { 50 - return array( 51 - array( 52 - 'name' => pht('Leased Host'), 53 - 'key' => $this->getSetting('name'), 54 - 'type' => HarbormasterHostArtifact::ARTIFACTCONST, 55 - ), 56 - ); 57 - } 58 - 59 - public function getFieldSpecifications() { 60 - return array( 61 - 'name' => array( 62 - 'name' => pht('Artifact Name'), 63 - 'type' => 'text', 64 - 'required' => true, 65 - ), 66 - 'platform' => array( 67 - 'name' => pht('Platform'), 68 - 'type' => 'text', 69 - 'required' => true, 70 - ), 71 - ); 72 - } 73 - 74 - }