Skip to content

ci: protect future release branches via ASF rulesets - #4582

Merged
Yicong-Huang merged 4 commits into
mainfrom
feat/release-branch-rulesets-api
Apr 30, 2026
Merged

Yicong-Huang merged 4 commits into
mainfrom
feat/release-branch-rulesets-api

Conversation

@Yicong-Huang

@Yicong-Huang Yicong-Huang commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Add an ASF .asf.yaml ruleset to protect future release/* branches.

We use github.rulesets here because protected_branches in ASF .asf.yaml requires explicit branch names, while rulesets can cover future release branches with release/*.

This ruleset is intended to mirror main by requiring:

  • pull requests
  • linear history
  • 1 approving review
  • the same required CI checks as main
  • no force-push
  • no branch deletion

Any related issues, documentation, discussions?

Closes #4579

How was this PR tested?

  • Validated .asf.yaml parses as YAML locally.
  • Created an equivalent native GitHub ruleset in my fork: ruleset #15794451
  • Verified the ruleset applies to release/*: branch rule evaluation
  • Verified a direct push to a protected release/* branch was rejected.
  • Verified branch deletion on a protected release/* branch was rejected.
  • Re-ran the test with the exact required CI list from latest origin/main. When pushing a full-tree release/* branch, GitHub rejected it with 10 of 10 required status checks are expected, which confirms the required-check set is being enforced.
  • Test PR in fork: Yicong-Huang/texera#3

Was this PR authored or co-authored using generative AI tooling?

Generated-by: OpenAI Codex GPT-5

@aglinxinyuan aglinxinyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@Yicong-Huang
Yicong-Huang enabled auto-merge (squash) April 30, 2026 22:29
@Yicong-Huang
Yicong-Huang merged commit 1045997 into main Apr 30, 2026
17 checks passed
@Yicong-Huang
Yicong-Huang deleted the feat/release-branch-rulesets-api branch April 30, 2026 22:40
Yicong-Huang added a commit that referenced this pull request May 1, 2026
### What changes were proposed in this PR?
Add a `meta:` block to `.asf.yaml` that opts the repository in to the
staged rollout of the asfyaml `rulesets:` directive:

```yaml
meta:
  environment: github_rulesets
```

Without this, the `Release Branch Protection` ruleset added in #4582 is
silently skipped: the strictyaml schema accepts `rulesets:`, but
`asfyaml/feature/github/rulesets.py` early-returns unless
`github_rulesets` is in `environments_enabled`.

### Any related issues, documentation, discussions?
- Closes #4603
- Follow-up to #4579 / #4582 (the ruleset config is already in
`.asf.yaml`; this PR makes it actually run)
- Verified the gap via the GitHub API:
  - `GET /repos/apache/texera/rulesets` → `[]`
- `GET /repos/apache/texera/rules/branches/release/v1.1.0-incubating` →
`[]`
- Verified the gating in `apache/infrastructure-asfyaml` source:
  - Schema accepts `rulesets:` (`asfyaml/feature/github/__init__.py`)
- Directive gated on `github_rulesets` env flag
(`asfyaml/feature/github/rulesets.py`, commit `8d2ca2c2` — \"Gate
rulesets directive behind github_rulesets environment for staged
rollout\")
- `meta.environment` is added to `environments_enabled`
(`asfyaml/asfyaml.py`)

### How was this PR tested?
- Diff is a 6-line addition to `.asf.yaml`; no code paths are exercised
locally.
- After merge, the expected outcome is that ASF Infra reconciles the
existing `Release Branch Protection` ruleset into the repo. Verification
plan post-merge:
- `gh api repos/apache/texera/rulesets` should return one entry named
`Release Branch Protection`
- `gh api repos/apache/texera/rules/branches/release/v1.1.0-incubating`
should list the required status checks and PR-review rule

### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.7
Yicong-Huang added a commit that referenced this pull request May 1, 2026
### What changes were proposed in this PR?

Reverts #4582 (commit `1045997b0e8f6bee850a27af53e65ae406d70481`), which
added a `release/*` ruleset to `.asf.yaml`.

ASF infra's support for the `rulesets` directive is still incomplete
(see also #4607 / apache/infrastructure-asfyaml#93). We'll protect
release branches via a different mechanism in a follow-up; reverting for
now to keep `.asf.yaml` clean and to unblock #4600.

### Any related issues, documentation, discussions?

Reopens #4579. Unblocks #4600.

### How was this PR tested?

Verified the ruleset never actually took effect — `GET
/repos/apache/texera/rulesets` returns `[]` and `GET
/repos/apache/texera/rules/branches/release/v1.1.0-incubating` returns
`[]`. So this revert is effectively a no-op against live GitHub state
and only cleans up `.asf.yaml`.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.7)
SarahAsad23 pushed a commit to SarahAsad23/texera that referenced this pull request May 4, 2026
…e#4616)

### What changes were proposed in this PR?

Reverts apache#4582 (commit `cfed1392322c9415b20f2d66542c42570235b618`), which
added a `release/*` ruleset to `.asf.yaml`.

ASF infra's support for the `rulesets` directive is still incomplete
(see also apache#4607 / apache/infrastructure-asfyaml#93). We'll protect
release branches via a different mechanism in a follow-up; reverting for
now to keep `.asf.yaml` clean and to unblock apache#4600.

### Any related issues, documentation, discussions?

Reopens apache#4579. Unblocks apache#4600.

### How was this PR tested?

Verified the ruleset never actually took effect — `GET
/repos/apache/texera/rulesets` returns `[]` and `GET
/repos/apache/texera/rules/branches/release/v1.1.0-incubating` returns
`[]`. So this revert is effectively a no-op against live GitHub state
and only cleans up `.asf.yaml`.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.7)
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
### What changes were proposed in this PR?
Add an ASF `.asf.yaml` ruleset to protect future `release/*` branches.

We use `github.rulesets` here because `protected_branches` in ASF
`.asf.yaml` requires explicit branch names, while `rulesets` can cover
future release branches with `release/*`.

This ruleset is intended to mirror `main` by requiring:
- pull requests
- linear history
- 1 approving review
- the same required CI checks as `main`
- no force-push
- no branch deletion

### Any related issues, documentation, discussions?
Closes apache#4579

### How was this PR tested?
- Validated `.asf.yaml` parses as YAML locally.
- Created an equivalent native GitHub ruleset in my fork: [ruleset
#15794451](https://github.com/Yicong-Huang/texera/rules/15794451)
- Verified the ruleset applies to `release/*`: [branch rule
evaluation](https://github.com/Yicong-Huang/texera/rules?ref=refs%2Fheads%2Frelease%2Fruleset-test)
- Verified a direct push to a protected `release/*` branch was rejected.
- Verified branch deletion on a protected `release/*` branch was
rejected.
- Re-ran the test with the exact required CI list from latest
`origin/main`. When pushing a full-tree `release/*` branch, GitHub
rejected it with `10 of 10 required status checks are expected`, which
confirms the required-check set is being enforced.
- Test PR in fork:
[Yicong-Huang#3](Yicong-Huang#3)

### Was this PR authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex GPT-5
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
### What changes were proposed in this PR?
Add a `meta:` block to `.asf.yaml` that opts the repository in to the
staged rollout of the asfyaml `rulesets:` directive:

```yaml
meta:
  environment: github_rulesets
```

Without this, the `Release Branch Protection` ruleset added in apache#4582 is
silently skipped: the strictyaml schema accepts `rulesets:`, but
`asfyaml/feature/github/rulesets.py` early-returns unless
`github_rulesets` is in `environments_enabled`.

### Any related issues, documentation, discussions?
- Closes apache#4603
- Follow-up to apache#4579 / apache#4582 (the ruleset config is already in
`.asf.yaml`; this PR makes it actually run)
- Verified the gap via the GitHub API:
  - `GET /repos/apache/texera/rulesets` → `[]`
- `GET /repos/apache/texera/rules/branches/release/v1.1.0-incubating` →
`[]`
- Verified the gating in `apache/infrastructure-asfyaml` source:
  - Schema accepts `rulesets:` (`asfyaml/feature/github/__init__.py`)
- Directive gated on `github_rulesets` env flag
(`asfyaml/feature/github/rulesets.py`, commit `8d2ca2c2` — \"Gate
rulesets directive behind github_rulesets environment for staged
rollout\")
- `meta.environment` is added to `environments_enabled`
(`asfyaml/asfyaml.py`)

### How was this PR tested?
- Diff is a 6-line addition to `.asf.yaml`; no code paths are exercised
locally.
- After merge, the expected outcome is that ASF Infra reconciles the
existing `Release Branch Protection` ruleset into the repo. Verification
plan post-merge:
- `gh api repos/apache/texera/rulesets` should return one entry named
`Release Branch Protection`
- `gh api repos/apache/texera/rules/branches/release/v1.1.0-incubating`
should list the required status checks and PR-review rule

### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.7
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
…e#4616)

### What changes were proposed in this PR?

Reverts apache#4582 (commit `1045997b0e8f6bee850a27af53e65ae406d70481`), which
added a `release/*` ruleset to `.asf.yaml`.

ASF infra's support for the `rulesets` directive is still incomplete
(see also apache#4607 / apache/infrastructure-asfyaml#93). We'll protect
release branches via a different mechanism in a follow-up; reverting for
now to keep `.asf.yaml` clean and to unblock apache#4600.

### Any related issues, documentation, discussions?

Reopens apache#4579. Unblocks apache#4600.

### How was this PR tested?

Verified the ruleset never actually took effect — `GET
/repos/apache/texera/rulesets` returns `[]` and `GET
/repos/apache/texera/rules/branches/release/v1.1.0-incubating` returns
`[]`. So this revert is effectively a no-op against live GitHub state
and only cleans up `.asf.yaml`.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add release-branch protections to asf.yaml

2 participants