Skip to content

Add automation to enforce releaseChannel annotation on new proto fields#3682

Open
gabriel9895 wants to merge 1 commit intoistio:masterfrom
gabriel9895:fix/check-release-channel
Open

Add automation to enforce releaseChannel annotation on new proto fields#3682
gabriel9895 wants to merge 1 commit intoistio:masterfrom
gabriel9895:fix/check-release-channel

Conversation

@gabriel9895
Copy link
Copy Markdown

Fixes #3147

Problem

Per GUIDELINES.md, new fields added to Istio
API protos must include a // +cue-gen::releaseChannel:extended comment annotation to indicate
they belong to the extended release channel before being promoted to stable. Currently this relies
entirely on reviewer memory — there is no automated enforcement.

Solution

A new lint script (scripts/check-release-channel.sh) that:

  1. Diffs proto files against the base branch to identify newly added lines
  2. Detects proto field definitions (string, repeated, map<K,V>, qualified types like
    google.protobuf.Duration)
  3. For each new field, walks upward through the contiguous comment block looking for the releaseChannel
    annotation
  4. Exits non-zero with clear error messages if any new field is missing the annotation

The check is diff-based rather than static because the vast majority of existing fields are already stable
and intentionally lack the annotation — only newly added fields require it.

Reason to write shell script

The annotation lives in proto comments, which are not preserved in compiled protobuf descriptors. A Go-
based approach would require a new source-level proto parser dependency. Shell is consistent with the
existing lint scripts in scripts/ (check-operator-proto.sh, check-imports.sh).

Integration

Added to local-lint-protos in Makefile.core.mk, so it runs automatically as part of make lint →
make presubmit in Prow CI.

Testing

Includes scripts/check-release-channel_test.sh with 8 test cases:

Test Expected
No proto changes Pass
New field without annotation Fail
New field with annotation Pass
repeated field without annotation Fail
map<K,V> field without annotation Fail
Enum values (not fields) Pass — ignored
Mix of annotated + unannotated fields Fail — catches only the bad one
Changes in common-protos/ Pass — excluded

Files changed

  • scripts/check-release-channel.sh — the lint script
  • scripts/check-release-channel_test.sh — test suite
  • Makefile.core.mk — one line added to local-lint-protos

@gabriel9895 gabriel9895 requested a review from a team as a code owner March 30, 2026 18:58
@istio-policy-bot
Copy link
Copy Markdown

😊 Welcome @caoyukun0430! This is either your first contribution to the Istio api repo, or it's been
a while since you've been here.

You can learn more about the Istio working groups, Code of Conduct, and contribution guidelines
by referring to Contributing to Istio.

Thanks for contributing!

Courtesy of your friendly welcome wagon.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 30, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: gabriel9895 / name: Gabriel Cao (bcc4746)

@istio-testing istio-testing added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test labels Mar 30, 2026
@istio-testing
Copy link
Copy Markdown
Collaborator

Hi @caoyukun0430. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@keithmattix
Copy link
Copy Markdown
Contributor

/ok-to-test

@istio-testing istio-testing added ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. and removed needs-ok-to-test labels Mar 30, 2026
@gabriel9895
Copy link
Copy Markdown
Author

This PR adds internal CI tooling (lint script + tests) with no user-facing changes — no API, proto, or behavior modifications.

/release-notes-none

@keithmattix keithmattix added the release-notes-none Indicates a PR that does not require release notes. label Mar 30, 2026
@keithmattix
Copy link
Copy Markdown
Contributor

/retest

@gabriel9895 gabriel9895 force-pushed the fix/check-release-channel branch from 9196723 to ad88cc6 Compare March 31, 2026 09:52
Adds a lint check that ensures newly added proto fields include a
+cue-gen:<APIName>:releaseChannel:extended annotation.

Fixes istio#3147

Signed-off-by: Gabriel Cao <13051583793@yeah.net>
@gabriel9895 gabriel9895 force-pushed the fix/check-release-channel branch from ad88cc6 to bcc4746 Compare April 1, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. release-notes-none Indicates a PR that does not require release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add automation to ensure new fields are added to extended release channel

4 participants