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
Copy file name to clipboardExpand all lines: docs/book/src/plugins/available/autoupdate-v1-alpha.md
+22-17Lines changed: 22 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ With a small amount of setup, you can receive **automatic Pull Request** suggest
5
5
Kubebuilder release is available — keeping your project **maintained, secure, and aligned with ecosystem changes**.
6
6
7
7
This automation uses the [`kubebuilder alpha update`][alpha-update-command] command with a **3-way merge strategy** to
8
-
refresh your project scaffold, and wraps it in a GitHub Actions workflow that opens an **Issue** with a **Pull Request compare link** so you can create the PR and review it.
8
+
refresh your project scaffold, and wraps it in a GitHub Actions workflow that **creates Pull Requests** for review. Alternatively, you can use `--only-issue` to create Issues instead of PRs.
Copy file name to clipboardExpand all lines: docs/book/src/reference/commands/alpha_update.md
+43-21Lines changed: 43 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,8 +68,9 @@ The command creates three temporary branches:
68
68
-`--conflict-message`: customize the commit message when conflicts occur.
69
69
-`--push`: push the result to `origin` automatically.
70
70
-`--git-config`: sets git configurations.
71
-
-`--open-gh-issue`: create a GitHub issue with a checklist and compare link (requires `gh`).
72
-
-`--use-gh-models`: add an AI overview **comment** to that issue using `gh models`
71
+
-`--open-gh-issue`: create a GitHub issue with instructions to run update locally (requires `gh`).
72
+
-`--open-gh-pr`: create a GitHub pull request directly after the update (requires `gh`). **(requires branch name to start with `kubebuilder-update-from-`)**
73
+
-`--use-gh-models`: add an AI summary to the PR description using `gh models` (only works with `--open-gh-pr`)
73
74
74
75
### Step 5: Cleanup
75
76
- Once the output branch is ready, all the temporary working branches are deleted.
@@ -157,41 +158,61 @@ make manifests generate fmt vet lint-fix
157
158
make all
158
159
```
159
160
160
-
## Using with GitHub Issues (`--open-gh-issue`) and AI (`--use-gh-models`) assistance
161
+
## Using with GitHub (`--open-gh-issue` / `--open-gh-pr`) and AI (`--use-gh-models`) assistance
161
162
162
-
Pass `--open-gh-issue` to have the command create a GitHub **Issue** in your repository
163
-
to assist with the update. Also, if you also pass `--use-gh-models`, the tool posts a follow-up comment
164
-
on that Issue with an AI-generated overview of the most important changes plus brief conflict-resolution
165
-
guidance.
163
+
### Creating GitHub Issues (`--open-gh-issue`)
166
164
167
-
### Examples
165
+
Pass `--open-gh-issue` to have the command create a GitHub **Issue** in your repository with instructions
166
+
to run the update locally. This requires minimal permissions (read repo, write issues).
**Important:**`--open-gh-issue` and `--open-gh-pr` are mutually exclusive. Choose one based on your workflow and permissions.
207
+
208
+
### What you’ll see
188
209
189
-
Moreover, AI models are used to help you understand what changes are needed to keep your project up to date,
190
-
and to suggest resolutions if conflicts are encountered, as in the following example:
210
+
With `--use-gh-models`, AI models help you understand what changes are needed to keep your project up to date,
211
+
and suggest resolutions if conflicts are encountered.
191
212
192
213
### Automation
193
214
194
-
This integrates cleanly with automation. The [`autoupdate.kubebuilder.io/v1-alpha`][autoupdate-plugin] plugin can scaffold a GitHub Actions workflow that runs the command on a schedule (e.g., weekly). When a new Kubebuilder release is available, it opens an Issue with a compare link so you can create the PR and review it.
215
+
This integrates cleanly with automation. The [`autoupdate.kubebuilder.io/v1-alpha`][autoupdate-plugin] plugin can scaffold a GitHub Actions workflow that runs the command on a schedule (e.g., weekly). By default, it creates Pull Requests directly, but you can use `--only-issue` to create Issues instead.
195
216
196
217
## Changing Extra Git configs only during the run (does not change your ~/.gitconfig)_
197
218
@@ -241,13 +262,14 @@ We use that value to pick the correct CLI for re-scaffolding.
241
262
|`--from-version`| Kubebuilder release to update **from** (e.g., `v4.6.0`). If unset, read from the `PROJECT` file when possible. |
242
263
|`--git-config`| Repeatable. Pass per-invocation Git config as `-c key=value`. **Default** (if omitted): `-c merge.renameLimit=999999 -c diff.renameLimit=999999`. Your configs are applied on top. To disable defaults, include `--git-config disable`. |
243
264
|`--merge-message`| Custom commit message for successful merges (no conflicts). Defaults to `chore(kubebuilder): update scaffold <from> -> <to>`. |
244
-
|`--open-gh-issue`| Create a GitHub issue with a pre-filled checklist and compare link after the update completes (requires `gh`). |
265
+
|`--open-gh-issue`| Create a GitHub issue with instructions to run update locally (requires `gh`). Mutually exclusive with `--open-gh-pr`. |
266
+
|`--open-gh-pr`| Create a GitHub pull request directly after the update completes (requires `gh`). Mutually exclusive with `--open-gh-issue`. **Security:** Branch name must start with `kubebuilder-update-from-`. |
245
267
|`--output-branch`| Name of the output branch. Default: `kubebuilder-update-from-<from-version>-to-<to-version>`. |
246
268
|`--push`| Push the output branch to the `origin` remote after the update completes. |
247
269
|`--restore-path`| Repeatable. Paths to preserve from the base branch when squashing (e.g., `.github/workflows`). **Not supported** with `--show-commits`. |
248
270
|`--show-commits`| Keep full history (do not squash). **Not compatible** with `--restore-path`. |
249
271
|`--to-version`| Kubebuilder release to update **to** (e.g., `v4.7.0`). If unset, defaults to the latest available release. |
250
-
|`--use-gh-models`|Post an AI overview as an issue comment using `gh models`. Requires `gh` + `gh-models` extension. Effective only when`--open-gh-issue` is also set.|
272
+
|`--use-gh-models`|Generate an AI summary using `gh models` and add it to the PR description. Requires `gh` + `gh-models` extension. Only works with`--open-gh-pr`. |
Copy file name to clipboardExpand all lines: internal/cli/alpha/internal/update/helpers/open_gh_issue.go
+14-53Lines changed: 14 additions & 53 deletions
Original file line number
Diff line number
Diff line change
@@ -36,73 +36,34 @@ const (
36
36
// IssueTitleTmpl is the title template for the GitHub issue.
37
37
constIssueTitleTmpl="[Action Required] Upgrade the Scaffold: %[2]s -> %[1]s"
38
38
39
-
// IssueBodyTmpl is used when no conflicts are detected during the merge.
39
+
// CommonDescriptionTmpl is the base description used for both issues and PRs.
40
+
// Parameters: [1]=toVersion, [2]=fromVersion
40
41
//
41
42
//nolint:lll
42
-
constIssueBodyTmpl=`## Description
43
+
constCommonDescriptionTmpl=`## Description
43
44
44
-
Upgrade your project to use the latest scaffold changes introduced in Kubebuilder [%[1]s](https://github.com/kubernetes-sigs/kubebuilder/releases/tag/%[1]s).
45
+
Upgrade project to use the scaffold changes introduced in Kubebuilder [%[1]s](https://github.com/kubernetes-sigs/kubebuilder/releases/tag/%[1]s).
45
46
46
-
See the release notes from [%[3]s](https://github.com/kubernetes-sigs/kubebuilder/releases/tag/%[3]s) to [%[1]s](https://github.com/kubernetes-sigs/kubebuilder/releases/tag/%[1]s) for details about the changes included in this upgrade.
47
-
48
-
## What to do
49
-
50
-
A scheduled workflow already attempted this upgrade and created the branch %[4]s to help you in this process.
51
-
52
-
Create a Pull Request using the URL below to review the changes:
See the release notes from [%[2]s](https://github.com/kubernetes-sigs/kubebuilder/releases/tag/%[2]s) to [%[1]s](https://github.com/kubernetes-sigs/kubebuilder/releases/tag/%[1]s) for details about the changes included in this upgrade.
63
48
`
64
49
65
-
// IssueBodyTmplWithConflicts is used when conflicts are detected during the merge.
50
+
// IssueBodyTmpl is the complete issue body template.
51
+
// Parameters: [1]=toVersion, [2]=fromVersion
66
52
//
67
53
//nolint:lll
68
-
constIssueBodyTmplWithConflicts=`## Description
69
-
70
-
Upgrade your project to use the latest scaffold changes introduced in Kubebuilder [%[1]s](https://github.com/kubernetes-sigs/kubebuilder/releases/tag/%[1]s).
71
-
72
-
See the release notes from [%[3]s](https://github.com/kubernetes-sigs/kubebuilder/releases/tag/%[3]s) to [%[1]s](https://github.com/kubernetes-sigs/kubebuilder/releases/tag/%[1]s) for details about the changes included in this upgrade.
73
-
54
+
constIssueBodyTmpl=CommonDescriptionTmpl+`
74
55
## What to do
75
56
76
-
A scheduled workflow already attempted this upgrade and created the branch (%[4]s) to help you in this process.
77
-
78
-
:warning: **Conflicts were detected during the merge.**
79
-
80
-
Create a Pull Request using the URL below to review the changes and resolve conflicts manually:
81
-
%[2]s
57
+
Run the command `+"`alpha update`"+` locally. This upgrades your scaffold and preserves your changes using a 3-way merge.
82
58
83
-
## Next steps
59
+
More info: https://kubebuilder.io/reference/commands/alpha_update
This will create a new branch (my-fix-branch) with the update applied.
98
-
Resolve conflicts there, complete the merge locally, and push the branch.
61
+
> Note: If you want to automate PR creation, use the latest Kubebuilder release and run: `+"`kubebuilder edit --plugins=\"autoupdate/v1-alpha\" --force`"+`
62
+
`
99
63
100
-
### 3. Verify the changes
101
-
- Build the project
102
-
- Run tests
103
-
- Confirm everything still works
64
+
// ConflictWarningForIssue is prepended to "What to do" section when conflicts exist.
65
+
constConflictWarningForIssue=`:warning: **Conflicts were detected during the merge.**
0 commit comments