Page MenuHomePhabricator

Add harbormaster.buildable.search API Method
ClosedPublic

Authored by jlinahan on Fri, Nov 16, 10:34 PM.

Details

Summary

This revision adds a Conduit search method for buildables. It exposes:

  • objectPHID
  • containerPHID
  • buildableStatus
  • isManual
Test Plan

Use the API Console to run searches. Example:

{
  "data": [
    {
      "id": 2,
      "type": "HMBB",
      "phid": "PHID-HMBB-m4k5lodx6naq22576a7d",
      "fields": {
        "objectPHID": "PHID-DIFF-vzvgqqcyscpd7ta4osy2",
        "containerPHID": "PHID-DREV-vsivs5276c7vtgpmssn2",
        "buildableStatus": {
          "value": "passed"
        },
        "isManual": true,
        "dateCreated": 1542407155,
        "dateModified": 1542407156,
        "policy": {
          "view": "users",
          "edit": "users"
        }
      },
      "attachments": {}
    },
    {
      "id": 1,
      "type": "HMBB",
      "phid": "PHID-HMBB-opxfl4auoz3ey5klplrx",
      "fields": {
        "objectPHID": "PHID-DIFF-vzvgqqcyscpd7ta4osy2",
        "containerPHID": null,
        "buildableStatus": {
          "value": "passed"
        },
        "isManual": false,
        "dateCreated": 1542406968,
        "dateModified": 1542406968,
        "policy": {
          "view": "users",
          "edit": "users"
        }
      },
      "attachments": {}
    }
  ],
  "maps": {},
  "query": {
    "queryKey": null
  },
  "cursor": {
    "limit": 100,
    "after": null,
    "before": null,
    "order": null
  }
}

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jlinahan created this revision.Fri, Nov 16, 10:34 PM
Owners added a subscriber: Restricted Owners Package.Fri, Nov 16, 10:34 PM
jlinahan requested review of this revision.Fri, Nov 16, 10:36 PM
epriestley requested changes to this revision.Sat, Nov 17, 1:06 AM

One minor tweak inline, but this looks good otherwise. Thanks!

src/applications/harbormaster/storage/HarbormasterBuildable.php
374

Make this a map<string, wild>...

387

...and this an array, like:

'buildableStatus' => array(
  'value' => $this->getBuildableStatus(),
),

See HarbormasterBuild for an example. This lets us add a name (human-readable, translatable name) too, and statuses tend to pick up other attributes sooner or later (like color.ansi for letting arc render the status without arc needing to know what all the possible values are).

(We could do this with a separate harbormaster.buildable.status.search but that's relatively cumbersome and just putting the data on the object feels like it strikes a better practical balance.)

This revision now requires changes to proceed.Sat, Nov 17, 1:06 AM
jlinahan updated this revision to Diff 47339.Mon, Nov 19, 10:39 PM

Put 'buildableStatus' into array

jlinahan edited the test plan for this revision. (Show Details)Mon, Nov 19, 10:40 PM
epriestley accepted this revision.Mon, Nov 19, 11:19 PM

Thanks! You're in Blessed Committers so you should be able to land this yourself (see that project description for some instructions). Let me know if you run into issues.

This revision is now accepted and ready to land.Mon, Nov 19, 11:19 PM
This revision was automatically updated to reflect the committed changes.

The initial "Land Revision" failed because the saux001.phacility.net device didn't get its address updated after it changed when AWS prompted it to cycle in T13207. This is rare and somewhat one-off so I just fixed the configuration and clicked the button again.