@@ -210,25 +210,13 @@ func cleanupBranch() error {
210
210
return nil
211
211
}
212
212
213
- // runMakeTargets runs the specified make targets to ensure the project is in a good state.
214
- // If force is true, do not run target with || true to move forward when failures are faced .
215
- func runMakeTargets (force bool ) {
213
+ // runMakeTargets is a helper function to run make with the targets necessary
214
+ // to ensure all the necessary components are generated, formatted and linted .
215
+ func runMakeTargets () {
216
216
targets := []string {"manifests" , "generate" , "fmt" , "vet" , "lint-fix" }
217
-
218
217
for _ , target := range targets {
219
- var cmd []string
220
- var msg string
221
-
222
- if force {
223
- msg = fmt .Sprintf ("Running make %s (with --force)" , target )
224
- shellCmd := fmt .Sprintf ("make %s || true" , target )
225
- cmd = []string {"sh" , "-c" , shellCmd }
226
- } else {
227
- msg = fmt .Sprintf ("Running make %s" , target )
228
- cmd = []string {"make" , target }
229
- }
230
-
231
- if err := util .RunCmd (msg , cmd [0 ], cmd [1 :]... ); err != nil {
218
+ err := util .RunCmd (fmt .Sprintf ("Running make %s" , target ), "make" , target )
219
+ if err != nil {
232
220
log .Warn ("make target failed" , "target" , target , "error" , err )
233
221
}
234
222
}
@@ -270,8 +258,8 @@ func runAlphaGenerate(tempDir, version string) error {
270
258
// It was added because the alpha generate command in versions prior to v4.7.0 does
271
259
// not run those commands automatically which will not allow we properly ensure
272
260
// that all manifests, code generation, formatting, and linting are applied to
273
- // properly do the 3-way merge. We use true to ignore errors and do our best effort
274
- runMakeTargets (false )
261
+ // properly do the 3-way merge.
262
+ runMakeTargets ()
275
263
return nil
276
264
}
277
265
@@ -367,8 +355,8 @@ func (opts *Update) mergeOriginalToUpgrade() error {
367
355
log .Info ("Merge happened without conflicts." )
368
356
}
369
357
370
- // When the --force flag is used has the best effort to run the make targets
371
- runMakeTargets (opts . Force )
358
+ // Best effort to run make targets to ensure the project is in a good state
359
+ runMakeTargets ()
372
360
373
361
// Step 4: Stage and commit
374
362
if err := exec .Command ("git" , "add" , "--all" ).Run (); err != nil {
0 commit comments