ReleaseEngineering/Applications/Mapper: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Updated to reflect completion of bug 1174215)
m (fix off by one error)
Line 61: Line 61:
= API methods =
= API methods =


Below is a summary of the 3 unauthenticated API methods currently usable, together with example urls from the production environment.
Below is a summary of the 4 unauthenticated API methods currently usable, together with example urls from the production environment.


For fuller details, and endpoints requiring authentication, the in process documentation is authoritative: [https://api.pub.build.mozilla.org/docs/usage/mapper/ production] or [https://api-pub-build.allizom.org/docs/usage/mapper/ staging] instances.
For fuller details, and endpoints requiring authentication, the in process documentation is authoritative: [https://api.pub.build.mozilla.org/docs/usage/mapper/ production] or [https://api-pub-build.allizom.org/docs/usage/mapper/ staging] instances.

Revision as of 15:28, 1 September 2015

What is it?

When we convert hg repositories to git, and vice versa, the hg changeset SHA (the 40 character hexadecimal string that you get when you commit a change) is different to the git commit id (the equivalent SHA used by git).

In order to keep track of which hg changeset SHAs relate to which git commit SHAs, we keep a database of the mappings, together with details about the project the SHAs come from, and what time they were inserted into the database.

The vcs sync tool (checked into mozharness) is the tool which performs the conversion between hg repos and git repos, and this is documented separately. It is responsible for performing the conversion - this is outside the scope of mapper.

Mapper is a rest api, that allows:

  1. insertion of new mappings and projects (a "project" is essentially the name of the repo - e.g. build-tools) (HTTP POST)
  2. insertion of git/hg mappings for a given project (HTTP POST)
  3. retrieval of mappings for a given project (HTTP GET)

Behind the scenes, it is reading/writing from the database (using sqlalchemy).

Note: the vcs sync tool is a client of the mapper: it is vcs sync that inserts into mapper (i.e. uses the HTTP POST methods). The other clients of mapper will be:

  1. people / developers - wanting to query mappings
  2. b2g_build.py - the build script for b2g - since this needs to lookup shas in order to reference frozen commit versions in manifests

Mapper is written as a RelEng API blueprint - please note RelEng API has its own documentation too.

Source

mapper's source is currently hosted at https://github.com/mozilla/build-mapper

Old Mapper Deployment

Until the "New Mapper" goes live, this is the information about the "old mapper" (which is being superceded).

mapper only requires bottle to run. It's recommended to run inside a virtual environment

Our current production deployment of mapper lives on cruncher under /home/buildduty/mapper. It listens locally on port 8888 (specified in mapper/app.py). The apache instance on cruncher is configured to forward requests to http://cruncher/mapper/* to http://locahost:8888/* (configured in /etc/httpd/conf/httpd.conf)

The mapper process is managed by supervisord which will ensure it is started up if the machine is ever rebooted, or if the process crashes. (configured in /etc/supervisord.conf)

Source is available at https://github.com/catlee/mapper

New Mapper Deployment

The new mapper is a Releng API blueprint, and so the details about how to deploy locally for development, and where the staging/production environments are, can be seen in the RelEngAPI documentation.

Old Mapper Data Feed

This section describes (roughly) how vcs-sync provides the map files served by mapper.

The map files are generated and combined on the vcs-sync machines, then pulled onto cruncher and used by `mapper`. See the source and docs for vcs-sync for more details. (Especially the mapper support section.)

mapper expects hggit map files to be available under the 'mapfiles' directory of the application. On cruncher, these are in /home/buildduty/mapper/mapfiles. Each subdirectory of mapfiles corresponds loosely to a different repository being tracked. On cruncher, the mapfiles for each of these projects are symlinked to the mapfiles being published to cruncher via the process outlined above.

Legacy vcs-sync provides mapfile information for the following repository groupings. (These can be seen via "ls */mapfile-needed" in the legacy configs directory.)

  • git -> hg from gaia.git code to integration/* (11 repositories configured)
  • hg -> git for gaia L10N (75 repositories configured)
  • hg -> git for gecko L10N (50 repositories configured)
  • hg -> git for gecko.git (15 repositories configured - from releases-gecko/hgrc)

Note that the above docs will be integrated into the wiki after vcs-sync development stabilizes.

New Mapper Data Feed

VCS Sync is making HTTP Post requests to mapper, providing new mappings for mapper to insert into its database.

API methods

Below is a summary of the 4 unauthenticated API methods currently usable, together with example urls from the production environment.

For fuller details, and endpoints requiring authentication, the in process documentation is authoritative: production or staging instances.

GET Routes

Returns a mapping pair

Returns full mapfile for a given project

Returns a subset of a mapfile, since a given date

Returns list of projects

Staging

The staging environment is available under https://api-pub-build.allizom.org/mapper