Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update release note generation #3591

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
63 changes: 14 additions & 49 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ This ensures that new PRs against master will be automatically given the correct

## Preparing for the release

Review the milestone for this release and ensure it is accurate. https://github.com/tigera/operator/milestones

- Create any new milestones that should exist
- Create the next patch version
- If a new minor was released (`.0`), also ensure the next minor has been created (this should have already been created as part of [Preparing a new release branch](#preparing-a-new-release-branch))
- Review the milestone for this release and ensure it is accurate. https://github.com/tigera/operator/milestones
- Move any open PRs to a new milestone (*likely* the newly created one)
- Close the milestone for the release

## Updating versions

Expand Down Expand Up @@ -95,64 +101,23 @@ Go to the PR created and:

1. Create a git tag for the new commit on the release branch and push it:

```
git tag v1.30.3
git push --tags
```
```sh
git tag v1.30.3
git push --tags
```

1. Log in to semaphore and find the new build for the release branch commit, and
click 'Rerun'. When Semaphore starts the rebuild, it will notice the new tag and
build and publish an operator release.

## Release notes and milestones

1. Run the following command to generate release notes for the release

```
make release-notes VERSION=<TAG> GITHUB_TOKEN=<access-token>
```
1. Go to [releases](https://github.com/tigera/operator/releases) and edit the draft release for the release tag

1. Go to https://github.com/tigera/operator/releases and edit the release tag to include the generated release notes, and update the title.
1. Publish the release.

1. Close the milestone for this release. https://github.com/tigera/operator/milestones

1. Go to https://github.com/tigera/operator/milestones and create any new milestones that should exist
- Create the next patch version
- If a new minor was released (`.0`), also ensure the next minor has been created (this should have already been created as part of [Preparing a new release branch](#preparing-a-new-release-branch))
> NOTE: Only mark this release as latest if it is the highest released version

## Updates for new Calico CRDs

(TODO: We need to be able to detect new CRDs and do this automatically)

If the release includes new Calico CRDs, add the new CRDs to `hack/gen-bundle/get-manifests.sh` and `config/manifests/bases/operator.clusterserviceversion.yaml`.

## Publishing a release on the RH Catalog

(Note: We are not currently publishing to RH Catalog, but we will resume soon. These notes are left here for current and future reference.)

We currently only publish operator releases targeting Calico. If the release targets Calico, continue onto the following steps to generate the
operator bundle for it, and publish the release on the RH Catalog.

Before beginning, ensure that the docs at docs.projectcalico.org for the Calico version this operator release targets is live.

1. After the semaphore job in the releasing steps is complete, and images have been tagged and pushed, checkout the tag you released and create a new branch.

1. Login to our operator project on connect.redhat.com and publish the operator image on the RH Catalog. This step needs to happen before we generate and submit the operator bundle.

1. Create the operator bundle using `make bundle` with the required variables `VERSION`, `PREV_VERSION`, `CHANNELS`, and `DEFAULT_CHANNEL`:

**Note**: the version strings in `VERSION` and `PREV_VERSION` are semver strings without the v.

- **VERSION**: this release version. E.g. `1.13.1`
- **PREV_VERSION**: the latest published bundle version in this release stream. Navigate to the [certified operators production catalog](https://github.com/redhat-openshift-ecosystem/certified-operators/tree/main/operators/tigera-operator) and look for the most recent version from this release branch. E.g., if this release is `v1.24.11` but the most recently published v1.24.x bundle is `1.24.9` then you would use `VERSION=1.24.11` and `PREV_VERSION=1.24.9`. If this release is the first in this release branch, then there is no prior version so set `PREV_VERSION=0.0.0`.
- **CHANNELS** and **DEFAULT_CHANNEL**: should be set to the release branch of this operator release. E.g., if the operator release tag is `v1.23.5`, then CHANNELS and DEFAULT_CHANNEL should be `release-v1.23`.

For example:

```
make bundle VERSION=1.13.1 PREV_VERSION=1.13.0 CHANNELS=release-v1.13 DEFAULT_CHANNEL=release-v1.13
```

This step will create the bundle `bundle/1.13.1`.

1. Publish the generated operator bundle following the [Operator Certification CI Pipeline instructions](https://github.com/redhat-openshift-ecosystem/certification-releases/blob/main/4.9/ga/ci-pipeline.md). Bundles are no longer committed in this repository as they are committed in [redhat-openshift-ecosystem/certified-operators](https://github.com/redhat-openshift-ecosystem/certified-operators).
51 changes: 30 additions & 21 deletions hack/generate_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,36 @@ def issues_in_milestone() -> list:
"""
repo = g.get_repo("tigera/operator")

# Find the milestone. This finds all open milestones.
milestones = repo.get_milestones()
for m in milestones:
if m.title == VERSION:
# Found the milestone in this repo - look for issues (but only
# ones that have been closed!)
print(f" found milestone {m.title}")
milestone_issues = repo.get_issues(
milestone=m, state="closed", labels=["release-note-required"]
)
issues = []
for issue in milestone_issues:
pr = issue.as_pull_request()
if pr.merged:
# Filter out PRs which are closed but not merged.
issues.append(issue)
elif pr.state == "open":
print(f"WARNING: {pr.number} is still open, remove from milestione... skipping")
if len(issues) == 0:
raise ReleaseNoteError(f"no issues found for milestone {m.title}")
return issues
# Find the milestone to get the id.
milestones = repo.get_milestones(state="all")
# Filter for the milestone we're interested in.
milestone = [m for m in milestones if m.title == VERSION]
m = milestone[0] if milestone else None
if not m:
raise ReleaseNoteError(f"milestone {VERSION} not found")
# Ensure the milestone is closed before generating release notes.
if m.state != "closed":
raise ReleaseNoteError(
f"milestone {m.title} is not closed, please close it before generating release notes"
)
print(f" found milestone {m.title}")
milestone_issues = repo.get_issues(
milestone=m, state="closed", labels=["release-note-required"]
)
# If there are no issues in the milestone, raise an error.
if len(milestone_issues) == 0:
raise ReleaseNoteError(f"no issues found for milestone {m.title}")
open_issues = [
issue for issue in milestone_issues if issue.as_pull_request().state == "open"
]
# If there are open issues in the milestone, raise an error.
if len(open_issues) > 0:
raise ReleaseNoteError(
f"{len(open_issues)} PRs are still open, remove from milestone"
)

# Return only the merged PRs
return [issue for issue in milestone_issues if issue.as_pull_request().merged]


def extract_release_notes(issue: Issue) -> list:
Expand Down
Loading