Differential D16324 Diff 39292 src/applications/harbormaster/controller/HarbormasterPlanViewController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/controller/HarbormasterPlanViewController.php
Show First 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | $can_edit = PhabricatorPolicyFilter::hasCapability( | ||||
$plan, | $plan, | ||||
PhabricatorPolicyCapability::CAN_EDIT); | PhabricatorPolicyCapability::CAN_EDIT); | ||||
$step_list = id(new PHUIObjectItemListView()) | $step_list = id(new PHUIObjectItemListView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->setNoDataString( | ->setNoDataString( | ||||
pht('This build plan does not have any build steps yet.')); | pht('This build plan does not have any build steps yet.')); | ||||
// Check if all build steps are valid first. | |||||
$all_build_steps_valid = true; | |||||
foreach ($steps as $phid => $step) { | |||||
try { | |||||
$step->getStepImplementation(); | |||||
continue; | |||||
} catch (Exception $ex) { | |||||
$all_build_steps_valid = false; | |||||
break; | |||||
} | |||||
} | |||||
$i = 1; | $i = 1; | ||||
$last_depth = 0; | $last_depth = 0; | ||||
$has_any_conflicts = false; | $has_any_conflicts = false; | ||||
$is_deadlocking = false; | $is_deadlocking = false; | ||||
foreach ($run_order as $run_ref) { | foreach ($run_order as $run_ref) { | ||||
$step = $steps[$run_ref['node']->getPHID()]; | $step = $steps[$run_ref['node']->getPHID()]; | ||||
$depth = $run_ref['depth'] + 1; | $depth = $run_ref['depth'] + 1; | ||||
if ($last_depth !== $depth) { | if ($last_depth !== $depth) { | ||||
Show All 22 Lines | foreach ($run_order as $run_ref) { | ||||
$item | $item | ||||
->setStatusIcon('fa-warning red') | ->setStatusIcon('fa-warning red') | ||||
->addAttribute(pht( | ->addAttribute(pht( | ||||
'This step has an invalid implementation (%s).', | 'This step has an invalid implementation (%s).', | ||||
$step->getClassName())); | $step->getClassName())); | ||||
continue; | continue; | ||||
} | } | ||||
$item->addAttribute($implementation->getDescription()); | if (!$all_build_steps_valid) { | ||||
$item->setHref($view_uri); | // We can't calculate dependencies if another plan is missing | ||||
// an implementation. Handle this scenario gracefully. | |||||
$item | |||||
->setStatusIcon('fa-warning red') | |||||
->addAttribute(pht( | |||||
'Unable to calculate dependencies because steps are invalid.')); | |||||
continue; | |||||
} | |||||
$depends = $step->getStepImplementation()->getDependencies($step); | $depends = $step->getStepImplementation()->getDependencies($step); | ||||
$inputs = $step->getStepImplementation()->getArtifactInputs(); | $inputs = $step->getStepImplementation()->getArtifactInputs(); | ||||
$outputs = $step->getStepImplementation()->getArtifactOutputs(); | $outputs = $step->getStepImplementation()->getArtifactOutputs(); | ||||
yelirekim: `PhutilMissingSymbolException` is probably scoped better for this specific problem. | |||||
Not Done Inline ActionsShould read "if another step", rather than "if another plan" yelirekim: Should read "if another //step//", rather than "if another plan" | |||||
$item->addAttribute($implementation->getDescription()); | |||||
Not Done Inline ActionsMoving this prevents a double up on the build step when the error is being rendered. hach-que: Moving this prevents a double up on the build step when the error is being rendered. | |||||
$item->setHref($view_uri); | |||||
$has_conflicts = false; | $has_conflicts = false; | ||||
if ($depends || $inputs || $outputs) { | if ($depends || $inputs || $outputs) { | ||||
$available_artifacts = | $available_artifacts = | ||||
HarbormasterBuildStepImplementation::getAvailableArtifacts( | HarbormasterBuildStepImplementation::getAvailableArtifacts( | ||||
$plan, | $plan, | ||||
$step, | $step, | ||||
null); | null); | ||||
$available_artifacts = ipull($available_artifacts, 'type'); | $available_artifacts = ipull($available_artifacts, 'type'); | ||||
▲ Show 20 Lines • Show All 294 Lines • Show Last 20 Lines |
PhutilMissingSymbolException is probably scoped better for this specific problem.