Skip to content

Add --rerun mode to krel release-notes for updating existing draft PR branches #4348

Description

@kernel-kun

What would you like to be added:

A --rerun mode for krel release-notes that allows re-running against an existing draft PR branch, with full control over which fork/branch to fetch from and optionally push to.

New flags:

--rerun                             # enter rerun mode (mutually exclusive with --create-draft-pr)
--draft-pr-source-fork=org[/repo]   # which fork to fetch the existing branch from (required)
--draft-pr-source-branch=name       # branch to fetch (default: release-notes-draft-<tag>)
--draft-pr-push-fork=org[/repo]     # where to push results (optional — omit to work locally)
--draft-pr-push-branch=name         # branch name on push destination (default: source branch)

High-level flow:

         FIRST RUN (today)                    RERUN (proposed)
     ┌──────────────────────┐           ┌───────────────────────────────────┐
     │ --create-draft-pr    │           │ --rerun                           │
     │ --fork=me            │           │ --draft-pr-source-fork=colleague  │
     │ --tag=v1.36.0-beta.0 │           │ --tag=v1.36.0-beta.0              │
     └──────────┬───────────┘           │ --maps-from=./maps                │
                │                       │ --draft-pr-push-fork=me (optional)│
                ▼                       └──────────┬────────────────────────┘
     clone k/sig-release                           │
     branch off HEAD                               ▼
     generate notes                     clone k/sig-release
     push to fork                       fetch source branch from colleague's fork
     create PR                          apply --maps-from overrides
     cleanup tmp dir                    regenerate .md + .json
                                        optionally push to my fork
                                        preserve local clone for inspection

Why is this needed:

Today, after the initial krel release-notes --create-draft-pr run creates a PR against k/sig-release, reviewers suggest changes to the .md file. The author then needs to create map files and re-run krel with --maps-from to incorporate those suggestions — but krel fails on re-run because VerifyFork rejects the operation when the branch already exists on the fork:

Error: a branch named release-notes-draft-v1.36.0-beta.0 already exists in <user>/sig-release

There is no way to point krel at an existing branch. This forces a fully manual workflow for post-review updates (manually creating and editing maps, syncing those changes to .json & .md files manually, committing, and pushing by hand).

The problem is compounded when a different team member needs to pick up the rerun work --> there's no way to fetch a colleague's draft branch, apply maps, and push to one's own fork.

--maps-from already supports syncing map file overrides into .json and .md, so the generation machinery is in place. What's missing is the ability to:

  1. Skip the branch-existence gate (VerifyFork) when rerunning
  2. Fetch an existing branch from any fork instead of always branching off upstream HEAD
  3. Decouple source and destination i.e. fetch from fork A, push to fork B (or don't push at all)
  4. Preserve the local clone for inspection since no PR is being created

All changes would live in cmd/krel/cmd/release_notes.go — no modifications to release-sdk required. The rerun path would call lower-level SDK primitives (git.CleanCloneGitHubRepo, repo.AddRemote, repo.Checkout) directly, bypassing VerifyFork and PrepareFork.

Metadata

Metadata

Assignees

Labels

area/release-engIssues or PRs related to the Release Engineering subprojectkind/featureCategorizes issue or PR as related to a new feature.lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.needs-prioritysig/releaseCategorizes an issue or PR as relevant to SIG Release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions