Phabricator projects map
[ Stories and projects ]
Phabricator publishes 'stories', which are events with textual and
references description, like a new task or a project rename.
To route a notification for a story, we need to know the projects
which are concerned. We then can sort these projects as groups.
For example, for our Nasqueron DevCentral instance, we want Servers,
Docker images, NasqDDS to go to the 'operations' group.
The stories will offer reference to objects, so we can query the
API to get more information. If we do so, we'll get the list of
projects, but reprented as phid.
As this list is pretty stable, to avoid a third request to get
projects name, we store the projects map in a cache.
[ Implementation ]
Projects maps are instance of ProjectMap class. The maps are stored
in cache, with keys starting by 'ProjectsMap-', followed by the MD5
of the Phabricator instance root URL. This allows to support multiple
instances.
To regenerate caches you can use the following artisan command:
php artisan phabricator:projectsmap
To fetch projects from Phabricator, we use the Conduit API, with an
API token. This requires CURL.
[ How to add an instance ? ]
It should be provided to the Gate credentials.json file:
{ "services": [ ..., { "gate": "Phabricator", "door": "Nasqueron", "instance: "https://devcentral.nasqueron.org", "secret": "api-ufgbczezppqiusmdmsj3orv73o4l" } ] }
The token can be generated at .../settings/panel/apitokens/.