How to deploy current master branch of an extension
This page was last updated in 2015 and may be outdated. Please update it if you can.
The following instructions are for deploying the current master branch of an extension to production. Normally, you would not do this. Normally, you would wait for a deployment branch to be cut and deployed along with the rest of MediaWiki each week, or you would cherry-pick individual changes from the master branch and apply them to an existing deployment branch. This procedure is risky and you should only do it if you are sure this is what you need to do.
Test current master against deployment branches of core
The main risk in doing this procedure is accidentally pushing an extension change that depends on an undeployed change in core (or in a different extension). First, ask the developers who have recently been working on the extension if they have made any recent changes that depend on changes outside of the extension. If so, don't use this procedure. Next, do a check yourself just to make sure there are no obvious problems. For whichever deployment groups you are deploying the extension to, check out the deployment branches currently deployed to those groups and test them against current master of your extension. For example, if you are deploying current master of the MyCoolExtension extension to Test Wikipedia (group 0), and Test Wikipedia is currently running deployment branch wmf/1.20wmf1 of core, you would do the following on your local machine:
$ cd mediawiki/core # go to your checkout of mediawiki/core.git # Set up a local wmf/1.20wmf1 branch that tracks the remote # You only need to do this once for each branch; if you've already got a wmf/1.20wmf1 branch, you can skip this step $ git branch --track wmf/1.20wmf1 origin/wmf/1.20wmf1 Branch wmf/1.20wmf1 set up to track remote branch wmf/1.20wmf1 from origin. # Switch to the wmf/1.20wmf1 branch and update it from the remote $ git checkout wmf/1.20wmf1 $ git pull # Switch the extension to the master branch and update it from the remote $ cd extensions/MyCoolExtension $ git checkout master $ git pull
Now load your local Wikipedia in a browser and make sure it is still working properly. You'll especially want to test any recent changes to the extension and make sure they are working as expected. If they aren't, switch to using the regular deployment procedure. If your extension is tightly coupled to another extension, you'll want to test against the deployment branches of that extension as well.
Create a back-up of the extension deployment branch
First, you'll want to create a back-up of the extension deployment branch that you're going to be deploying. To do this, go to the list of projects in Gerrit, enter the name of your extension in the Filter input, and then click on the name of your extension once it is displayed. Next, click on the 'Branches' link in the header. This will show you all of the branches that currently exist for your extension. Find the deployment branch that you are going to be deploying, for example, wmf/1.20wmf1. Copy the revision hash shown next to the branch name. Next, go to the form at the bottom. Give your back-up branch a name, for example, 'wmf/1.20wmf1-bak', paste the revision hash that you copied earlier into the input for the Initial Revision, and click 'Create Branch'.
Create a new extension deployment branch based on master
Next, you will delete the existing deployment branch (for example, wmf/1.20wmf1) by clicking the checkbox next to it and clicking 'Delete'. After it is deleted, you will recreate it, but using the revision hash of the current master branch. To do this, copy the revision hash next to 'master', go to the form at the bottom of the page, enter the name of the deployment branch as the Branch Name (for example, 'wmf/1.20wmf1'), paste in the hash as the Initial Revision, and click 'Create Branch'.
Deploy the new deployment branch
Once you have created the new deployment branch based on master, you will follow the regular deployment procedures (update the submodule and push the code to tin). If there is a problem with the deployment and you need to roll-back, you can go into the extension's directory on tin and checkout the last known good revision, which will usually be the revision hash of the back-up deployment branch that you created on Gerrit.