mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-31 22:48:16 +02:00
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
This commit is contained in:
parent
b2116a8863
commit
0f355756f5
3 changed files with 30 additions and 8 deletions
|
@ -180,6 +180,7 @@ final class HarbormasterPlanViewController extends HarbormasterPlanController {
|
||||||
$plan,
|
$plan,
|
||||||
$step,
|
$step,
|
||||||
null);
|
null);
|
||||||
|
$available_artifacts = ipull($available_artifacts, 'type');
|
||||||
|
|
||||||
list($depends_ui, $has_conflicts) = $this->buildDependsOnList(
|
list($depends_ui, $has_conflicts) = $this->buildDependsOnList(
|
||||||
$depends,
|
$depends,
|
||||||
|
|
|
@ -46,7 +46,8 @@ final class HarbormasterBuildGraph extends AbstractDirectedGraph {
|
||||||
protected function loadEdges(array $nodes) {
|
protected function loadEdges(array $nodes) {
|
||||||
$map = array();
|
$map = array();
|
||||||
foreach ($nodes as $node) {
|
foreach ($nodes as $node) {
|
||||||
$deps = $this->stepMap[$node]->getDetail('dependsOn', array());
|
$step = $this->stepMap[$node];
|
||||||
|
$deps = $step->getStepImplementation()->getDependencies($step);
|
||||||
|
|
||||||
$map[$node] = array();
|
$map[$node] = array();
|
||||||
foreach ($deps as $dep) {
|
foreach ($deps as $dep) {
|
||||||
|
|
|
@ -99,7 +99,28 @@ abstract class HarbormasterBuildStepImplementation {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDependencies(HarbormasterBuildStep $build_step) {
|
public function getDependencies(HarbormasterBuildStep $build_step) {
|
||||||
return $build_step->getDetail('dependsOn', array());
|
$dependencies = $build_step->getDetail('dependsOn', array());
|
||||||
|
|
||||||
|
$inputs = $build_step->getStepImplementation()->getArtifactInputs();
|
||||||
|
$inputs = ipull($inputs, null, 'key');
|
||||||
|
|
||||||
|
$artifacts = $this->getAvailableArtifacts(
|
||||||
|
$build_step->getBuildPlan(),
|
||||||
|
$build_step,
|
||||||
|
null);
|
||||||
|
|
||||||
|
foreach ($artifacts as $key => $type) {
|
||||||
|
if (!array_key_exists($key, $inputs)) {
|
||||||
|
unset($artifacts[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$artifact_steps = ipull($artifacts, 'step');
|
||||||
|
$artifact_steps = mpull($artifact_steps, 'getPHID');
|
||||||
|
|
||||||
|
$dependencies = array_merge($dependencies, $artifact_steps);
|
||||||
|
|
||||||
|
return $dependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,6 +136,8 @@ abstract class HarbormasterBuildStepImplementation {
|
||||||
->withBuildPlanPHIDs(array($build_plan->getPHID()))
|
->withBuildPlanPHIDs(array($build_plan->getPHID()))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
|
$artifacts = array();
|
||||||
|
|
||||||
$artifact_arrays = array();
|
$artifact_arrays = array();
|
||||||
foreach ($steps as $step) {
|
foreach ($steps as $step) {
|
||||||
if ($current_build_step !== null &&
|
if ($current_build_step !== null &&
|
||||||
|
@ -124,19 +147,16 @@ abstract class HarbormasterBuildStepImplementation {
|
||||||
}
|
}
|
||||||
|
|
||||||
$implementation = $step->getStepImplementation();
|
$implementation = $step->getStepImplementation();
|
||||||
$artifact_arrays[] = $implementation->getArtifactOutputs();
|
$array = $implementation->getArtifactOutputs();
|
||||||
}
|
|
||||||
|
|
||||||
$artifacts = array();
|
|
||||||
foreach ($artifact_arrays as $array) {
|
|
||||||
$array = ipull($array, 'type', 'key');
|
$array = ipull($array, 'type', 'key');
|
||||||
foreach ($array as $name => $type) {
|
foreach ($array as $name => $type) {
|
||||||
if ($type !== $artifact_type && $artifact_type !== null) {
|
if ($type !== $artifact_type && $artifact_type !== null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$artifacts[$name] = $type;
|
$artifacts[$name] = array('type' => $type, 'step' => $step);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $artifacts;
|
return $artifacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue