|
| 1 | +# samba-operator Release Process |
| 2 | + |
| 3 | +## Preparation |
| 4 | + |
| 5 | +The samba-operator project has a dedicated branch, called `release`, for |
| 6 | +release versions. This is done to update files, in particular the tags of the |
| 7 | +default containers in `internal/conf`, that control dependencies. Tags are |
| 8 | +applied directly to this branch and only this branch. |
| 9 | + |
| 10 | + |
| 11 | +Prior to tagging, we must update the `release` branch to "contain" all the |
| 12 | +latest changes from the `master` branch. We do this by merging `master` into |
| 13 | +`release`. |
| 14 | +Example: |
| 15 | + |
| 16 | +``` |
| 17 | +git checkout master |
| 18 | +git pull --ff-only |
| 19 | +git checkout release |
| 20 | +git pull --ff-only |
| 21 | +git merge master |
| 22 | +# resolve any conflicts |
| 23 | +``` |
| 24 | + |
| 25 | +Now we need to update the versions of the containers that the operator deploys |
| 26 | +by default. Edit `internal/conf/config.go` to update the versions of |
| 27 | +the samba-server, samba-metrics, and svcwatch containers if there are new |
| 28 | +released versions for these images. |
| 29 | + |
| 30 | +[!IMPORTANT] |
| 31 | +The projects that the samba-operator includes/depends on must be released |
| 32 | +*before* the samba-operator. As a policy the "SINK" team releases the projects |
| 33 | +as a group. See the section below for guidance with regards to version numbers. |
| 34 | + |
| 35 | +For example, if we plan on releasing operator v0.6 we first release |
| 36 | +samba-containers v0.6, and so on. If a project is unchanged we do not need to |
| 37 | +make a release and the older version number will continue to be used. If we do |
| 38 | +need to make a release that was not part of the previous group we may *skip* |
| 39 | +versions numers. For example if component X was released as v0.3 in along with |
| 40 | +samba-operator v0.3 but was unchanged for operator v0.4 we would release it as |
| 41 | +v0.5 along with samba-operator v0.5 if a release is needed for that project. |
| 42 | + |
| 43 | +Once the dependency image tags have been updated, commit the change. For example: |
| 44 | +``` |
| 45 | +git commit -s -p -m 'release: use v0.5 tag for samba-server and samba-metrics images' |
| 46 | +``` |
| 47 | + |
| 48 | +Run `git push` to push the change to the release branch on GitHub, initiating |
| 49 | +a CI test run. Verify the the release branch build passes the tests. |
| 50 | + |
| 51 | +In the meantime, edit the file `config/manager/manager.yaml` to bump up |
| 52 | +the version of the operator image tag (to match the upcoming tag). This file |
| 53 | +is used when deploying the operaterator and must be configured to deploy |
| 54 | +the intended release version. Commit the change with a cmmand like so: |
| 55 | +``` |
| 56 | +git commit -s -p -m 'release: use v0.5 tag for samba-operator by default' |
| 57 | +``` |
| 58 | + |
| 59 | +### Tagging |
| 60 | + |
| 61 | +Assuming the CI has passed the tests, apply a new tag to the `release` branch: |
| 62 | +``` |
| 63 | +git tag -a -m 'Release v0.5' v0.5 |
| 64 | +``` |
| 65 | + |
| 66 | +This creates an annotated tag. Release tags must be annotated tags. |
| 67 | + |
| 68 | +### Build |
| 69 | + |
| 70 | +With the tag recorded in git we can now build the final image for this release. |
| 71 | +This tag and the corresponding hash will be recorded in the binary that is |
| 72 | +built. |
| 73 | + |
| 74 | +It is very important to ensure that base images are up-to-date. |
| 75 | +You can either purge your local system of cached container images or |
| 76 | +inspect the `Dockerfile` and purge or explicitly pull each base image. |
| 77 | + |
| 78 | +Run `make image-build`. |
| 79 | + |
| 80 | +Verify that the tag was properly recorded by the binary in the container. |
| 81 | +* Run `podman run --rm -it quay.io/samba.org/samba-operator:latest` |
| 82 | +* The operator will fail to start because it is not running in kubernetes. |
| 83 | + However, all you need to verify is that the first log line, with |
| 84 | + "Initializing Manager", contains JSON values that have the correct tag in the |
| 85 | + "Version" field. |
| 86 | + |
| 87 | + |
| 88 | +For the image that was just built, apply a temporary pre-release tag |
| 89 | +to it. Example: |
| 90 | +``` |
| 91 | +podman tag quay.io/samba.org/samba-operator:{latest,v0.5pre1} |
| 92 | +``` |
| 93 | + |
| 94 | +Log into quay.io. Push the images to quay.io using the temporary tag. Example: |
| 95 | +``` |
| 96 | +podman push quay.io/samba.org/samba-operator:{latest,v0.5pre1} |
| 97 | +``` |
| 98 | + |
| 99 | +Wait for the security scan to complete. There shouldn't be any issues if you |
| 100 | +properly updated the base images before building. If there are issues and you |
| 101 | +are sure you used the newest base images, check the base images on quay.io and |
| 102 | +make sure that the number of issues are identical. The security scan can take |
| 103 | +some time, while it runs you may want to do other things. |
| 104 | + |
| 105 | + |
| 106 | +## GitHub Release |
| 107 | + |
| 108 | +When you are satisfied that the tagged version is suitable for release, you |
| 109 | +can push the tag to the public repo: |
| 110 | +``` |
| 111 | +git push --follow-tags |
| 112 | +``` |
| 113 | + |
| 114 | +Draft a new set of release notes. Select the recently pushed tag. Start with |
| 115 | +the auto-generated release notes from GitHub (activate the `Generate release |
| 116 | +notes` button/link). Add an introductory section (see previous notes for an |
| 117 | +example). Add a "Highlights" section if there are any notable features or fixes |
| 118 | +in the release. The Highlights section can be skipped if the content of the |
| 119 | +release is unremarkable (e.g. few changes occurred since the previous release). |
| 120 | + |
| 121 | +Each release provides a YAML file that can be used to deploy the operator |
| 122 | +on a Kubernetes cluster. Generate this file by running: |
| 123 | +``` |
| 124 | +# replace example version with correct version number |
| 125 | +kustomize build config/default/ > samba-operator-v0.5-default.yaml |
| 126 | +``` |
| 127 | + |
| 128 | +Prepare a "downloads" section for the release notes. |
| 129 | +Use the following partial snippet as an example: |
| 130 | +``` |
| 131 | +## Download |
| 132 | +
|
| 133 | +The samba-operator image can be acquired from the quay.io image registry: |
| 134 | +
|
| 135 | +* By tag: quay.io/samba.org/samba-operator:v0.5 |
| 136 | +* By digest: quay.io/samba.org/samba-operator@sha256:040307f53c3f3fd6a5935306f9898858b6c46b7e9c2ae46244e79c2bc42fef0d |
| 137 | +
|
| 138 | +### Deploying the operator |
| 139 | +
|
| 140 | +This operator can be deployed using the example file samba-operator-v0.5-default.yaml file, attached to this release. Example: |
| 141 | +
|
| 142 | +kubectl apply -f samba-operator-v0.5-default.yaml |
| 143 | +
|
| 144 | +This is equivalent to checking out the v0.5 tag from the git repository and using the default configuration. Example: |
| 145 | +
|
| 146 | +git clone -b v0.5 https://github.com/samba-in-kubernetes/samba-operator |
| 147 | +cd samba-operator |
| 148 | +kubectl apply -k config/default |
| 149 | +
|
| 150 | +``` |
| 151 | +... using the image that was pushed earlier |
| 152 | + |
| 153 | +The tag is pretty obvious - it should match the image tag (minus any pre-release |
| 154 | +marker). You can get the digest from the tag using the quay.io UI (do not use |
| 155 | +any local digest hashes). Click on the SHA256 link and then copy the full |
| 156 | +manifest hash using the UI widget that appears. |
| 157 | + |
| 158 | +Update the "Deploying the operator" section to use the correct version number |
| 159 | +and ensure that the yaml file is uploaded to GitHub. |
| 160 | + |
| 161 | +Perform a final round of reviews, as needed, for the release notes and then |
| 162 | +publish the release. |
| 163 | + |
| 164 | +Once the release notes are drafted and then either immediately before or after |
| 165 | +publishing them, use the quay.io UI to copy each pre-release tag to the "latest" |
| 166 | +tag and a final "vX.Y" tag. Delete the temporary pre-release tags using the |
| 167 | +quay.io UI as they are no longer needed. |
| 168 | + |
| 169 | + |
| 170 | +## Announcements |
| 171 | + |
| 172 | +As the samba-operator is typically the final release is the group of "SINK" |
| 173 | +projects that are released. Now is a good time to announce the releases. |
| 174 | +Currently the team sends email to the `samba` and `samba-technical` lists at |
| 175 | +lists.samba.org. See the list archives for previous examples. |
0 commit comments