Page MenuHomePhabricator

Add "Autoplans" to Harbormaster
ClosedPublic

Authored by epriestley on Jun 18 2015, 6:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 6:26 PM
Unknown Object (File)
Fri, Apr 12, 4:47 AM
Unknown Object (File)
Thu, Apr 11, 9:45 AM
Unknown Object (File)
Thu, Apr 11, 8:18 AM
Unknown Object (File)
Sun, Mar 31, 10:37 AM
Unknown Object (File)
Mar 18 2024, 6:44 PM
Unknown Object (File)
Feb 27 2024, 2:25 PM
Unknown Object (File)
Feb 22 2024, 8:13 AM
Tokens
"Love" token, awarded by joshuaspence."Love" token, awarded by hach-que.

Details

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:

  1. Add magic target PHIDs like PHID-MAGIC-this-is-really-arc-unit.
  2. 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.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Add "Autoplans" to Harbormaster.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.
This revision is now accepted and ready to land.Jun 18 2015, 7:53 PM

Actually I think more than just arc will use this; I can see it being used for things like "Run Build Plan" or "Embed Build Plan" where the target plan has template parameters. Through auto plans, we could probably instantiate the plan from the user defined auto plan. I know for us, this kind of instantiated build plan from template at runtime would drastically reduce the number of plans we have (from like 100+ probably down to like 10).

Right now, if you try to have created-by-Harbormaster builds create new autotargets they won't create with the correct build generation information, so that's one thing to watch out for if you try to do this more generally.

This revision was automatically updated to reflect the committed changes.