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

Implement Build Plan behavior "Affects Buildable"

Summary: Ref T13258. Make the "Affects Buildable" option actually work.

Test Plan:
- As in previous change, created a "wait for HTTP request" build plan and had it always run against every revision.
- Created revisions, waited a bit, then sent the build a "Fail" message, with different values of "Affects Buildable":
- "Always": Same behavior as today. Buildable waited for the build, then failed when it failed.
- "While Building": Buildable waited for the build, but passed even though it failed (buildable has green checkmark even though build is red):

{F6250359}

- "Never": Buildable passed immediately (buildable has green checkmark even though build is still running):

{F6250360}

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13258

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

+33 -4
+24
src/applications/harbormaster/engine/HarbormasterBuildEngine.php
··· 497 497 // passed everything it needs to. 498 498 499 499 if (!$buildable->isPreparing()) { 500 + $behavior_key = HarbormasterBuildPlanBehavior::BEHAVIOR_BUILDABLE; 501 + $behavior = HarbormasterBuildPlanBehavior::getBehavior($behavior_key); 502 + 503 + $key_never = HarbormasterBuildPlanBehavior::BUILDABLE_NEVER; 504 + $key_building = HarbormasterBuildPlanBehavior::BUILDABLE_IF_BUILDING; 505 + 500 506 $all_pass = true; 501 507 $any_fail = false; 502 508 foreach ($buildable->getBuilds() as $build) { 509 + $plan = $build->getBuildPlan(); 510 + $option = $behavior->getPlanOption($plan); 511 + $option_key = $option->getKey(); 512 + 513 + $is_never = ($option_key === $key_never); 514 + $is_building = ($option_key === $key_building); 515 + 516 + // If this build "Never" affects the buildable, ignore it. 517 + if ($is_never) { 518 + continue; 519 + } 520 + 521 + // If this build affects the buildable "If Building", but is already 522 + // complete, ignore it. 523 + if ($is_building && $build->isComplete()) { 524 + continue; 525 + } 526 + 503 527 if (!$build->isPassed()) { 504 528 $all_pass = false; 505 529 }
+9 -4
src/applications/harbormaster/plan/HarbormasterBuildPlanBehavior.php
··· 22 22 const DRAFTS_IF_BUILDING = 'building'; 23 23 const DRAFTS_NEVER = 'never'; 24 24 25 + const BEHAVIOR_BUILDABLE = 'buildable'; 26 + const BUILDABLE_ALWAYS = 'always'; 27 + const BUILDABLE_IF_BUILDING = 'building'; 28 + const BUILDABLE_NEVER = 'never'; 29 + 25 30 public function setKey($key) { 26 31 $this->key = $key; 27 32 return $this; ··· 207 212 208 213 $aggregate_options = array( 209 214 id(new HarbormasterBuildPlanBehaviorOption()) 210 - ->setKey('always') 215 + ->setKey(self::BUILDABLE_ALWAYS) 211 216 ->setIcon('fa-check-circle-o green') 212 217 ->setName(pht('Always')) 213 218 ->setIsDefault(true) ··· 216 221 'The buildable waits for the build, and fails if the '. 217 222 'build fails.')), 218 223 id(new HarbormasterBuildPlanBehaviorOption()) 219 - ->setKey('building') 224 + ->setKey(self::BUILDABLE_IF_BUILDING) 220 225 ->setIcon('fa-pause-circle-o yellow') 221 226 ->setName(pht('If Building')) 222 227 ->setDescription( ··· 224 229 'The buildable waits for the build, but does not fail '. 225 230 'if the build fails.')), 226 231 id(new HarbormasterBuildPlanBehaviorOption()) 227 - ->setKey('never') 232 + ->setKey(self::BUILDABLE_NEVER) 228 233 ->setIcon('fa-circle-o red') 229 234 ->setName(pht('Never')) 230 235 ->setDescription( ··· 310 315 'this warning and continue, even if builds have failed.')) 311 316 ->setOptions($land_options), 312 317 id(new self()) 313 - ->setKey('buildable') 318 + ->setKey(self::BEHAVIOR_BUILDABLE) 314 319 ->setEditInstructions( 315 320 pht( 316 321 'The overall state of a buildable (like a commit or revision) is '.