You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alpha(update): add --squash, --preserve-path, --output-branch for PR-friendly upgrades
This change makes `kubebuilder alpha update` produce a PR-ready branch and a
single squashed commit when requested, improving automation and review UX.
Key changes
-----------
• New `--squash` flag:
- Snapshots the exact tree of the temporary merge branch into ONE commit on a
stable branch: `kubebuilder-alpha-update-to-<to-version>`.
- Intended for opening/refreshing idempotent PRs.
- Gracefully handles "no changes" (git commit exits 1 → treated as no-op).
• New `--preserve-path` (repeatable):
- When squashing, restore given paths from the base branch (e.g.
`.github/workflows`) so CI/config files are kept as-is on the PR branch.
• New `--output-branch`:
- Overrides the default PR branch name created by `--squash`.
• Commit message used by `--squash`:
- `[kubebuilder-automated-update]: update scaffold from <from> to <to>; (squashed 3-way merge)`
• Behavior/ergonomics:
- Without `--force`: stops on conflicts on the temporary merge branch.
- With `--force`: commits conflict markers on the merge branch (automation-friendly).
- After merge, still best-effort run: `make manifests generate fmt vet lint-fix`.
Defaults / Compatibility
------------------------
- `--squash` is off by default (no behavior change unless opted-in).
- `--from-branch` defaults to `main`.
- `--preserve-path` is empty by default (no restores).
- Safe to run on projects scaffolded with v4.5.0+ (uses `alpha generate`).
Motivation
----------
Make upgrades PR-centric and automation-ready by producing a deterministic,
reviewable branch and a single squashed commit that mirrors the merge result.
Assisted-by: ChatGPT (OpenAI)
Co-authored-by: Vitor Floriano <[email protected]>
0 commit comments