Gerrit technical documents
A Gerrit test instance is hosted at gerrit.devtools.wmflabs.org/. It runs the same code as the production Gerrit instance. This instance is used for learning how to use Gerrit, testing bots or scripts that make use of the Gerrit Rest API, etc.
Note: No real code review occurs on the test instance. Submit patches onto receive code review.
Setting up an account
To start using the test instance:
- First, register for an account
- To login:
- Browse to https://gerrit.devtools.wmflabs.org
- Click the sign-in button in the top-right
- Enter account details to log in
Submitting your changes
Cloning repo and URL
If the URL of the remote repository you would like to experiment with is known, it can be cloned by running the following command in your terminal:
git clone <URL>
Here is a full list of repositories: https://gerrit.devtools.wmflabs.org/r/admin/repos. To clone a repository from this list, click on its name, and run the
git clone command listed on the next page.
git clone https://gerrit.devtools.wmflabs.org/r/test11 git clone https://gerrit.devtools.wmflabs.org/r/test10 git clone https://gerrit.devtools.wmflabs.org/r/test9
Commit and push changes
Once you have committed your changes, you can push them to Gerrit using
git review. For details on installing and using git-review, check the Gerrit tutorial. If you have git-review installed, you can run:
git review -R
Alternatively, if the origin remote is a Gerrit link (which would be the case if you cloned a repository using the command listed here) you could run the following command to have your changes show up on Gerrit:
git push origin HEAD:refs/for/<branch-name>
Create your own Gerrit test instance
Before you do this; a reminder that it is MUCH easier to request access to the "devtools" project mentioned above (and to also use an existing instance).
The next alternative is to use the existing project but to request a separate instance.
The "prod" instance is meant to always stay like production, using the same puppet role, and not have permanent local hacks. For the testing of new features or puppet changes an instance called "stage/staging" should be used which might still have to be created.
There is a local puppetmaster in the devtools project so puppet changes can be tested without having to go through Gerrit merges. This also means we still want to go through puppet and not manually install packages or permanently live hack config files.
If you still really want a Gerrit instance in a different cloud project then you need to:
- create a new instance
- apply the puppet role(gerrit)
- copy all the relevant Hiera keys from puppet/hieradata/cloud/eqiad/devtools/common.yaml and ./devtools/hosts/ (Note this contains things for both Gerrit and Phabricator which the devtools project is for)
- request a floating IP
- add DNS records
- adjust Hiera values to your floating IP / service names
- add needed security groups for http(s) and ssh to 29418
- one-time manually run certbot to get TLS certs
- create or request a special user for deployment
- (maybe) create another instance with a local deployment servert to be able to deploy
- (maybe) create another instance with a local puppetmaster to be able to test things without having to go through Gerrit review