Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/engine/HarbormasterBuildEngine.php
Show First 20 Lines • Show All 491 Lines • ▼ Show 20 Lines | public function updateBuildable(HarbormasterBuildable $buildable) { | ||||
$old = clone $buildable; | $old = clone $buildable; | ||||
// Don't update the buildable status if we're still preparing builds: more | // Don't update the buildable status if we're still preparing builds: more | ||||
// builds may still be scheduled shortly, so even if every build we know | // builds may still be scheduled shortly, so even if every build we know | ||||
// about so far has passed, that doesn't mean the buildable has actually | // about so far has passed, that doesn't mean the buildable has actually | ||||
// passed everything it needs to. | // passed everything it needs to. | ||||
if (!$buildable->isPreparing()) { | if (!$buildable->isPreparing()) { | ||||
$behavior_key = HarbormasterBuildPlanBehavior::BEHAVIOR_BUILDABLE; | |||||
$behavior = HarbormasterBuildPlanBehavior::getBehavior($behavior_key); | |||||
$key_never = HarbormasterBuildPlanBehavior::BUILDABLE_NEVER; | |||||
$key_building = HarbormasterBuildPlanBehavior::BUILDABLE_IF_BUILDING; | |||||
$all_pass = true; | $all_pass = true; | ||||
$any_fail = false; | $any_fail = false; | ||||
foreach ($buildable->getBuilds() as $build) { | foreach ($buildable->getBuilds() as $build) { | ||||
$plan = $build->getBuildPlan(); | |||||
$option = $behavior->getPlanOption($plan); | |||||
$option_key = $option->getKey(); | |||||
$is_never = ($option_key === $key_never); | |||||
$is_building = ($option_key === $key_building); | |||||
// If this build "Never" affects the buildable, ignore it. | |||||
if ($is_never) { | |||||
continue; | |||||
} | |||||
// If this build affects the buildable "If Building", but is already | |||||
// complete, ignore it. | |||||
if ($is_building && $build->isComplete()) { | |||||
continue; | |||||
} | |||||
if (!$build->isPassed()) { | if (!$build->isPassed()) { | ||||
$all_pass = false; | $all_pass = false; | ||||
} | } | ||||
if ($build->isComplete() && !$build->isPassed()) { | if ($build->isComplete() && !$build->isPassed()) { | ||||
$any_fail = true; | $any_fail = true; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 95 Lines • Show Last 20 Lines |