Release Process
This document outlines the CRUK release process for products.
For additional context on this best practice see Environments.
Description
Software that is developed within CRUK must be appropriately tested and reviewed before being pushed to production.
Flow
To help describe the release process the following flow chart was created which provides a simplified view of an engineer making a change and seeing it through to production. Specific details on each area of the flow chart can be found below.
Process
1,2 and 3. Engineer makes changes locally and creates a pull request
These steps follow a common approach where engineers make changes on their local machines on a git branch. This is then pushed to the git repository and a PR (pull request) created.
4. PR Approval
The PR requires approval by the team before the change can be released. This is done with three methods that can run in parallel.
4a - An PR ephemeral environment is created using the software in the PR. This is a short lived environment that is spun up per PR and asserts that the software can be build and deployed. Tests can also be run against this stack.
4b - Automated checks via GitHub actions are performed. This can include unit tests, UI tests, static code checks, security checks, integration checks and more. These are performed for all PR and are created by the team. When following this process it is essential to have sufficient automated approval checks to reduce manual effort in asserting a change.
4c - Another engineer reviews the code itself and approves if they are happy with the content.
Once the PR has been approved via these methods it is ready for release. First the type of change must be determined to understand it's release process.
5. Change Types
The change type will be determined at the task level prior to this stage in the flow. It is at this point in the flow however where the change type dictates the next steps.
The change request itself should be created by the PR automatically by integrating with the Service Now API.
Change Type | Team Approval | External Approval | Examples |
---|---|---|---|
Standard | ✔️ | ❌ | Cosmetic CSS change, updating dependencies, form validation changes |
Normal | ✔️ | ✔️ | Fixing a security breach, new service integrations, change to downstream contracts |
For simplicity the 'Standard' change template covers all aspects of self-served product releases with the exception of the areas listed below.
6. Semantic versioning
Github releases can be further automated with the help of conventional commits and semantic versioning.
A release configuration file release.config.js at the root repository level defines the plugins used for the release.
The commit-analyser plugin in the release config defines the type of commits that will cause a major or minor version change, the automatic generation of release notes and upload of releases to github among other features.
{
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [
{ "type": "docs", "scope": "README", "release": "patch" },
{ "type": "refactor", "scope": "core-*", "release": "minor" },
{ "type": "refactor", "release": "patch" },
{ "scope": "no-release", "release": false }
]
}
],
"@semantic-release/release-notes-generator"
]
}
Examples for semantic release configuration
Automating releases with semantic versioning is optional and only useful where the development and QA teams agree to use conventional commits in pull requests.
Semantic versioning in monorepos
If you need to configure the release of individual packages within a monorepo, Nx offers a nx release
command to help with running the semantic release before/during the merge to the root branch.
Example nx.json
release config:
"release": {
"changelog": {
"automaticFromRef": true,
"projectChangelogs": {
"createRelease": "github"
}
},
"projects": ["apps/*", "packages/*"],
"projectsRelationship": "independent",
"version": {
"conventionalCommits": true,
"generatorOptions": {
"fallbackCurrentVersionResolver": "disk"
}
}
}
In the example above, nx is configured to run the github release of individual packages within apps
and packages
and use conventional commits. You can then configure github actions to run the release.
Examples:
semantic-release
section in Online Payments Services
Exceptions
This list will evolve over time and should be used as a guideline only. It is not authoritative; documentation will be provided where this will be sourced and this document will be updated to reference that when available.
- Anything that involves working with resource outside the product team.
- Anything that impacts any other digital product
- Anything that impacts any production service other than the product being released.
- Anything affecting or changing the underpinning architecture.
- Anything affecting or changing the underpinning infrastructure.
- Anything with security implications or fixes resulting from a security breach.
- Changes where there are other dependent systems.
There may be other exceptions on a case-by-case basis; if you are unsure speak with the product manager.
6a. Standard
A pre-approved change type that has been determined to have no impact outside of the application or data solution being changed and therefore only needs to be reviewed by the product team (the Product Manager, Lead Software/Data/CRM Engineer, QA Engineer).
These changes are approved within the team and require no external approval. They can be deployed whenever the team chooses to do so, however we caution against deploying changes at times when there is insufficient support in place to deal with any issues that arise from the change (e.g. deploying on a Friday afternoon if there is no support in place on the Saturday).
The change must be tracked within ServiceNow with a change request and a deployment notification must be posted in the #releases channel in Slack. The change request creation and Slack post can be done automatically from Github Actions.
6b. Normal
A change that has impact outside of the application or data solution being changed and therefore requires:
- review of people from other teams
- scheduling to avoid conflict with other planned changes and
- additional comms to ensure all stakeholders are aware
These are changes that impact upstream or downstream systems or other teams' activity and therefore need coordination between teams or stakeholders in order to safely release. These changes are approved by the product team as with a standard change but also require approvals from impacted services, stakeholders and service management. The change must be tracked and approved within ServiceNow with a change request and communicated ahead of time on the #releases channel in Slack. This change type requires CAB (Change Advisory Board) and external stakeholder approval.