Problem we're trying to solve:
We're integrating 3rd party CI service (Travis) with Phabricator.
Travis works in following way:
- monitor the remote repo
- on every commit to a remote branch, check the .travis.yml file if the branch matches given regexp. If so, put a worker task in a queue
- once a task gets assigned to a worker, run the shell script defined in the configuration file
- if the script exits with code 0, assume tests passed, if exits with non-zero, assume tests failed.
The script is an arbitrary shell script, that we have 100% control over.
We'd like the Travis worker to pass the test results to Phabricator.
Currently, we have configured it in following way:
- whenever a user creates or updates a diff, we push a new branch to a remote repo
- Travis picks up the branch and spawns the tests
- simultaneously, using Herald, we hook up a Harbormaster build plan
- the build plan waits for a message from Travis worker before it finishes
Main problem: Travis worker need to get the PHID for the Build Target to report the test results using harbormaster.sendmessage call. The PHID is only available while executing the Build Step. There is no way to query for it using Conduit Harbormaster API.
We mitigate that by creating a paste, with PHID of the Build Target as a content. Then we use paste.query API to find the correct PHID. Obviously, this is a nasty hack, and we'd like to get rid of it. With introduction of differential.setdiffproperty, it's possible to store the PHID inside a travis-phid property using a HTTP request to Conduit. Unfortunately, Travis worker has no way to retrieve it.
One can fix it in several ways:
- Add an API to Harbormaster that allows to obtain the Build Target PHID,
- Use a 3rd party service that stores the PHID for us,
- Keep the PHID inside a diff properties, and allow the user to retrieve them.
FWIW, the API seems not intuitive for me: why does the user is able to set arbitrary properties via Conduit, if there is no way to get them back? Is exposing the API actually a hack, to achieve other goals?
OLD CONTENT
Reproduction steps:
- Add diff property using differential.setdiffproperty API
$ echo '{ "diff_id": 123, "name": "foo", "data": "\"bar\"" }' | arc call-conduit --conduit-uri https://secure.phabricator.com/ --conduit-token <conduit-token> differential.setdiffproperty
- Use differential.querydiffs to find the diff:
$ echo '{ "ids": [ 123 ] }' | arc call-conduit --conduit-uri https://secure.phabricator.com/ --conduit-token <conduit-token> differential.querydiffs
Expected result:
- The "foo": "bar" property should appear somewhere in the returned object
Actual result:
- There is no "foo": "bar" property anywhere in the object.
This can be fixed by either adding needProperties(true) here, or by creating a differential.getdiffproperties conduit API call.
This was mentioned in the last comment in T9334.
Affected version: 8a2afa14d24f3cc9feaefbf62e65e0a8f3cc5333