Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ hack/release/ut:
sh -c '$(GIT_CONFIG_SSH) \
gotestsum --format=testname --junitfile report/release/ut.xml $(PACKAGE_NAME)/hack/release'


release-from: hack/bin/release var-require-all-VERSION-OPERATOR_BASE_VERSION var-require-one-of-EE_IMAGES_VERSIONS-OS_IMAGES_VERSIONS
hack/bin/release from

Expand All @@ -631,6 +630,9 @@ endif
release-prep: hack/bin/release hack/bin/gh var-require-all-VERSION var-require-one-of-CALICO_VERSION-ENTERPRISE_VERSION
@REPO=$(REPO) hack/bin/release prep

create-release-branch: hack/bin/release var-require-all-STREAM-CALICO_REF-ENTERPRISE_REF
RELEASE_STREAM=$(STREAM) hack/bin/release branch

###############################################################################
# Utilities
###############################################################################
Expand Down
68 changes: 23 additions & 45 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,35 @@

## Preparing a new release branch

For a major or minor release, you will need to create:
For a major or minor release, you will need to create a new `release-vX.Y` branch, a dev tag on master,
and a GitHub milestone for the next release. The `create-release-branch` Makefile target automates creating
the branch and dev tag; you will create the milestone manually in a later step:

- A new `release-vX.Y` branch based on the target minor version. We always do releases from a release
branch, not from master.
- An empty commit on the master branch, tagged with the "dev" version for the next minor release.
This ensures that `git describe --tags` (which is used to generate versions for CI builds) will
produce a version that "makes sense" for master commits after the release branch is created.
- A new GitHub milestone for the next minor release. This ensures that new PRs get auto-added to
the correct milestone.

To create a new release branch:

1. If needed, fetch the latest changes from the repository remote `<remote>`:

```sh
git fetch <remote>
```

1. Create a new branch based on the target minor version:

```sh
git checkout <remote>/master -b release-vX.Y
```

1. Push the new branch to the repository:
```sh
make create-release-branch STREAM=vX.Y CALICO_REF=<calico-git-ref> ENTERPRISE_REF=<enterprise-git-ref>
```

```sh
git push <remote> release-vX.Y
```
This command:

To create an empty commit and tag on master; run the following commands. This will push directly to master,
bypassing the normal PR process. This is important to make sure that the tag is directly on the master branch.
We create an empty commit because, when the release branch is created, it shares its commit history with master.
So, if we tagged the tip of master, we'd also be tagging the tip of the release branch, which would give
incorrect results for `git describe --tags` on the release branch.
- Creates a `release-vX.Y` branch from master
- Updates `config/calico_versions.yml` and `config/enterprise_versions.yml` to point at the given refs
- Runs `make fix gen-versions-calico gen-versions-enterprise` to regenerate files
- Commits the changes to the release branch
- Switches back to master, creates an empty commit, and tags it `vX.(Y+1).0-0.dev`
- Pushes the release branch, master, and tag to the remote

```sh
git checkout <remote>/master
git commit --allow-empty -m "Start development on vX.Y" # Where vX.Y is the next minor version
git tag vX.Y.0-0.dev
git push <remote> HEAD:master # Note: if someone updates master before you push, delete the tag and start over from the new tip of master.
git push <remote> vX.Y.0-0.dev
```
**Flags / environment variables:**

*Note* that the tag should have the exact format `vX.Y.0-0.dev` where `X.Y` is the next minor version.
The `-0.dev` suffix was chosen to produce a semver-compliant version that is less than the
first release version for the new minor version.
| Env var | Flag | Description |
| -------------------------------------- | ------------------------- | ----------------------------------------------------------------- |
| `STREAM` / `RELEASE_STREAM` (required) | `--stream` | Release stream, e.g., `v1.43` |
| `CALICO_REF` (required) | `--calico-ref` | Calico git ref (branch or tag), e.g., `release-v3.32` |
| `ENTERPRISE_REF` (required) | `--enterprise-ref` | Enterprise git ref (branch or tag), e.g., `release-calient-v3.22` |
| `RELEASE_BRANCH_PREFIX` | `--release-branch-prefix` | Branch name prefix (default: `release`) |

Finally, create the next minor release's first milestone at https://github.com/tigera/operator/milestones.
This would mean if the branch release-v1.30 is being created, then the milestone v1.31.0 should be created too.
This ensures that new PRs against master will be automatically given the correct tag.
After the branch is created, create the next minor release's first milestone at
https://github.com/tigera/operator/milestones (e.g., if `release-v1.43` was created,
create milestone `v1.44.0`).

## Preparing for the release

Expand Down
59 changes: 53 additions & 6 deletions hack/release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@
- [Build and publish a release](#build-and-publish-a-release)
- [Build and publish a hashrelease](#build-and-publish-a-hashrelease)
- [Commands](#commands)
- [release build](#release-build)
- [release branch](#release-branch)
- [Examples](#examples)
- [release publish](#release-publish)
- [release build](#release-build)
- [Examples](#examples-1)
- [release prep](#release-prep)
- [release publish](#release-publish)
- [Examples](#examples-2)
- [release notes](#release-notes)
- [release prep](#release-prep)
- [Examples](#examples-3)
- [release github](#release-github)
- [release notes](#release-notes)
- [Examples](#examples-4)
- [release from](#release-from)
- [release github](#release-github)
- [Examples](#examples-5)
- [release from](#release-from)
- [Examples](#examples-6)

## Installation

Expand Down Expand Up @@ -131,6 +133,51 @@ Unlike a release, a hashrelease is typically for either a Calico or Calico Enter

## Commands

### release branch

This command creates a new release branch for the operator.
It updates the calico and enterprise version configs on the release branch, regenerates files,
and commits the changes. It then switches back to master, creates an empty commit tagged
with `vX.Y.0-0.dev` (so that `git describe --tags` produces sensible versions for subsequent
master commits), and pushes the release branch, master, and tag to the remote.

Both `--calico-ref` and `--enterprise-ref` are required.
They specify the git ref (branch or tag) to use for each product's version config.

```sh
release branch --stream <vX.Y> --calico-ref <git-ref> --enterprise-ref <git-ref>
```

If the `--local` flag is specified, the branch and tag are created locally without pushing to the remote.

| Flag | Env var | Description |
|------|---------|-------------|
| `--stream` | `RELEASE_STREAM` | Release stream (e.g., `v1.43`). Required. |
| `--calico-ref` | `CALICO_REF` | Calico git ref (branch or tag). Required. |
| `--enterprise-ref` | `ENTERPRISE_REF` | Enterprise git ref (branch or tag). Required. |
| `--release-branch-prefix` | `RELEASE_BRANCH_PREFIX` | Branch name prefix (default: `release`). |
| `--local` | `LOCAL` | Skip pushing to remote. |

There is also a Makefile target:

```sh
make create-release-branch STREAM=vX.Y CALICO_REF=<ref> ENTERPRISE_REF=<ref>
```

#### Examples

1. To create a release branch for operator v1.43 with Calico v3.32 and Enterprise v3.22

```sh
release branch --stream v1.43 --calico-ref release-v3.32 --enterprise-ref release-calient-v3.22
```

1. To create a release branch locally without pushing

```sh
release branch --stream v1.43 --calico-ref release-v3.32 --enterprise-ref release-calient-v3.22 --local
```

### release build

This command builds the operator image for a specific operator version.
Expand Down
Loading
Loading