vitess.io/vitess@v0.16.2/doc/internal/ReleaseInstructions.md (about)

     1  # Release Instructions
     2  
     3  This page describes the steps for cutting a new [open source release](https://github.com/vitessio/vitess/releases).
     4  
     5  ### Summary
     6  
     7  - [Versioning](#versioning)
     8  - [Release Branches](#release-branches)
     9  - [Release Tags](#release-tags)
    10  - [Docker Images](#docker-images)
    11  - [Java Packages](#java-packages)
    12  - [Release Cutover](#release-cutover)
    13  
    14  -------
    15  
    16  ## Versioning
    17  
    18  Our versioning strategy is based on [VEP5](https://github.com/vitessio/enhancements/blob/main/veps/vep-5.md).
    19  
    20  ### Major Release (vX)
    21  
    22  A new major release is needed when the public API changes in a
    23  backward-incompatible way -- for example, when removing deprecated interfaces.
    24  
    25  Our public API includes (but is not limited to):
    26  
    27  *   The VTGate [RPC interfaces](https://github.com/vitessio/vitess/tree/main/proto).
    28  *   The interfaces exposed by the VTGate client library in each language.
    29  
    30  Care must also be taken when changing the format of any data stored by a live
    31  system, such as topology data or Vitess-internal tables (used for sequences,
    32  distributed transactions, etc.). Although this data is considered as internal to
    33  Vitess, if any change breaks the upgrade path for a live system (for example,
    34  requiring that it be shut down and reinitialized from scratch), then it must be
    35  considered as a breaking change.
    36  
    37  ### Minor Release (vX.Y)
    38  
    39  A new minor release indicates that functionality has been added or changed in a
    40  backward-compatible way. This should be the majority of normal releases.
    41  
    42  ### Patch Release (vX.Y.Z)
    43  
    44  A patch release indicates that only a select set of bugfixes have been
    45  cherry-picked onto the associated minor release. The expectation is that
    46  upgrading by a patch release should be painless (not requiring any config
    47  changes) and safe (isolated from active development on `main`).
    48  
    49  ### Pre-Release Labels (vX.Y.Z-labelN)
    50  
    51  Pre-release versions should be labeled with a suffix like `-beta2` or `-rc1`.
    52  
    53  -------
    54  
    55  ## Release Branches
    56  
    57  Each major and minor releases (X.Y) should have a [release branch](https://github.com/vitessio/vitess/branches/all?query=release) named
    58  `release-X.Y`. This branch should diverge from `main` when the release
    59  is declared, after which point only bugfix PRs should be cherry-picked onto the branch.
    60  All other activity on `main` will go out with a subsequent major or minor release.
    61  
    62  ```shell
    63  git checkout main
    64  git pull --ff-only upstream main
    65  
    66  git checkout -b release-X.Y
    67  git push upstream release-X.Y
    68  ```
    69  
    70  The branches are named `release-X.Y` to distinguish them from point-in-time
    71  tags, which are named `vX.Y.Z`.
    72  
    73  -------
    74  
    75  ## Release Tags
    76  
    77  While the release branch is a moving target, release tags mark point-in-time
    78  snapshots of the repository. Essentially, a tag assigns a human-readable name to
    79  a specific Git commit hash. Although it's technically possible to reassign a tag
    80  name to a different hash, we must never do this.
    81  
    82  -------
    83  
    84  ## Docker Images
    85  
    86  Docker images built automatically on DockerHub and can be found [here](https://hub.docker.com/repository/docker/vitess/lite/).
    87  
    88  -------
    89  
    90  ## Java Packages
    91  
    92  We publish binary packages for our [JDBC driver and Java client on Maven Central](https://search.maven.org/#search|ga|1|g:"io.vitess").
    93  
    94  To do so, we use the http://oss.sonatype.org/ repository.
    95  New packages must be uploaded there ("deployed") and will be automatically published ("released").
    96  Once they are released there, they will be automatically synchronized with Maven Central.
    97  The synchronization takes only several minutes, but the update on http://search.maven.org may take up to two hours.
    98  
    99  ### Access to oss.sonatype.org
   100  
   101  [Sign up here.](https://issues.sonatype.org/secure/Signup!default.jspa)
   102  Then you must be added as member to our `io.vitess` namespace.
   103  Therefore, file a JIRA ticket with Sonatype to get added ([example for a different namespace](https://issues.sonatype.org/browse/OSSRH-30604)).
   104  
   105  ### One-time setup
   106  
   107  #### Set up GPG
   108  
   109  Follow [Sonatype's GPG instructions](https://central.sonatype.org/pages/working-with-pgp-signatures.html).
   110  
   111  Install `gpg-agent` (needed below) e.g. on Ubuntu via: `sudo apt-get install gnupg-agent`.
   112  for Mac you need to install 'gnupg' via 'brew install gnupg'
   113  
   114  #### Login configuration
   115  
   116  Create the `settings.xml` in the `$HOME/.m2/` directory as described in their [instructions](https://central.sonatype.org/pages/apache-maven.html).
   117  
   118  -------
   119  
   120  ## Release Cutover 
   121  
   122  In this section we describe our current release process. We begin with a list of [**pre-requisite for the release team**](#pre-requisites) and with a short [**overview**](#overview).
   123  The release process is divided into three parts: [**Pre-Release**](#pre-release), [**Release**](#release), [**Post-Release**](#post-release), which are detailed after the overview.
   124  
   125  ### Pre-Requisites
   126  
   127  This section highlights the different pre-requisites the release team has to meet before releasing.
   128  
   129  - The tool `gh` must be installed locally and ready to be used.
   130  - You must have access to the Java release, more information in the [**Java Packages**](#java-packages) section.
   131  - You must be able to create branches and have admin right on the `vitessio/vitess` and `planetscale/vitess-operator` repositories.
   132  
   133  ### Overview
   134  
   135  #### Schedule
   136  
   137  A new major version of Vitess is released every four months. For each major version there is at least one release candidate, which we release three weeks before the GA version.
   138  We usually create the RC1 during the first week of the month, and the GA version three weeks later.
   139  
   140  #### Code Freeze
   141  
   142  Before creating RC1, there is a code freeze. Assuming the release of RC1 happens on a Tuesday, the release branch will be frozen Friday of the previous week.
   143  This allows us to test that the release branch can be released and avoid discovering unwanted events during the release day. Once the RC1 is released, there are three more weeks to backport bug fixes into the release branches.
   144  However, we also proceed to a code freeze the Friday before the GA release. (Assuming GA is on a Tuesday)
   145  Regarding patch releases, no code freeze is planned.
   146  
   147  #### Tracking Issue for each Release
   148  
   149  For each release, it is recommended to create an issue like [this one](https://github.com/vitessio/vitess/issues/10476) to track the current and past progress of a release.
   150  It also allows us to document what happened during a release.
   151  
   152  ### Pre-Release
   153  
   154  This step happens a few weeks before the actual release (whether it is an RC, GA or a patch release).
   155  The main goal of this step is to make sure everything is ready to be released for the release day.
   156  That includes:
   157  - **Making sure Pull Requests are being reviewed and merged.**
   158    > - All the Pull Requests that need to be in the release must be reviewed and merged before the code freeze.
   159    > - The code freeze usually happens a few days before the release.
   160  - **Making sure the people doing the release have access to all the tools and infrastructure needed to do the release.**
   161    > - This includes write access to the Vitess repository and to the Maven repository. 
   162  - **Preparing and cleaning the release notes summary.**
   163    > - One or more Pull Requests have to be submitted in advance to create and update the release summary.
   164    > - The summary files are located in: `./changelog/*.0/*.*.*/summary.md`.
   165    > - The summary file for a release candidate is the same as the one for the GA release.
   166    > - Make sure to run `go run ./go/tools/releases/releases.go` to update the `changelog` directory with the latest release notes.
   167  - **Finishing the blog post, and coordinating with the different organizations for cross-posting. Usually CNCF and PlanetScale. This step applies only for GA releases.**
   168    > - The blog post must be finished and reviewed.
   169    > - A Pull Request on the website repository of Vitess has to be created so we can easily publish the blog during the release day.
   170  - **Code freeze.**
   171    > - As soon as we go into code freeze, if we are doing an RC, create the release branch.
   172    > - If we are doing a GA release, do not merge any new Pull Requests.
   173    > - The guide on how to do a code freeze is available in the [How To Code Freeze](#how-to-code-freeze) section.
   174  - **Create the Vitess release.**
   175    > - A guide on how to create a Vitess release is available in the [How to prepare the release of Vitess](#how-to-prepare-the-release-of-vitess) section.
   176    > - This step will create a Release Pull Request, it must be reviewed and merged before the release day. The release commit will be used to tag the release.
   177  - **Preparing the Vitess Operator release.**
   178    > - While the Vitess Operator is located in a different repository, we also need to do a release for it.
   179    > - The Operator follows the same cycle: RC1 -> GA -> Patches.
   180    > - Documentation for the pre-release of the Vitess Operator is available [here](https://github.com/planetscale/vitess-operator/blob/main/docs/release-process.md#prepare-for-release).
   181  
   182  ### Release
   183  
   184  On the release day, there are several things to do:
   185  
   186  - **Tag the Vitess release.**
   187    > - A guide on how to tag a version is available in the [How To Release Vitess](#how-to-release-vitess) section.
   188  - **Create the corresponding Vitess operator release.**
   189    > - Applies only to versions greater or equal to `v14.0.0`.
   190    > - If we are doing an RC release, then we will need to create the Vitess Operator RC too. If we are doing a GA release, we're also doing a GA release in the Operator.
   191    > - The Vitess Operator release documentation is available [here](https://github.com/planetscale/vitess-operator/blob/main/docs/release-process.md#cut-release).
   192  - **Create the Java release.**
   193    > - Applies only to GA releases.
   194    > - This step is explained in the [Java Packages: Deploy & Release](#java-packages-deploy--release) section.
   195  - **Update the website documentation repository.**
   196    > - Applies only to GA and RC releases.
   197    > - There are two scripts in the website repository in `./tools/{ga|rc}_release.sh`, use them to update the website documentation. The scripts automate:
   198    >   - For an RC, we need to create a new version in the sidebar and mark the current version as RC.
   199    >   - For a GA, we need to mark the version we are releasing as "Stable" and the next one as "Development".
   200  - **Publish the blog post on the Vitess website.**
   201    > - Applies only to GA releases.
   202    > - The corresponding Pull Request was created beforehand during the pre-release. Merge it.
   203  - **Make sure _arewefastyet_ starts benchmarking the new release.**
   204    > - This can be done by visiting [arewefastyet status page](https://benchmark.vitess.io/status).
   205    > - New elements should be added to the execution queue.
   206    > - After a while, those elements will finish their execution and their status will be green.
   207    > - This step is even more important for GA releases as we often include a link to _arewefastyet_ in the blog post.
   208    > - The benchmarks need to complete before announcing the blog posts or before they get cross-posted.
   209  - **Update the release notes on `main`.**
   210    > - One Pull Request against `main` must be created, it will contain the new release notes. 
   211  - **Go back to dev mode on the release branch.**
   212    > - The version constants across the codebase must be updated to `SNAPSHOT`. 
   213  - **Build k8s Docker images and publish them**
   214    > - The docker image for `base`, `lite`, etc are built automatically by DockerHub. The k8s images however are dependent on these images and are required to be built manually.
   215    > - These images should be built after the `base` image has been built and available on DockerHub.
   216    > - To build and publish these images, run `./release.sh` from the directory `vitess/docker`.
   217  
   218  ### Post-Release
   219  
   220  Once the release is over, we need to announce it on both Slack and Twitter. We also want to make sure the blog post was cross-posted, if applicable.
   221  We need to verify that _arewefastyet_ has finished the benchmark too.
   222  
   223  ### How to prepare the release of Vitess
   224  
   225  > In this example our current version is `v14.0.3` and we release the version `v15.0.0`.
   226  > Alongside Vitess' release, we also release a new version of the operator.
   227  > Since we are releasing a release candidate here, the new version of the operator will also be a release candidate.
   228  > In this example, the new operator version is `2.8.0`.
   229  >
   230  > It is important to note that before the RC, there is a code freeze during which we create the release branch.
   231  >
   232  > The release branch in this example is `release-15.0`.
   233  >
   234  > The example also assumes that `origin` is the `vitessio/vitess` remote.
   235  
   236  1. Fetch `github.com/vitessio/vitess`'s remote.
   237      ```shell
   238      git fetch origin
   239      ```
   240  
   241  2. Creation of the Release Pull Request.
   242      > This step will create the Release Pull Request that will then be reviewed ahead of the release day.
   243      > The merge commit of that Pull Request will be used during the release day to tag the release.
   244      1. Run the `create_release` script using the Makefile:
   245          1. Release Candidate:
   246              ```shell
   247              make BASE_BRANCH="release-15.0" BASE_REMOTE="origin" RELEASE_VERSION="15.0.0-rc1" VTOP_VERSION="2.8.0-rc1" create_release
   248              ```
   249          2. General Availability:
   250             ```shell
   251             make BASE_BRANCH="release-15.0" BASE_REMOTE="origin" RELEASE_VERSION="15.0.0" VTOP_VERSION="2.8.0" create_release
   252             ```
   253  
   254         The script will prompt you `Pausing so release notes can be added. Press enter to continue`. We are now going to generate the release notes, continue to the next sub-step.
   255  
   256      2. Run the following command to generate the release notes:
   257          1. Release Candidate:
   258              ```shell
   259              make VERSION="v15.0.0-rc1" FROM="v14.0.3" TO="HEAD" SUMMARY="./changelog/15.0/15.0.0/summary.md" release-notes  
   260              ```
   261          2. General Availability:
   262              ```shell
   263              make VERSION="v15.0.0-rc1" FROM="v14.0.3" TO="HEAD" SUMMARY="./changelog/15.0/15.0.0/summary.md" release-notes  
   264              ```
   265         This command will generate the release notes by looking at all the commits between the tag `v14.0.3` and the reference `HEAD`.
   266         It will also use the file located in `./changelog/15.0/15.0.0/summary.md` to prefix the release notes with a text that the maintainers wrote before the release.
   267         Please verify the generated release notes to make sure it is well-formatted and all the bookmarks are generated properly.
   268  
   269  
   270  3. Follow the instruction prompted by the `create_release` Makefile command's output in order to push the newly created branch and create the Release Pull Request on GitHub.
   271  
   272  ### How To Release Vitess
   273  This section is divided into two parts:
   274  - [Creation of the tags and release notes](#creation-of-the-tags-and-release-notes).
   275  - [Creating Release or Release Candidate on the GitHub UI](#creating-release-or-release-candidate-on-the-github-ui)
   276  
   277  #### Creation of the tags and release notes
   278  
   279  > This step implies that you have created a [Release Pull Request](#how-to-prepare-the-release-of-vitess) beforehand and that it has been reviewed.
   280  > The merge commit of this Release Pull Request will be used to tag the release.
   281  > 
   282  > In this example our current version is `v14.0.3` and we release the version `v15.0.0`.
   283  > Alongside Vitess' release, we also release a new version of the operator.
   284  > Since we are releasing a release candidate here, the new version of the operator will also be a release candidate.
   285  > In this example, the new operator version is `2.8.0`.
   286  > 
   287  > It is important to note that before the RC, there is a code freeze during which we create the release branch.
   288  >
   289  > The release branch in this example is `release-15.0`.
   290  > 
   291  > The example also assumes that `origin` is the `vitessio/vitess` remote.
   292  
   293  1. Fetch `github.com/vitessio/vitess`'s remote.
   294      ```shell
   295      git fetch origin
   296      ```
   297  
   298  2. Checkout to the merge commit of the Release Pull Request.
   299  
   300  3. Tag the release and push the tags
   301     ```shell
   302     git tag v15.0.0 && git tag v0.15.0 && git push origin v15.0.0 && git push origin v0.15.0
   303     ```
   304  
   305  4. Create a Pull Request against the `main` branch with the release notes found in `./changelog/15.0/15.0.0/15_0_0_*.md`.
   306  
   307  5. Run the back to dev mode tool.
   308     ```shell
   309     make BASE_BRANCH="release-15.0" BASE_REMOTE="origin" RELEASE_VERSION="15.0.0-rc1" DEV_VERSION="15.0.0-SNAPSHOT" back_to_dev_mode
   310     ```
   311     > You will then need to follow the instructions given by the output of the back_to_dev_mode Makefile command. You will need to push the newly created branch and open a Pull Request.
   312     
   313  6. Release the tag on GitHub UI as explained in the following section.
   314  
   315  #### Creating Release or Release Candidate on the GitHub UI
   316  
   317  > In the below steps, we use `v8.0.0` and `v9.0.0` as an example.
   318  
   319  ##### 1. Open the releases page
   320  
   321  On Vitess' GitHub repository main page, click on Code -> [Releases](https://github.com/vitessio/vitess/releases).
   322  
   323  ![alt text](.images/release-01.png)
   324  
   325  ##### 2. Draft a new release
   326  
   327  On the Releases page, click on `Draft a new release`.
   328  
   329  ![alt text](.images/release-02.png)
   330  
   331  ##### 3. Tag a new release
   332  
   333  When drafting a new release, we are asked to choose the release's tag and branch.
   334  We format the tag this way: `v9.0.0`. We append `-rcN` to the tag name for release candidates,
   335  with `N` being the increment of the release candidate.
   336  
   337  ![alt text](.images/release-03.png)
   338  
   339  ##### 4. Add release notes and release
   340  
   341  Copy/paste the previously built Release Notes into the description of the release.
   342  
   343  If this is a pre-release (`rc`) select the `pre-release` checkbox.
   344  
   345  And finally, click on `Publish release`.
   346  
   347  ![alt text](.images/release-04.png)
   348  
   349  ### How To Code Freeze
   350  
   351  In this example we are going to do a code freeze on the `release-15.0` branch. If we are doing a release candidate, there won't be a branch yet, hence we need to create it.
   352  
   353  ```
   354  git fetch --all
   355  git checkout -b release-15.0 origin/main
   356  ```
   357  
   358  The new branch will be based on `origin/main`, here `origin` points to `vitessio/vitess`. If we are not doing a release candidate, then the branch already exists and we can checkout on it.
   359  
   360  Now, if we are doing a GA release, let's update the branch:
   361  
   362  ```
   363  git pull origin release-15.0
   364  ```
   365  
   366  Finally, let's run the code freeze script:
   367  
   368  ```
   369  ./tools/code_freeze.sh freeze release-15.0
   370  ```
   371  
   372  The script will prompt the command that will allow you to push the code freeze change. Once pushed, open a PR that will be merged on `release-15.0`.
   373  
   374  ### Java Packages: Deploy & Release
   375  
   376  > **Warning:** This section's steps need to be executed only when releasing a new major version of Vitess,
   377  > or if the Java packages changed from one minor/patch version to another.
   378  > 
   379  > For this example, we assume we juste released `v12.0.0`.
   380  
   381  1. Checkout to the release commit.
   382      ```shell
   383      git checkout v12.0.0
   384      ```
   385  
   386  2. Run `gpg-agent` to avoid that Maven will constantly prompt you for the password of your private key.
   387  
   388      ```bash
   389      eval $(gpg-agent --daemon --no-grab --write-env-file $HOME/.gpg-agent-info)
   390      export GPG_TTY=$(tty)
   391      export GPG_AGENT_INFO
   392      ```
   393  
   394  3. Export following to avoid any version conflicts
   395      ```bash
   396      export MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED 
   397      --add-opens=java.desktop/java.awt.font=ALL-UNNAMED"
   398      ```
   399  
   400  4. Deploy (upload) the Java code to the oss.sonatype.org repository:
   401  
   402      > **Warning:** After the deployment, the Java packages will be automatically released. Once released, you cannot delete them. The only option is to upload a newer version (e.g. increment the patch level).</p>
   403  
   404      ```bash
   405      mvn clean deploy -P release -DskipTests
   406      cd ..
   407      ```
   408  5. It will take some time for artifacts to appear on [maven directory](https://mvnrepository.com/artifact/io.vitess/vitess-client)