Index: src/applications/harbormaster/controller/HarbormasterPlanViewController.php =================================================================== --- src/applications/harbormaster/controller/HarbormasterPlanViewController.php +++ src/applications/harbormaster/controller/HarbormasterPlanViewController.php @@ -37,7 +37,7 @@ ->setTransactions($xactions) ->setMarkupEngine($engine); - $title = pht("Plan %d", $id); + $title = pht("Plan %d: %s", $id, $plan->getName()); $header = id(new PHUIHeaderView()) ->setHeader($title) Index: src/applications/harbormaster/controller/HarbormasterStepEditController.php =================================================================== --- src/applications/harbormaster/controller/HarbormasterStepEditController.php +++ src/applications/harbormaster/controller/HarbormasterStepEditController.php @@ -108,6 +108,20 @@ ->setValue($value) ->setOptions($options); break; + case BuildStepImplementation::SETTING_TYPE_BUILDABLE_TYPE: + $control = id(new AphrontFormCheckboxControl()) + ->setLabel($this->getReadableName($name, $opt)) + ->addCheckbox( + 'commit', + 'PhabricatorRepositoryCommit', + 'Commits', + in_array('commit', $value)) + ->addCheckbox( + 'revision', + 'DifferentialRevision', + 'Differential Revisions', + in_array('revision', $value)); + break; default: throw new Exception("Unable to render field with unknown type."); } @@ -171,6 +185,16 @@ case BuildStepImplementation::SETTING_TYPE_BOOLEAN: return $request->getBool($name); break; + case BuildStepImplementation::SETTING_TYPE_BUILDABLE_TYPE: + $values = array(); + if ($request->getStr('commit') !== null) { + $values[] = 'commit'; + } + if ($request->getStr('revision') !== null) { + $values[] = 'revision'; + } + return $values; + break; default: throw new Exception("Unsupported setting type '".$type."'."); } Index: src/applications/harbormaster/step/BuildStepImplementation.php =================================================================== --- src/applications/harbormaster/step/BuildStepImplementation.php +++ src/applications/harbormaster/step/BuildStepImplementation.php @@ -8,6 +8,7 @@ const SETTING_TYPE_INTEGER = 'integer'; const SETTING_TYPE_BOOLEAN = 'boolean'; const SETTING_TYPE_ARTIFACT = 'artifact'; + const SETTING_TYPE_BUILDABLE_TYPE = 'buildabletype'; public static function getImplementations() { $symbols = id(new PhutilSymbolLoader()) Index: src/applications/harbormaster/step/PublishFragmentBuildStepImplementation.php =================================================================== --- src/applications/harbormaster/step/PublishFragmentBuildStepImplementation.php +++ src/applications/harbormaster/step/PublishFragmentBuildStepImplementation.php @@ -14,8 +14,24 @@ public function getDescription() { $settings = $this->getSettings(); + $values = array(); + $publish = $settings['publish_on']; + $publish_text = ''; + if (in_array("commit", $publish)) { + $values[] = pht('commits'); + } + if (in_array("revision", $publish)) { + $values[] = pht('differential revisions'); + } + if (count($values) === 0) { + $publish_text = pht('Never'); + } else { + $publish_text = pht('For %s,', implode(' and ', $values)); + } + return pht( - 'Publish file artifact \'%s\' to the fragment path \'%s\'.', + '%s publish file artifact \'%s\' to the fragment path \'%s\'.', + $publish_text, $settings['artifact'], $settings['path']); } @@ -27,6 +43,21 @@ $settings = $this->getSettings(); $variables = $build_target->getVariables(); + // Check if we should publish for this buildable. + $buildable = $build->getBuildable(); + $object = $buildable->getBuildableObject(); + if ($object instanceof PhabricatorRepositoryCommit) { + if (!in_array("commit", $settings["publish_on"])) { + return; + } + } elseif ($object instanceof DifferentialDiff) { + if (!in_array("revision", $settings["publish_on"])) { + return; + } + } else { + throw new Exception("Unknown buildable type!"); + } + $path = $this->mergeVariables( 'vsprintf', $settings['path'], @@ -85,7 +116,12 @@ 'description' => 'The file artifact that will be published to Phragment.', 'type' => BuildStepImplementation::SETTING_TYPE_ARTIFACT, - 'artifact_type' => HarbormasterBuildArtifact::TYPE_FILE)); + 'artifact_type' => HarbormasterBuildArtifact::TYPE_FILE), + 'publish_on' => array( + 'name' => 'Publish On', + 'description' => + 'The types of buildables that this step should activate for.', + 'type' => BuildStepImplementation::SETTING_TYPE_BUILDABLE_TYPE)); } }