github.com/fabianvf/ocp-release-operator-sdk@v0.0.0-20190426141702-57620ee2f090/doc/dev/release.md (about)

     1  # Releases
     2  
     3  Making an Operator SDK release involves:
     4  
     5  - Updating `CHANGELOG.md`.
     6  - Tagging and signing a git commit and pushing the tag to GitHub.
     7  - Building a release binary and signing the binary
     8  - Creating a release by uploading binary, signature, and `CHANGELOG.md` updates for the release to GitHub.
     9  - Creating a patch version branch of the form `v1.2.x` for major and minor releases.
    10  
    11  Releases can only be performed by [maintainers][doc-maintainers].
    12  
    13  ## Dependency and platform support
    14  
    15  ### Go version
    16  
    17  Release binaries will be built with the Go compiler version specified in the Operator SDK's [prerequisites section][doc-readme-prereqs].
    18  
    19  ### Kubernetes versions
    20  
    21  As the Operator SDK interacts directly with the Kubernetes API, certain API features are assumed to exist in the target cluster. The currently supported Kubernetes version will always be listed in the SDK [prerequisites section][doc-readme-prereqs].
    22  
    23  ### Operating systems and architectures
    24  
    25  Release binaries will be built for the `x86_64` architecture for both GNU Linux and MacOS Darwin platforms.
    26  
    27  Support for the Windows platform or any architecture other than `x86_64` is not on the roadmap at this time.
    28  
    29  ## Binaries and signatures
    30  
    31  Binaries will be signed using a maintainers' verified GitHub PGP key. Both binary and signature will be uploaded to the release. Ensure you import maintainer keys to verify release binaries.
    32  
    33  ## Release tags
    34  
    35  Every release will have a corresponding git semantic version tag beginning with `v`, ex. `v1.2.3`.
    36  
    37  Make sure you've [uploaded your GPG key][link-github-gpg-key-upload] and configured git to [use that signing key][link-git-config-gpg-key] either globally or for the Operator SDK repository. Tagging will be handled by `release.sh`.
    38  
    39  **Note:** the email the key is issued for must be the email you use for git.
    40  
    41  ```bash
    42  $ git config [--global] user.signingkey "$GPG_KEY_ID"
    43  $ git config [--global] user.email "$GPG_EMAIL"
    44  ```
    45  
    46  ## Release Notes
    47  
    48  Release notes should thoroughly describe changes made to code, documentation, and design of the SDK. PR links should be included wherever possible.
    49  
    50  The following sections, often directly copied from our [changelog][doc-changelog], are used as release notes:
    51  
    52  ```Markdown
    53  [Version as title, ex. v1.2.3]
    54  
    55  ### Added
    56  - [Short description of feature added] (#PR)
    57  ...
    58  
    59  ### Changed
    60  - [Short description of change made] (#PR)
    61  ...
    62  
    63  ### Deprecated
    64  - [Short description of feature deprecated] (#PR)
    65  ...
    66  
    67  ### Removed
    68  - [Short description of feature removed] (#PR)
    69  ...
    70  
    71  ### Bug Fixes
    72  - [Short description of bug and fix] (#PR)
    73  ...
    74  ```
    75  
    76  ## Release Signing
    77  
    78  When a new release is created, the tag for the commit it signed with a maintainers' gpg key and
    79  the binaries for the release are also signed by the same key. All keys used by maintainers will
    80  be available via public PGP keyservers such as pool.sks-keyservers.net.
    81  
    82  For new maintainers who have not done a release and do not have their PGP key on a public
    83  keyserver, output your armored public key using this command:
    84  
    85  ```sh
    86  $ gpg --armor --export "$GPG_EMAIL" > mykey.asc
    87  ```
    88  
    89  Then, copy and paste the content of the outputted file into the `Submit a key` section on
    90  pool.sks-keyservers.net or any other public keyserver that synchronizes
    91  the key to other public keyservers. Once that is done, other people can download your public
    92  key and you are ready to sign releases.
    93  
    94  ## Verifying a release
    95  
    96  To verify a git tag signature, use this command:
    97  
    98  ```sh
    99  $ git verify-tag --verbose "$TAG_NAME"
   100  ```
   101  
   102  To verify a release binary using the provided asc files, place the binary and corresponding asc
   103  file into the same directory and use the corresponding command:
   104  
   105  ```sh
   106  # macOS
   107  $ gpg --verify operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin.asc
   108  # GNU/Linux
   109  $ gpg --verify operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu.asc
   110  ```
   111  
   112  If you do not have the maintainers public key on your machine, you will get an error message similar
   113  to this:
   114  
   115  ```sh
   116  $ git verify-tag ${TAG_NAME}
   117  gpg: Signature made Wed 31 Oct 2018 02:57:31 PM PDT
   118  gpg:                using RSA key 4AEE18F83AFDEB23
   119  gpg: Cant check signature: public key not found
   120  ```
   121  
   122  To download the key, use this command, replacing `$KEY_ID` with the RSA key string provided in the output
   123  of the previous command:
   124  
   125  ```sh
   126  $ gpg --recv-key "$KEY_ID"
   127  ```
   128  
   129  Now you should be able to verify the tags and/or binaries.
   130  
   131  ## Release steps
   132  
   133  These steps describe how to conduct a release of the SDK, upgrading from `v1.2.0` to `v1.3.0`. Replace these versions with the current and new version you are releasing, respectively.
   134  
   135  **Note:** `master` should be frozen between steps 1 and 3 so that all commits will be either in the new release or have a pre-release version, ex. `v1.2.0+git`. Otherwise commits might be built into a release that shouldn't or have an incorrect version, which makes debugging user issues difficult.
   136  
   137  ### (Patch release only) Cherry-picking to a release branch
   138  
   139  As more than one patch may be created per minor release, branch names of the form `v1.3.x` are created after a minor version is released. Bug fixes will be merged into the release branch only after testing.
   140  
   141  Add fixes to the release branch by doing the following:
   142  
   143  ```bash
   144  $ git checkout v1.3.x
   145  $ git checkout -b release-v1.3.1
   146  $ git cherry-pick "$GIT_COMMIT_HASH" # Usually from master
   147  $ git push origin release-v1.3.1
   148  ```
   149  
   150  Create a PR from `release-v1.3.1` to `v1.3.x`. Once CI passes and your PR is merged, continue to step 1.
   151  
   152  ### 1. Create a PR for release version and CHANGELOG.md updates
   153  
   154  Once all PR's needed for a release have been merged, branch from `master`:
   155  
   156  ```sh
   157  $ git checkout master
   158  $ git pull
   159  ```
   160  
   161  If making a patch release, check out the corresponding minor version branch:
   162  
   163  ```sh
   164  $ git checkout v1.2.x
   165  $ git pull
   166  ```
   167  
   168  Create a new branch to push release commits:
   169  
   170  ```sh
   171  $ git checkout -b release-v1.3.0
   172  ```
   173  
   174  Commit changes to the following six files:
   175  
   176  - `version/version.go`: update `Version` to `v1.3.0`.
   177  - `internal/pkg/scaffold/gopkgtoml.go`, under the `[[constraint]]` for `github.com/operator-framework/operator-sdk`:
   178    - Comment out `branch = "master"`
   179    - Un-comment `version = "v1.2.0"`
   180    - Change `v1.2.0` to `v1.3.0`
   181  - `internal/pkg/scaffold/gopkgtoml_test.go`: same as for `internal/pkg/scaffold/gopkgtoml.go`.
   182  - `internal/pkg/scaffold/ansible/gopkgtoml.go`: same as for `internal/pkg/scaffold/gopkgtoml.go`.
   183  - `internal/pkg/scaffold/helm/gopkgtoml.go`: same as for `internal/pkg/scaffold/gopkgtoml.go`.
   184  - `CHANGELOG.md`: update the `## Unreleased` header to `## v1.3.0`.
   185  
   186  Create a new PR for `release-v1.3.0`.
   187  
   188  ### 2. Create a release tag, binaries, and signatures
   189  
   190  The top-level `release.sh` script will take care of verifying versions in files described in step 1, and tagging and verifying the tag, as well as building binaries and generating signatures by calling `make release`.
   191  
   192  Call the script with the only argument being the new SDK version:
   193  
   194  ```sh
   195  $ ./release.sh v1.3.0
   196  ```
   197  
   198  Release binaries and signatures will be in `build/`. Both binary and signature file names contain version, architecture, and platform information; signature file names correspond to the binary they were generated from suffixed with `.asc`. For example, signature file `operator-sdk-v1.3.0-x86_64-apple-darwin.asc` was generated from a binary named `operator-sdk-v1.3.0-x86_64-apple-darwin`. To verify binaries and tags, see the [verification section](#verifying-a-release).
   199  
   200  **Note:** you must have both [`git`][doc-git-default-key] and [`gpg`][doc-gpg-default-key] default PGP keys set locally for `release.sh` to run without error. Additionally you must add your PGP key to a [public-key-server](#release-signing).
   201  
   202  Push tag `v1.3.0` upstream:
   203  
   204  ```sh
   205  $ git push --tags
   206  ```
   207  
   208  Once this tag passes CI, go to step 3. For more info on tagging, see the [release tags section](#release-tags).
   209  
   210  **Note:** If CI fails for some reason, you will have to revert the tagged commit, re-commit, and make a new PR.
   211  
   212  ### 3. Create a PR for post-release version and CHANGELOG.md updates
   213  
   214  Check out a new branch from master (or use your `release-v1.3.0`) and commit the following changes:
   215  
   216  - `version/version.go`: update `Version` to `v1.3.0+git`.
   217  - `internal/pkg/scaffold/gopkgtoml.go`, under the `[[constraint]]` for `github.com/operator-framework/operator-sdk`:
   218    - Comment out `version = "v1.3.0"`
   219    - Un-comment `branch = "master"`
   220  - `internal/pkg/scaffold/gopkgtoml_test.go`: same as for `internal/pkg/scaffold/gopkgtoml.go`.
   221  - `internal/pkg/scaffold/ansible/gopkgtoml.go`: same as for `internal/pkg/scaffold/gopkgtoml.go`.
   222  - `internal/pkg/scaffold/helm/gopkgtoml.go`: same as for `internal/pkg/scaffold/gopkgtoml.go`.
   223  - `CHANGELOG.md`: add the following as a new set of headers above `## v1.3.0`:
   224  
   225      ```markdown
   226      ## Unreleased
   227  
   228      ### Added
   229  
   230      ### Changed
   231  
   232      ### Deprecated
   233  
   234      ### Removed
   235  
   236      ### Bug Fixes
   237      ```
   238  
   239  Create a new PR for this branch. Once this PR passes CI and is merged, `master` can be unfrozen.
   240  
   241  ### 4. Releasing binaries, signatures, and release notes
   242  
   243  The final step is to upload binaries, their signature files, and release notes from `CHANGELOG.md`.
   244  
   245  **Note:** if this is a pre-release, make sure to check the `This is a pre-release` box under the file attachment frame. If you are not sure what this means, ask another maintainer.
   246  
   247  1. Go to the SDK [release page][release-page] and click the `Draft a new release` button in the top right corner.
   248  1. Select the tag version `v1.3.0`, and set the title to `v1.3.0`.
   249  1. Copy and paste any `CHANGELOG.md` under the `v1.3.0` header that have any notes into the description form.
   250  1. Attach all binaries and `.asc` signature files to the release by dragging and dropping them.
   251  1. Click the `Publish release` button.
   252  
   253  You've now fully released a new version of the Operator SDK. Good work! However, there is one more step that needs to be completed: making a release branch to allow us to make patch fixes for this release.
   254  
   255  ### 5. Making a new release branch
   256  
   257  If you have created a new major or minor release, you need to make a new branch for it. To do this, checkout the tag that you created and make a new branch that matches the version you released with `x` in the position of the patch number. For example, to make a new release branch after `v1.3.0` and push it to the repo, you would follow these steps:
   258  
   259  ```console
   260  $ git checkout tags/v1.3.0
   261  Note: checking out 'tags/v1.3.0'.
   262  ...
   263  $ git checkout -b v1.3.x
   264  Switched to a new branch 'v1.3.x'
   265  $ git push origin v1.3.x
   266  Total 0 (delta 0), reused 0 (delta 0)
   267  remote:
   268  remote: Create a pull request for 'v1.3.x' on GitHub by visiting:
   269  remote:      https://github.com/operator-framework/operator-sdk/pull/new/v1.3.x
   270  remote:
   271  To github.com:operator-framework/operator-sdk.git
   272   * [new branch]      v1.3.x -> v1.3.x
   273  ```
   274  
   275  Now that the branch exists, you need to make the post-release PR for the new release branch. To do this, simply follow the same steps as in [step 3](#3-create-a-pr-for-post-release-version-and-changelogmd-updates) with the addition of changing the branch name in the `gopkgtoml` scaffold from `master` to the new branch (for example, `v1.3.x`). Then, make the PR against the new branch.
   276  
   277  [doc-maintainers]:../../MAINTAINERS
   278  [doc-readme-prereqs]:../../README.md#prerequisites
   279  [doc-git-default-key]:https://help.github.com/en/articles/telling-git-about-your-signing-key
   280  [doc-gpg-default-key]:https://lists.gnupg.org/pipermail/gnupg-users/2001-September/010163.html
   281  [link-github-gpg-key-upload]:https://github.com/settings/keys
   282  [link-git-config-gpg-key]:https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work
   283  [doc-changelog]:../../CHANGELOG.md
   284  [release-page]:https://github.com/operator-framework/operator-sdk/releases