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 e2e tests and 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
+44Lines changed: 44 additions & 0 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,8 +87,46 @@ 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 update even with merge conflicts by committing conflict markers. |
84
91
|`-h, --help`| Show help for this command. |
85
92
93
+
<h1> Using the `--force` flag </h1>
94
+
95
+
When using the `--force` flag, merge conflicts will be committed with conflict markers in the `tmp-kb-update-merge` branch.
96
+
You should carefully review and resolve these conflicts before merging into your main branch.
97
+
98
+
After resolving conflicts, run the following command to ensure manifests and generated files are up to date:
99
+
```sh
100
+
make manifests generate fmt vet lint-fix
101
+
```
102
+
103
+
You might want to run `make all`, ensure that all tests are passing, and thoroughly validate the final result before committing and pushing a pull request to update your project from the `tmp-kb-update-merge` branch.
104
+
105
+
## Handling Merge Conflicts
106
+
107
+
If conflicts occur during a merge, Git will stop the process and leave the merge branch in a conflicted state for manual resolution.
108
+
109
+
To proceed with the merge despite conflicts, you can use the `--force` option. This is useful in automated environments, such as CI pipelines or cron jobs, where you want to create a pull request with the changes - even if conflicts are present.
110
+
111
+
```
112
+
kubebuilder alpha update --force
113
+
```
114
+
The resulting commit will include conflict markers in the affected files:
115
+
116
+
```
117
+
<<<<<<< HEAD
118
+
Your changes
119
+
=======
120
+
Incoming changes
121
+
>>>>>>> branch-name
122
+
```
123
+
124
+
The commit message will indicate that conflicts are present and need to be resolved manually.
125
+
126
+
<aside>
127
+
Note: 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.
0 commit comments