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

Don't let autoplans be run manually

Summary: Ref T8096. Like stop/start, autoplans are pushed into the system from outside (normally by `arc`) so it doesn't make any sense to run them manually.

Test Plan:
- Tried to run an autoplan from web UI, got an error.
- Ran a normal plan from web UI.
- Tried to run an autoplan from CLI, got an error.
- Ran a noraml plan from CLI.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8096

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

+26 -2
+9 -1
src/applications/harbormaster/controller/HarbormasterPlanRunController.php
··· 22 22 return new Aphront404Response(); 23 23 } 24 24 25 + $cancel_uri = $this->getApplicationURI("plan/{$plan_id}/"); 26 + 27 + if (!$plan->canRunManually()) { 28 + return $this->newDialog() 29 + ->setTitle(pht('Can Not Run Plan')) 30 + ->appendParagraph(pht('This plan can not be run manually.')) 31 + ->addCancelButton($cancel_uri); 32 + } 33 + 25 34 $e_name = true; 26 35 $v_name = null; 27 36 ··· 65 74 } 66 75 67 76 $title = pht('Run Build Plan Manually'); 68 - $cancel_uri = $this->getApplicationURI("plan/{$plan_id}/"); 69 77 $save_button = pht('Run Plan Manually'); 70 78 71 79 $form = id(new PHUIFormLayoutView())
+3 -1
src/applications/harbormaster/controller/HarbormasterPlanViewController.php
··· 289 289 ->setIcon('fa-ban')); 290 290 } 291 291 292 + $can_run = ($has_manage && $plan->canRunManually()); 293 + 292 294 $list->addAction( 293 295 id(new PhabricatorActionView()) 294 296 ->setName(pht('Run Plan Manually')) 295 297 ->setHref($this->getApplicationURI("plan/run/{$id}/")) 296 298 ->setWorkflow(true) 297 - ->setDisabled(!$has_manage) 299 + ->setDisabled(!$can_run) 298 300 ->setIcon('fa-play-circle')); 299 301 300 302 return $list;
+5
src/applications/harbormaster/management/HarbormasterManagementBuildWorkflow.php
··· 64 64 pht('Build plan "%s" does not exist.', $plan_id)); 65 65 } 66 66 67 + if (!$plan->canRunManually()) { 68 + throw new PhutilArgumentUsageException( 69 + pht('This build plan can not be run manually.')); 70 + } 71 + 67 72 $console = PhutilConsole::getConsole(); 68 73 69 74 $buildable = HarbormasterBuildable::initializeNewBuildable($viewer)
+9
src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php
··· 85 85 } 86 86 87 87 88 + public function canRunManually() { 89 + if ($this->isAutoplan()) { 90 + return false; 91 + } 92 + 93 + return true; 94 + } 95 + 96 + 88 97 public function getName() { 89 98 $autoplan = $this->getAutoplan(); 90 99 if ($autoplan) {