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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-notes check subcommand #3406

Merged
merged 5 commits into from Jan 4, 2024
Merged

Conversation

puerco
Copy link
Member

@puerco puerco commented Jan 4, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR adds a new check subcommand to release-notes. This command is designed tu run in CI to make it easy to enforce kubernetes-style release notes in PRs. The subcommand takes one or more PR numbers and will exit non-zero if the PRs are missing the release-notes block or a valid release note. It supports NONE or adding the release-note-none label to skip the note enforcement.

Here's the output from the subcommand help:

$] release-notes check  --help

release-notes check checks one or more PRs to ensure they contain
a valid release note. It is a subcommand designed to run in a postsubmit job to
block PRs missing a release note.

release-notes check will retrieve pull request data using the GitHub API and
look for a valid release notes block in the PR body. For example:

```release-note
Fixed a bug to make my software even more awesome
`` `

When enforcing release notes in PRs, we recommend adding the release-notes block
to your PR templates. See how Kubernetes does it here:
https://github.com/kubernetes/release/blob/d546da8a2ec580ea4c024637234cc976a6ba398a/.github/PULL_REQUEST_TEMPLATE.md?plain=1#L45-L57

If you want to skip the release notes check, you can create a new "release-notes-none"
label to your PR or type "NONE" in the notes block:

```release-note
NONE
`` `

Either of these will instruct the release note checked to allow a PR without a
valid note.

To generate release notes from these blocks, use release-notes generate.

Usage:
  release-notes check [flags]

Flags:
      --debug                    Enable debug logging
      --github-base-url string   Base URL of github
  -h, --help                     help for check
      --org string               Name of github organization (default "kubernetes")
      --pr ints                  pull request number(s) to check
      --repo string              Name of github repository (default "kubernetes")

When failing the subcommand will print a short help text to guide contributors looking at the logs:

release-notes check --pr=3403 --repo=release 

Error Checking Release Notes:

The pull request(s) specified do not have a valid release note.

Make sure the PRs have a ```release-note block (see help) in the PR body with markdown text
clearly specifying the change being introduced in your commits.

If you want to skip the release notes check, you can type NONE in the release notes block
or add a "release-notes-none" (without quotes) to your PR. This will
tell the release notes checker to allow PRs without a note.

For more information see:
https://github.com/kubernetes/release/tree/master/cmd/release-notes

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

This subcommand will be part of a new release-notes action in k-sigs/release-actions 馃殌
(first part is here)

/assign @cpanato

Does this PR introduce a user-facing change?

The `release-notes` utility will now have subcommands to support more functionality
- The original functionality of `release-notes` has now been moved to the `release-notes generate` subcommand. This is the default subcommand to avoid breaking compatibility.
- We now have a new `release-notes check` subcommand to verify if PRs have a valid release note

Signed-off-by: Adolfo Garc铆a Veytia (Puerco) adolfo.garcia@uservers.net

Signed-off-by: Adolfo Garc铆a Veytia (Puerco) <adolfo.garcia@uservers.net>
This commit adds a new subcommand to make the `generate` subcommand the
default when running the binary without a subcommand. This avoids breaking
compatibility with previous versions.

Signed-off-by: Adolfo Garc铆a Veytia (Puerco) <adolfo.garcia@uservers.net>
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels Jan 4, 2024
@k8s-ci-robot k8s-ci-robot added area/release-eng Issues or PRs related to the Release Engineering subproject approved Indicates a PR has been approved by an approver from all required OWNERS files. sig/release Categorizes an issue or PR as relevant to SIG Release. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 4, 2024
This commit adds a function that returns the release note of a pull request.

Signed-off-by: Adolfo Garc铆a Veytia (Puerco) <adolfo.garcia@uservers.net>
Signed-off-by: Adolfo Garc铆a Veytia (Puerco) <adolfo.garcia@uservers.net>
This commit adds a new "check" subcommand to the release-notes
utility.  This subcommand reads a PR from the github API and
check if it has a valid release note. If not it exits non-zero.

It is designed to easily add a PR check in CI to enforce authors
to add release notes.

Signed-off-by: Adolfo Garc铆a Veytia (Puerco) <adolfo.garcia@uservers.net>
Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool nice one

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 4, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cpanato, puerco

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 0fa36b7 into kubernetes:master Jan 4, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/release Categorizes an issue or PR as relevant to SIG Release. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants