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

Make artifacts imply dependencies on build steps

Summary: This makes input artifacts imply the appropriate build step dependencies in the build plan. That is, if you use a host artifact in a build step, it will then implicitly depend on the 'Lease Host' step.

Test Plan: Viewed the build plan with the artifacts, saw the dependencies. Ran a build, saw everything execute in the correct order.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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

+30 -8
+1
src/applications/harbormaster/controller/HarbormasterPlanViewController.php
··· 180 180 $plan, 181 181 $step, 182 182 null); 183 + $available_artifacts = ipull($available_artifacts, 'type'); 183 184 184 185 list($depends_ui, $has_conflicts) = $this->buildDependsOnList( 185 186 $depends,
+2 -1
src/applications/harbormaster/engine/HarbormasterBuildGraph.php
··· 46 46 protected function loadEdges(array $nodes) { 47 47 $map = array(); 48 48 foreach ($nodes as $node) { 49 - $deps = $this->stepMap[$node]->getDetail('dependsOn', array()); 49 + $step = $this->stepMap[$node]; 50 + $deps = $step->getStepImplementation()->getDependencies($step); 50 51 51 52 $map[$node] = array(); 52 53 foreach ($deps as $dep) {
+27 -7
src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php
··· 99 99 } 100 100 101 101 public function getDependencies(HarbormasterBuildStep $build_step) { 102 - return $build_step->getDetail('dependsOn', array()); 102 + $dependencies = $build_step->getDetail('dependsOn', array()); 103 + 104 + $inputs = $build_step->getStepImplementation()->getArtifactInputs(); 105 + $inputs = ipull($inputs, null, 'key'); 106 + 107 + $artifacts = $this->getAvailableArtifacts( 108 + $build_step->getBuildPlan(), 109 + $build_step, 110 + null); 111 + 112 + foreach ($artifacts as $key => $type) { 113 + if (!array_key_exists($key, $inputs)) { 114 + unset($artifacts[$key]); 115 + } 116 + } 117 + 118 + $artifact_steps = ipull($artifacts, 'step'); 119 + $artifact_steps = mpull($artifact_steps, 'getPHID'); 120 + 121 + $dependencies = array_merge($dependencies, $artifact_steps); 122 + 123 + return $dependencies; 103 124 } 104 125 105 126 /** ··· 115 136 ->withBuildPlanPHIDs(array($build_plan->getPHID())) 116 137 ->execute(); 117 138 139 + $artifacts = array(); 140 + 118 141 $artifact_arrays = array(); 119 142 foreach ($steps as $step) { 120 143 if ($current_build_step !== null && ··· 124 147 } 125 148 126 149 $implementation = $step->getStepImplementation(); 127 - $artifact_arrays[] = $implementation->getArtifactOutputs(); 128 - } 129 - 130 - $artifacts = array(); 131 - foreach ($artifact_arrays as $array) { 150 + $array = $implementation->getArtifactOutputs(); 132 151 $array = ipull($array, 'type', 'key'); 133 152 foreach ($array as $name => $type) { 134 153 if ($type !== $artifact_type && $artifact_type !== null) { 135 154 continue; 136 155 } 137 - $artifacts[$name] = $type; 156 + $artifacts[$name] = array('type' => $type, 'step' => $step); 138 157 } 139 158 } 159 + 140 160 return $artifacts; 141 161 } 142 162