To facilitate identification of the changes that are released and communication around them, we want to:
- bump the version number, following semantic versioning. If you want to override the version number, which is automatically determined based on the conventional commit messages being released, you can do so by passing a parameter to the
release-itcommand, e.g.
yarn release-it 1.0.0-rc.1- generate a change log, based on the commit messages using the conventional commits format
To make this process easy, we use release-it.
When you're ready to make a release to test and/or prod, apply the following steps:
- post in the Teams developers channel that you're doing a release and there's a merge halt on
- go into the github settings and turn off merging to develop so no one can merge by accident if they miss the merge halt post. (Optional, but this ensures no other changes are made to the
developbranch while the release is in progress. Release PRs can't be rebased (see note below), so if someone does merge something in, you have to restart the release.) - on
develop, check migrations against prod data. Ideally, do this using the dag:- Before running the airflow dag, ensure that the test namespace is clear of past migration test deployments. Because failed deployments do not clean up their resources (so that the logs can be checked), this causes subsequent deployments to fail.
- To manually clean the namespace from past migration test deployments (after investigating a failure, or before starting a new test), just run the
cas_bciers_test_migrations_cleanupDAG. - Go to the cas-airflow-test frontend and trigger the
cas_bciers_test_migrationsdag. You will need the source (where the database backup originates from, likelyabc123-prod) and target (where to deploy the tests, (abc123-test)) namespaces, as well as the git hash of the commit with a backend image built that you want to test (used byBACKEND_IMAGE_TAG).[!NOTE] This dag can take 15-25 minutes to complete. There are two tasks that specifically wait 8 minutes and 150 seconds, respectively, to give the pods time to start up before checking for migrations.
- Ensure the dag completes successfully. If any steps fail, the helm charts remain deployed in the target namespace for later inspection. If there are any problems with the migrations, create a branch, fix, and merge the fix before continuing.
Warning
There are a few steps to go through before a namespace can be used to test migrations
-
If the dag is not available, this can be done manually:
- in your .env, remove/comment out CHES variables (they should automatically be removed by the script but better safe than sorry)
- login to openshift using the command line (openshift docs)
poetry run python manage.py check_migrations_with_prod_data --pod-name {pod_name}(replace {pod_name} with the name of a production Postgres follower pod (in openshift, if you click into the pod, there will be a label that sayspostgres-operator.crunchydata.com/role=replica)). If there are any problems with the migrations, create a branch, fix, and merge the fix before continuing.
-
create a
chore/releasebranch and create the upstream -
reset database with
make reset_db(fromcas-registration/bc_obps) for proper creation of migration files -
run
make release(fromcas-registration) and follow the prompts - This will:- Create empty migration files for each django app based on the release version
- bump the version number
- generate a change log
-
create a pull request and confirm all the migrations have been created (at the time of writing, one for each of registration, reporting, compliance, common, RLS, and task-scheduler)
-
once the pull request is approved, if you disabled merging to
develop, temporarily re-enable merging so you can merge the release PR, and then disable merging again -
go to the shipit dev environment and keep an eye on the required checks on the merge commit (note: check-migrations will fail until #3590 is completed). Once the checks pass, shipit will automatically deploy the release commit to the dev environment once CI passes.
-
update your local develop branch and fast-forward the
mainbranch using:
- git checkout main
- git merge develop --ff-only
- git pushThis will put the release commit onto the main branch, which is connected to the test environment.
- go to the shipit test environment and keep an eye on the required checks. Once they pass, you can click the
Deploybutton. - once the deploy is complete (the logs will show
Completed Successfully, usually takes up to 8 minutes), let the team know the release is available in test. Optionally end the merge halt and unlock the develop branch at this point. - tag github tickets with the release version if applicable (see the team_release_process.md for more details)
- update the status of the tickets on the board to
UAT In Test - once a PO is ready to release to prod, they will typically click the
Deploybutton themselves.
Do not rebase release PRs. If a release PR falls behind the develop branch, a new PR will need to be created. release-it relies on tags to make comparisons from one release to another. Rebasing makes the tag created during the release process unreachable by git describe, which is what release-it uses to determine the parent tag.