ReleaseEngineering/Applications/BuildAPI: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(deleting obsolete page)
 
Line 1: Line 1:
includes self-serve, wait time reports, pending/running


== Source Code ==
http://hg.mozilla.org/build/buildapi
== Public Interfaces ==
https://secure.pub.build.mozilla.org/buildapi/ (requires LDAP account with try server commit access or better) <br />
https://secure-pub-build.allizom.org/buildapi/
== Current Setup ==
=== Buildapi host ===
NOTE: The production instance is managed by webops and is no longer running on buildapi01.build.mozilla.org as the 'buildapi' user.
There is a cron job that checks for new changes every 5 minutes and deploys them. This instance is exposed to the public behind LDAP auth via proxy from the build.m.o url.
=== Rabbitmq host ===
The buildapi instance communicates with a rabbitmq server on rabbit2.build.scl1.mozilla.com. It also connects to two read-only databases (schedulerdb, statusdb) on a slave mysql host maintained by IT.
=== Self-serve agent hosts ===
The self-serve agent, which is responsible for performing many of the job requests, is running on bm61, bm62, bm65, bm66 & bm81 (See [http://hg.mozilla.org/build/puppet/file/default/manifests/moco-nodes.pp moco-nodes.pp] for details) out of /builds/selfserve-agent. It is a long-running process that waits for messages from the rabbitmq server on cruncher (TODO: double check this), and then makes various DB modifications or pokes at masters' web interfaces. The self-serve agent is started via init, and monitored via nagios.
To modify the list of branches supported by buildapi and self-serve, read [[ReleaseEngineering/BuildAPI#Maintenance]]
== Informational Requests ==
As seen on the [https://secure.pub.build.mozilla.org/buildapi/self-serve SelfServe Interface]
Results are formatted according to the 'format' query parameter
("?format=html" or "?format=json").  If 'format' is not set, and the
'Accept' header of the request includes 'application/json', the format will
be set to json.  Otherwise the format will be html.
Will return HTTP 200 for successful queries, or HTTP 404 if a resource is
not found.
== Job Requests ==
As seen on the [https://secure.pub.build.mozilla.org/buildapi/self-serve SelfServe Interface]
PUT, POST, and DELETE requests (which can be faked by setting a '_method'
field to 'PUT' or 'DELETE' in a regular POST request if your client doesn't
support PUT/DELETE easiliy) represent requests to change buildbot state.
These are called "Job Requests".
Requests to these methods return a job status dictionary, which includes
the following keys:
    "status"    - "OK" or "FAILED"
    "msg"        - informational text
    "request_id" - the job request id.  You can find the status of the job
                  by visiting /self-serve/jobs/{job_id}.  This is only set for
                  successfull requests.
Job requests can return 202 (HTTP Accepted) if the request was accepted, or
503 (HTTP Service Unavailable) if there was an error.  In case of a 503
error, the request should be re-submitted at a later time.
Missing or bad parameters for the request type will result in a 400 error.
<table style="border: solid black 1px;">
<tr><th style="border: solid black 1px;">HTTP method</th><th style="border: solid black 1px;">Path</th><th style="border: solid black 1px;">Docs</th></tr>
<tr><td style="border: solid black 1px;">GET</td><td style="border: solid black 1px;">/self-serve</td><td style="border: solid black 1px;">Root of the API. You're looking at it!</td></tr>
<tr><td style="border: solid black 1px;">GET</td><td style="border: solid black 1px;">/self-serve/branches</td><td style="border: solid black 1px;">Return a list of all the branches</td></tr>
<tr><td style="border: solid black 1px;">GET</td><td style="border: solid black 1px;">/self-serve/jobs</td><td style="border: solid black 1px;">Return a list of past self-serve requests</td></tr>
<tr><td style="border: solid black 1px;">GET</td><td style="border: solid black 1px;">/self-serve/jobs/{job_id}</td><td style="border: solid black 1px;">Return information about a job request</td></tr>
<tr><td style="border: solid black 1px;">GET</td><td style="border: solid black 1px;">/self-serve/{branch}</td><td style="border: solid black 1px;">Return a list of builds running on this branch</td></tr>
<tr><td style="border: solid black 1px;">POST</td><td style="border: solid black 1px;">/self-serve/{branch}/build</td><td style="border: solid black 1px;">Rebuild `build_id`, which must be passed in as a POST parameter.<br/> <br/> `priority` is also accepted as an optional parameter.</td></tr>
<tr><td style="border: solid black 1px;">DELETE</td><td style="border: solid black 1px;">/self-serve/{branch}/build/{build_id}</td><td style="border: solid black 1px;">Cancel the given build</td></tr>
<tr><td style="border: solid black 1px;">GET</td><td style="border: solid black 1px;">/self-serve/{branch}/build/{build_id}</td><td style="border: solid black 1px;">Return information about a build</td></tr>
<tr><td style="border: solid black 1px;">GET</td><td style="border: solid black 1px;">/self-serve/{branch}/builders</td><td style="border: solid black 1px;">Return a list of valid builders for this branch</td></tr>
<tr><td style="border: solid black 1px;">POST</td><td style="border: solid black 1px;">/self-serve/{branch}/builders/{builder_name}/{revision}</td><td style="border: solid black 1px;">Creates a new arbitrary build/test for this buildername, for this revision.<br /> <br /> Optional POST parameters are 'properties' and 'files', which should be a dictionary and a list, respectively.</td></tr>
<tr><td style="border: solid black 1px;">POST</td><td style="border: solid black 1px;">/self-serve/{branch}/request</td><td style="border: solid black 1px;">Rebuild `request_id`, which must be passed in as a POST parameter.<br/> <br/> `priority` is also accepted as an optional parameter.</td></tr>
<tr><td style="border: solid black 1px;">DELETE</td><td style="border: solid black 1px;">/self-serve/{branch}/request/{request_id}</td><td style="border: solid black 1px;">Cancel the given request</td></tr>
<tr><td style="border: solid black 1px;">GET</td><td style="border: solid black 1px;">/self-serve/{branch}/request/{request_id}</td><td style="border: solid black 1px;">Return information about a request</td></tr>
<tr><td style="border: solid black 1px;">PUT</td><td style="border: solid black 1px;">/self-serve/{branch}/request/{request_id}</td><td style="border: solid black 1px;">Reprioritize the given request.<br/> <br/> Requires `priority` in the POST parameters.<br/> <br/> Higher priority values get handled first, and the default priority for<br/> jobs is 0.<br/> <br/> Returns a job status message.</td></tr>
<tr><td style="border: solid black 1px;">DELETE</td><td style="border: solid black 1px;">/self-serve/{branch}/rev/{revision}</td><td style="border: solid black 1px;">Cancels all running or pending builds on this revision</td></tr>
<tr><td style="border: solid black 1px;">GET</td><td style="border: solid black 1px;">/self-serve/{branch}/rev/{revision}</td><td style="border: solid black 1px;">Return a list of builds running for this revision</td></tr>
<tr><td style="border: solid black 1px;">POST</td><td style="border: solid black 1px;">/self-serve/{branch}/rev/{revision}</td><td style="border: solid black 1px;">Creates a new build at this revision</td></tr>
<tr><td style="border: solid black 1px;">GET</td><td style="border: solid black 1px;">/self-serve/{branch}/rev/{revision}/is_done</td><td style="border: solid black 1px;">Return a json dictionary with information about whether the job is<br/> done and has passed all tests for this revision</td></tr>
<tr><td style="border: solid black 1px;">POST</td><td style="border: solid black 1px;">/self-serve/{branch}/rev/{revision}/nightly</td><td style="border: solid black 1px;">Creates a new set of nightly builds at this revision.<br/> <br/> `priority` is optional, and if set should be an integer priority.</td></tr>
<tr><td style="border: solid black 1px;">POST</td><td style="border: solid black 1px;">/self-serve/{branch}/rev/{revision}/pgo</td><td style="border: solid black 1px;">Creates a new set of PGO builds at this revision.<br/> <br/> `priority` is optional, and if set should be an integer priority.</td></tr>
<tr><td style="border: solid black 1px;">GET</td><td style="border: solid black 1px;">/self-serve/{branch}/user/{user}</td><td style="border: solid black 1px;">Return a list of builds for this user</td></tr>
</table>
== Setup Instructions ==
Described at [[ReleaseEngineering/BuildAPI]]

Latest revision as of 21:49, 19 November 2018