The next branch is used to collect and test changes before a release. Only
changes scheduled for the next release should be in next, and commits may be
reverted or added to reflect scope changes.
Once a release has gone through the assurance stops and ready to release, next
is merged into main using a PR, and then main is deployed out to production.
The release branch is a reference to what is in production at any point in
time and updated at the time the release is performed. It usually tracks main
but can also point to hotfix branches as necessary.
Releasing follows these steps, performed once approval for release has been given:
- Create a PR to merge
nextintomain. GitHub will have a warning thatnextisn't up-to-date withmain, but that is likely caused by the existance of a merge commit from the last deploy. You can double check locally by updatingmainandnext, and using git (git rev-list --oneline main ^next) or jj (jj log -r '::main ~ ::next'), or by comparing the branches on GitHub. - Create a draft release by running the
Draft new releaseworkflow. This creates a draft release in GitHub with initial release notes. - Update the release notes with information about the changes. This is generated from the Jira tickets by a team member.
- Publish the release in GitHub. This will create the tag.
- Check the notes for pre and post-release tasks and ensure these are performed before and after releasing to the environments below.
- Deploy the release to the
previewandtrainingenvs, first checking that they haven't had a specific branch deployed to them (check recent deploys). This can be used as a test that the tag deploys as expected. - If there are migrations that need testing (e.g. a db or data migrations),
deploy this release to
data-replicationand test the performance of the migration(s) there. - Perform pre-release tasks.
- Run the Deploy workflow to deploy to production.
- Run the Deploy application workflow for the reporting app. You may need to ask other team members for the correct tag.
- Smoke test: login to the production service to ensure it looks normal.
- Perform post-release tasks.
- Fast-forward or reset
releaseto the release tag. - Update the service management channel on NHSE Slack.
- Update the topic in the Mavis tech channel to reflect the new version.
Additional notes below.
Use the deploy.yml workflow to run the deployments. For the production
deployment, it's important to start the workflow from the main branch and
specify the tag to deploy as input. This is because only workflows from the
main branch can authenticate with the production AWS account.
We update the release branch after we've deployed main to production. If
there have been no hot-fixes since the last release then this is a simple
fast-forward merge that has to be done on your localhost (see below for how to
manage non-fast-forwardable situations):
git checkout release
git pull origin release
# Check that release can be fast-forwarded to the release candidate
git merge-base --is-ancestor release v1.0.0-rc1 && echo "safe to ff-merge"
# If release has diverged from main and cannot be fast-forwarded to the release
# candidate, see the instructions below
git merge --ff-only v1.0.0-rc1
git push --tags origin releaseThere are cases when release won't be fast-forwardable to the release
candidate on main. This will happen when a fix has been applied to the
release branch that circumvented the normal release cycle (AKA hot-fix, see
below).
In these cases the release branch will need to be reset to the latest release
candidate.
git checkout release
git pull origin release
git reset --hard v1.0.0-rc1
git push --tags origin releaseAnd then you can follow the instructions above about creating the release tag and deploying.
Hot-fixes are emergency fixes made to the current release that bypass changes
that are in main. These fixes should still go through the pull-request
process, but to a version-specific branch, e.g. v1.0.1-hotfixes. Once these
are merged in, the commits will need to be applied to main, e.g. via
cherry-picking, and release should be fast-forwarded/reset to the latest code
released.
gitGraph
branch release
commit tag: "v0.9.9"
checkout main
commit tag: "v1.0.0-rc1, v1.0.0"
checkout release
merge main tag: "v1.0.0"
checkout main
commit id: "v1.1.0-feature-1"
commit id: "v1.1.0-feature-2"
checkout release
branch v1.0.1-hotfixes
commit id: "v1.0.1-hotfix-1"
checkout main
cherry-pick id: "v1.0.1-hotfix-1"
commit id: "v1.1.0-feature-3"
checkout release
merge v1.0.1-hotfixes tag: "v1.0.1"
checkout main
At this point the histories of the release and main branches will have
diverged and it will not be possible to fast-forward the release branch when
releasing. It will have to be reset to the latest release candidate as
previously described.
A release can be rolled back by deploying the previous release tag using the regular GitHub workflow. This can be done on a per-service level or for all services. If the issue is spotted early and the CodeDeploy deployment is still in progress, the new deployment can still be aborted. To do this, go to the CodeDeploy console, select the deployment group, and click "Stop deployment".