Scripts to automate the release process.
A full release can be performed by following the steps below:
- Run release.sh to create a PR for the release (see details in the "release.sh" section below)
- Inform the team that a release PR is up and that they need to verify their commits
- Once developers verify their commits, run the finish_release.sh script (see details in the "finish_release.sh" section).
- Send email notifications
Note that these scripts use temporary directories so none of your work in progress will be affected or will affect the release.
release.sh is dependent on these applications.
Hub is a command-line wrapper for Git. It is available as a precompiled binary as well as from Homebrew on OSX:
brew install hub
Perl is already installed on your OS unless you're running Windows.
If you need it, refer to instructions at the above URL.
Git is a distributed source control system. If you don't have Git installed, we're ashamed of you. (Though if you use Mecurial instead, we'll go easy.) Git is available as a precompiled binary as well as from Homebrew on OSX:
brew install git
[git-release-notes - https://www.npmjs.com/package/git-release-notes]
(https://www.npmjs.com/package/git-release-notes)
git-release-notes is a Node package that processes Git commit history
through .EJS templates. It requires Node and can be installed with npm
.
npm install -g git-release-notes
curl is a command line tool to download files from the web. It should be already installed in OS X and most Linux distributions.
release.sh automates these steps:
- Clone and checkout a current
master
branch - Create a new
release-candidate
branch based off of master - Generate release notes
- Update version numbers and
RELEASE.rst
- Commit updates and push
release-candidate
branch - Generate release notes with checkboxes
- Open PR to merge
release-candidate
branch intorelease
branch
Run the command with these arguments:
./release.sh <path-to-release-project> <release number>
For example if the project you want to release is located at
~/projects/lore
and the release version is 0.1.0
, your command would be
./release.sh ~/projects/lore 0.1.0
finish_release.sh automates these steps:
- Clone and checkout the current
release
branch - Merge
release-candidate
intorelease
and push it toorigin
. This causes a deployment which will end up on production. - Tag the new release with the release version and push the tag to
origin
- Merge
release
tomaster
to update release notes.
Run the command with these arguments:
./finish_release.sh <path-to-release-project> <release number>
wait_for_deploy.sh will check the hash.txt
file every 30 seconds.
When the hash matches up the script will exit successfully.
Run the command with these arguments:
./wait_for_deploy.sh <path-to-release-project> <hash-url> <watch-branch>
path-to-release-project
- The path to the project which is being deployedhash-url
- The URL to be polled. This should point to a text file with only the git hash as its contents.watch-branch
- The branch being deployed. The latest commit on this branch will be compared with the deployment server's hash.
For example, to wait for successful deployment on micromasters to RC:
./wait_for_deploy.sh ~/Projects/micromasters https://micromasters-rc.herokuapp.com/static/hash.txt release-candidate
To wait for successful deployment of micromasters to production:
./wait_for_deploy.sh ~/Projects/micromasters https://micromasters.mit.edu/static/hash.txt release
For python libraries and XBlocks, once the the release is finished, it needs to be uploaded to PyPI.
- Get the PyPI credentials from DevOps.
If you haven't already, you should set up a
.pypirc
file as described in http://peterdowns.com/posts/first-time-with-pypi.html - Review the metadata in
setup.py
Most repos should already be set up with proper metadata. If not, consult the documentation at https://docs.python.org/3.6/distutils/setupscript.html#meta-data - Check the version number in
setup.py
. It should be the same as the release number.
Do a test run with the pypitest repository:
python setup.py sdist upload -r pypitest
If this works, you should get the (final) response:
Server response (200): OK
If the test works, upload to the real deal:
python setup.py sdist upload -r pypi
-
The main development branch is
master
, the branch of the version in production isrelease
. -
We use Semantic Versioning for our release numbers.
-
The
util
directory contains the templates to format the release notes and the GitHub descriptions. -
The script expects to find the current release number in either the Django
settings.py
file or in thesetup.py
file in the project root directory. If your project has neither of these files, the script will fail. -
You can confirm that the release-candidate deployed successfully by checking this end point on the release-candidate server.
<the-release-candidate-server-URL>/static/hash.txt
The endpoint will return the hash for the branch that is running on the server. For example,
https://micromasters-rc.herokuapp.com/static/hash.txt
returns the branch hash for the deployed Micromasters release-candidate.
-
There are three deployment servers, ci, rc, and production.
-
You can get debugging information by prefacing the command with
TRACE=1
so the command would begin withTRACE=1 release.sh ...
. -
The most common problem is that the version tag for the previous version doesn't exist. Determine the previous version tag numbers with this command:
git tag -l
Version tags start with the letter "v" followed by the version number.