1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-21 09:48:47 +02:00
phorge-phorge/src/applications/differential
epriestley 76194a0dc1 Add "Autoplans" to Harbormaster
Summary:
Ref T8095. Two general problems:

  - I want Harbormaster to own all lint and unit test results.
  - I don't want users to have to configure anything for `arc` to keep working automatically.

These are in conflict because generic lint/unit test ownership in Harbormaster requires that build targets exist which we can attach build results to. However, we can't currently create build targets on demand: Harbormaster assumes it is responsible for creating targets, then running code or making third-party service calls to actually run the builds.

I considered two broad approaches to let `arc` push results into Harbormaster without requiring administrators to configure some kind of "arc results" build plan:

  # Add magic target PHIDs like `PHID-MAGIC-this-is-really-arc-unit`.
  # Add new code to build real targets with real PHIDs.

(1) is probably a bit less work to get off the ground, but I think it's worse overall and very likely to create more problems in the long run. I particularly worry that it will lead to a small amount of special casing in a very large number of places, which seems more fragile.

(2) is more work upfront but I think does a better job of putting all the special casing in one place that we can, e.g., more reasonably unit test, and letting the rest of the code rarely/never care about this case since it's just dealing with normal plans/steps/targets as far as it can tell.

This diff introduces "autoplans", which are source templates for plans/steps. This let us "push" these targets into Harbormaster. Hypthetically, any process "like" arc can use autoplans to upload test/lint/etc results. In practice, probably only `arc` will ever use this, but I think it's still quite a bit cleaner than the alternative despite all the generality.

Workflow is basically:

  - `arc` creates a diff.
  - `arc` calls `harbormaster.queryautotargets`, passing the diff PHID and saying "I have some lint and unit results I want to stick on this thing".
  - Harbormaster builds the plan, steps, and targets (if any of them don't already exist), and hands back the target PHIDs so `arc` has a completely standard-looking place to put results.
  - `arc` uploads the test results to the right targets, as though Harbormaster had asked it to run unit/lint in the first place.

(This doesn't actually do any of that yet, just sets things up.)

I'll maybe doc turn that ^^^^^^ into a doc for posterity since I think it's hard to guess what an "autotarget" is, but I'm going to grab some lunch first.

Test Plan:
  - Added unit tests to make sure we can build these things properly.
  - Used `harbormaster.queryautotargets` to build autotargets for a bunch of diffs.
  - Verified targets come up in "waiting for message" state.
  - Verified plans and steps are not editable.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: hach-que, epriestley

Maniphest Tasks: T8095

Differential Revision: https://secure.phabricator.com/D13345
2015-06-21 09:04:21 -07:00
..
__tests__ phtize all the things 2015-05-22 21:16:39 +10:00
application Add a "template" parameter to application default policies 2015-06-11 13:25:30 -07:00
capability Simplify the implementation of PhabricatorPolicyCapability subclasses 2014-07-25 08:25:42 +10:00
command Generate mail command documentation from active commands 2015-04-01 11:51:47 -07:00
conduit phtize all the things 2015-05-22 21:16:39 +10:00
config Separate "Revision" and "Diff" fields in Differential 2015-06-16 08:53:40 -07:00
constants Extend from Phobject 2015-06-15 18:02:27 +10:00
controller Separate "Revision" and "Diff" fields in Differential 2015-06-16 08:53:40 -07:00
customfield Separate "Revision" and "Diff" fields in Differential 2015-06-16 08:53:40 -07:00
doorkeeper Partially modernize Doorkeeper/Asana bridge 2014-10-01 07:09:34 -07:00
edge Don't write inverse edges for DifferentialRevisionHasReviewerEdgeType 2015-01-04 10:07:56 +11:00
editor Use standard subscribers effects in Herald Adapter for revisions 2015-06-08 10:32:08 -07:00
event Remove implode_selected_handle_links() 2015-03-31 05:48:20 -07:00
exception Remove an unused class 2015-01-03 09:07:32 +11:00
garbagecollector Complete modularization of the GC daemon 2014-01-15 10:02:31 -08:00
landing Extend from Phobject 2015-06-15 18:02:27 +10:00
lipsum phtize all the things 2015-05-22 21:16:39 +10:00
mail phtize all the things 2015-05-22 21:16:39 +10:00
management Remove break from hunk migration 2015-06-15 08:32:08 +10:00
parser Extend from Phobject 2015-06-15 18:02:27 +10:00
phid Separate handle "status" and "availability" 2015-05-14 11:14:44 -07:00
query Add "Autoplans" to Harbormaster 2015-06-21 09:04:21 -07:00
remarkup Rename PhutilRemarkupRule subclasses 2014-08-05 00:55:43 +10:00
render Extend from Phobject 2015-06-15 18:02:27 +10:00
search phtize all the things 2015-05-22 21:16:39 +10:00
storage Add "Autoplans" to Harbormaster 2015-06-21 09:04:21 -07:00
view Extend from Phobject 2015-06-15 18:02:27 +10:00
DifferentialGetWorkingCopy.php Extend from Phobject 2015-06-15 18:02:27 +10:00