public static function initializeNewBuildTarget(HarbormasterBuild $build, HarbormasterBuildStep $build_step, array $variables)
 {
     return id(new HarbormasterBuildTarget())->setName($build_step->getName())->setBuildPHID($build->getPHID())->setBuildStepPHID($build_step->getPHID())->setClassName($build_step->getClassName())->setDetails($build_step->getDetails())->setTargetStatus(self::STATUS_PENDING)->setVariables($variables)->setBuildGeneration($build->getBuildGeneration());
 }
 private function releaseAllArtifacts(HarbormasterBuild $build)
 {
     $targets = id(new HarbormasterBuildTargetQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withBuildPHIDs(array($build->getPHID()))->withBuildGenerations(array($build->getBuildGeneration()))->execute();
     if (count($targets) === 0) {
         return;
     }
     $target_phids = mpull($targets, 'getPHID');
     $artifacts = id(new HarbormasterBuildArtifactQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withBuildTargetPHIDs($target_phids)->execute();
     foreach ($artifacts as $artifact) {
         $artifact->releaseArtifact();
     }
 }
 protected function shouldAbort(HarbormasterBuild $build, HarbormasterBuildTarget $target)
 {
     return $build->getBuildGeneration() !== $target->getBuildGeneration();
 }
 private function buildPropertyList(HarbormasterBuild $build)
 {
     $viewer = $this->getViewer();
     $properties = id(new PHUIPropertyListView())->setUser($viewer);
     $handles = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs(array($build->getBuildablePHID(), $build->getBuildPlanPHID()))->execute();
     $properties->addProperty(pht('Buildable'), $handles[$build->getBuildablePHID()]->renderLink());
     $properties->addProperty(pht('Build Plan'), $handles[$build->getBuildPlanPHID()]->renderLink());
     $properties->addProperty(pht('Restarts'), $build->getBuildGeneration());
     $properties->addProperty(pht('Status'), $this->getStatus($build));
     return id(new PHUIObjectBoxView())->setHeaderText(pht('Properties'))->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->appendChild($properties);
 }