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
This commit adds the --force flag to the alpha update command.
It also adds documentation for the flag.
The --force flag makes it possible to run the alpha update command in CI workflows.
Copy file name to clipboardExpand all lines: docs/book/src/reference/commands/alpha_update.md
+51-4Lines changed: 51 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,12 @@ kubebuilder alpha update \
61
61
--from-branch=main
62
62
```
63
63
64
+
Force update even with merge conflicts:
65
+
66
+
```sh
67
+
kubebuilder alpha update --force
68
+
```
69
+
64
70
<asideclass="note warning">
65
71
<h1>You might need to upgrade your project first</h1>
66
72
@@ -81,17 +87,58 @@ Once updated, you can use `kubebuilder alpha update` for future upgrades.
81
87
|`--from-version`|**Required for projects initialized with versions earlier than v4.6.0.** Kubebuilder version your project was created with. If unset, uses the `PROJECT` file. |
82
88
|`--to-version`| Version to upgrade to. Defaults to the latest version. |
83
89
|`--from-branch`| Git branch that contains your current project code. Defaults to `main`. |
90
+
|`--force`| Force the update even if conflicts occur. Conflicted files will include conflict markers, and a commit will be created automatically. Ideal for automation (e.g., cronjobs, CI). |
84
91
|`-h, --help`| Show help for this command. |
85
-
86
-
<asideclass="note warning">
87
-
<h1>Projects generated with </h1>
88
-
92
+
<asideclass="note">
89
93
Projects generated with **Kubebuilder v4.6.0** or later include the `cliVersion` field in the `PROJECT` file.
90
94
This field is used by `kubebuilder alpha update` to determine the correct CLI
91
95
version for upgrading your project.
96
+
</aside>
97
+
98
+
## Merge Conflicts with `--force`
99
+
100
+
When you use the `--force` flag with `kubebuilder alpha update`, Git will complete the merge even if there are conflicts. The resulting commit will include conflict markers like:
101
+
```
102
+
<<<<<<< HEAD
103
+
Your changes
104
+
=======
105
+
Incoming changes
106
+
>>>>>>> branch-name
107
+
```
108
+
These conflicts will be committed in the
109
+
`tmp-kb-update-merge` branch.
92
110
111
+
<asideclass="note warning">
112
+
You must manually resolve these conflicts before merging into your main branch.
113
+
114
+
```suggestion
115
+
<aside class="note warning">
116
+
<H1>If you face conflicts (using or not the --force flag) </H1>
117
+
If the merge introduces conflicts, you must resolve them and **ensure** you execute the following command to regenerate the manifests and organise the files properly:
118
+
119
+
```bash
120
+
make manifests generate fmt vet lint-fix
121
+
```
122
+
123
+
Alternatively, you may want to run:
124
+
125
+
```bash
126
+
make all
127
+
```
93
128
</aside>
94
129
130
+
131
+
## When to Use `--force`
132
+
Use `--force` only in scenarios like:
133
+
- Automated environments (e.g., CI pipelines or cron jobs)
134
+
- When you need to create a PR even if conflicts are present
135
+
- When a human will resolve the conflicts later
136
+
`kubebuilder alpha update --force`
137
+
138
+
This ensures the update proceeds without manual blocking but shifts responsibility for conflict resolution to a follow-up manual step.
139
+
140
+
This approach is typically used in automation workflows where conflict markers are later addressed by a human, or where preserving the conflicting changes is acceptable for follow-up processing.
141
+
95
142
## Requirements
96
143
97
144
- A valid [PROJECT][project-config] file at the root of your project
0 commit comments