Index: src/__phutil_library_map__.php =================================================================== --- src/__phutil_library_map__.php +++ src/__phutil_library_map__.php @@ -91,7 +91,6 @@ 'AphrontView' => 'view/AphrontView.php', 'AphrontWebpageResponse' => 'aphront/response/AphrontWebpageResponse.php', 'AuditActionMenuEventListener' => 'applications/audit/events/AuditActionMenuEventListener.php', - 'BuildStepImplementation' => 'applications/harbormaster/step/BuildStepImplementation.php', 'CelerityAPI' => 'infrastructure/celerity/CelerityAPI.php', 'CelerityPhabricatorResourceController' => 'infrastructure/celerity/CelerityPhabricatorResourceController.php', 'CelerityResourceController' => 'infrastructure/celerity/CelerityResourceController.php', @@ -104,6 +103,8 @@ 'ConduitAPIMethod' => 'applications/conduit/method/ConduitAPIMethod.php', 'ConduitAPIRequest' => 'applications/conduit/protocol/ConduitAPIRequest.php', 'ConduitAPIResponse' => 'applications/conduit/protocol/ConduitAPIResponse.php', + 'ConduitAPI_agent_Method' => 'applications/harbormaster/conduit/ConduitAPI_agent_Method.php', + 'ConduitAPI_agent_nextbuild_Method' => 'applications/harbormaster/conduit/ConduitAPI_agent_nextbuild_Method.php', 'ConduitAPI_arcanist_Method' => 'applications/arcanist/conduit/ConduitAPI_arcanist_Method.php', 'ConduitAPI_arcanist_projectinfo_Method' => 'applications/arcanist/conduit/ConduitAPI_arcanist_projectinfo_Method.php', 'ConduitAPI_audit_Method' => 'applications/audit/conduit/ConduitAPI_audit_Method.php', @@ -2199,7 +2200,6 @@ 'ReleephStatusFieldSpecification' => 'applications/releeph/field/specification/ReleephStatusFieldSpecification.php', 'ReleephSummaryFieldSpecification' => 'applications/releeph/field/specification/ReleephSummaryFieldSpecification.php', 'ReleephUserView' => 'applications/releeph/view/user/ReleephUserView.php', - 'SleepBuildStepImplementation' => 'applications/harbormaster/step/SleepBuildStepImplementation.php', 'SlowvoteEmbedView' => 'applications/slowvote/view/SlowvoteEmbedView.php', 'SlowvoteRemarkupRule' => 'applications/slowvote/remarkup/SlowvoteRemarkupRule.php', ), @@ -2320,6 +2320,8 @@ 0 => 'Phobject', 1 => 'PhabricatorPolicyInterface', ), + 'ConduitAPI_agent_Method' => 'ConduitAPIMethod', + 'ConduitAPI_agent_nextbuild_Method' => 'ConduitAPI_agent_Method', 'ConduitAPI_arcanist_Method' => 'ConduitAPIMethod', 'ConduitAPI_arcanist_projectinfo_Method' => 'ConduitAPI_arcanist_Method', 'ConduitAPI_audit_Method' => 'ConduitAPIMethod', @@ -4663,7 +4665,6 @@ 'ReleephStatusFieldSpecification' => 'ReleephFieldSpecification', 'ReleephSummaryFieldSpecification' => 'ReleephFieldSpecification', 'ReleephUserView' => 'AphrontView', - 'SleepBuildStepImplementation' => 'BuildStepImplementation', 'SlowvoteEmbedView' => 'AphrontView', 'SlowvoteRemarkupRule' => 'PhabricatorRemarkupRuleObject', ), Index: src/applications/harbormaster/conduit/ConduitAPI_agent_Method.php =================================================================== --- /dev/null +++ src/applications/harbormaster/conduit/ConduitAPI_agent_Method.php @@ -0,0 +1,13 @@ + 'optional string', + ); + } + + public function defineReturnType() { + return 'list'; + } + + public function defineErrorTypes() { + return array( + ); + } + + protected function execute(ConduitAPIRequest $request) { + return array( + "exists" => false, + "steps" => array()); + } +} Index: src/applications/harbormaster/controller/HarbormasterStepAddController.php =================================================================== --- src/applications/harbormaster/controller/HarbormasterStepAddController.php +++ src/applications/harbormaster/controller/HarbormasterStepAddController.php @@ -9,6 +9,9 @@ $this->id = $data['id']; } + /** + * @phutil-external-symbol class BuildStepImplementation + */ public function processRequest() { $request = $this->getRequest(); $viewer = $request->getUser(); Index: src/applications/harbormaster/controller/HarbormasterStepEditController.php =================================================================== --- src/applications/harbormaster/controller/HarbormasterStepEditController.php +++ src/applications/harbormaster/controller/HarbormasterStepEditController.php @@ -9,6 +9,9 @@ $this->id = idx($data, 'id'); } + /** + * @phutil-external-symbol class BuildStepImplementation + */ public function processRequest() { $request = $this->getRequest(); $viewer = $request->getUser(); Index: src/applications/harbormaster/step/BuildStepImplementation.php =================================================================== --- src/applications/harbormaster/step/BuildStepImplementation.php +++ /dev/null @@ -1,88 +0,0 @@ -setAncestorClass("BuildStepImplementation") - ->setConcreteOnly(true) - ->selectAndLoadSymbols(); - return ipull($symbols, 'name'); - } - - /** - * The name of the implementation. - */ - abstract public function getName(); - - /** - * The generic description of the implementation. - */ - public function getGenericDescription() { - return ''; - } - - /** - * The description of the implementation, based on the current settings. - */ - public function getDescription() { - return ''; - } - - /** - * Run the build step against the specified build. - */ - abstract public function execute(HarbormasterBuild $build); - - /** - * Gets the settings for this build step. - */ - public function getSettings() { - return $this->settings; - } - - /** - * Validate the current settings of this build step. - */ - public function validate() { - return true; - } - - /** - * Loads the settings for this build step implementation from the build step. - */ - public final function loadSettings(HarbormasterBuildStep $build_step) { - $this->settings = array(); - $this->validateSettingDefinitions(); - foreach ($this->getSettingDefinitions() as $name => $opt) { - $this->settings[$name] = $build_step->getDetail($name); - } - return $this->settings; - } - - /** - * Validates that the setting definitions for this implementation are valid. - */ - public final function validateSettingDefinitions() { - foreach ($this->getSettingDefinitions() as $name => $opt) { - if (!isset($opt['type'])) { - throw new Exception( - 'Setting definition \''.$name. - '\' is missing type requirement.'); - } - } - } - - /** - * Return an array of settings for this step implementation. - */ - public function getSettingDefinitions() { - return array(); - } -} Index: src/applications/harbormaster/step/SleepBuildStepImplementation.php =================================================================== --- src/applications/harbormaster/step/SleepBuildStepImplementation.php +++ /dev/null @@ -1,45 +0,0 @@ -getSettings(); - - return pht('Sleep for %s seconds.', $settings['seconds']); - } - - public function execute(HarbormasterBuild $build) { - $settings = $this->getSettings(); - - sleep($settings['seconds']); - } - - public function validateSettings() { - $settings = $this->getSettings(); - - if ($settings['seconds'] === null) { - return false; - } - if (!is_int($settings['seconds'])) { - return false; - } - return true; - } - - public function getSettingDefinitions() { - return array( - 'seconds' => array( - 'name' => 'Seconds', - 'description' => 'The number of seconds to sleep for.', - 'type' => BuildStepImplementation::SETTING_TYPE_INTEGER)); - } - -} Index: src/applications/harbormaster/storage/build/HarbormasterBuild.php =================================================================== --- src/applications/harbormaster/storage/build/HarbormasterBuild.php +++ src/applications/harbormaster/storage/build/HarbormasterBuild.php @@ -50,6 +50,15 @@ ->setBuildStatus(self::STATUS_INACTIVE); } + /** + * Create a remote representation of this build. + * + * @phutil-external-symbol class RemoteHarbormasterBuild + */ + public function createRemoteBuild() { + return new RemoteHarbormasterBuild(); + } + public function getConfiguration() { return array( self::CONFIG_AUX_PHID => true, Index: src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php =================================================================== --- src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php +++ src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php @@ -41,6 +41,9 @@ return $this; } + /** + * @phutil-external-symbol class BuildStepImplementation + */ public function getStepImplementation() { if ($this->className === null) { throw new Exception("No implementation set for the given step."); Index: src/applications/harbormaster/worker/HarbormasterBuildWorker.php =================================================================== --- src/applications/harbormaster/worker/HarbormasterBuildWorker.php +++ src/applications/harbormaster/worker/HarbormasterBuildWorker.php @@ -44,7 +44,7 @@ $build->setBuildStatus(HarbormasterBuild::STATUS_ERROR); break; } - $implementation->execute($build); + $implementation->execute($build->createRemoteBuild()); if ($build->getBuildStatus() !== HarbormasterBuild::STATUS_BUILDING) { break; }