Repositories and Relevant Code¶
Most code related to version control syncing is in the version-control-tools repo. In this repository, the following directories are relevant:
- Ansible role for version control sync server.
- Sphinx documentation for everything related to version control synchronization (you are reading this now).
- Python package containing code and services for everything related to version control synchronization.
Code reviews for everything in version-control-tools should be conducted
with Phabricator. Reviews should be directed at
Terraform configs for AWS infrastructure for VCS Sync lives in the
specifically in the
vcssync directory. Change proposals are submitted
via GitHub Pull Requests. Reviews are typically handled by someone
on the Ops Team, namely
dhouse. For new
glob should likely take a look.
Creating a Development and Testing Environment¶
From a fresh
version-control-tools checkout, run the following to create
a development and testing environment:
$ ./create-environment vcssync
Then activate the environment in your shell via:
$ source activate venv/vcssync/bin/activate
To run the vcssync tests, run:
Using Betamax for HTTP Request Replaying¶
We use the Betamax Python package to facilitate testing HTTP requests against various services, such as the GitHub API.
variables are defined, Betamax is configured to use the cassette
(recording of HTTP interactions) specified. Betamax’s record mode is
none, which means that only HTTP interactions saved in the
cassette are allowed.
vcssync/tests/record_cassettes.py script is used to record
cassettes (read: perform actual interactions with real servers and
save the results). Run this script from an activated virtualenv to
create/update/re-record cassettes. Minor changes in the cassettes
(such as dates and request IDs) are expected to change. Other things
may change over time and changes should be scrutinized during review.
record_cassettes.py requires a GitHub API token. Go to
https://github.com/settings/tokens/new to generate one. It should only
need minimal privileges. While the cassettes shouldn’t save your token,
it is a good practice to delete the token once you’re done recording