@@ -210,25 +210,13 @@ func cleanupBranch() error {
210210 return nil
211211}
212212
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 () {
216216 targets := []string {"manifests" , "generate" , "fmt" , "vet" , "lint-fix" }
217-
218217 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 {
232220 log .Warn ("make target failed" , "target" , target , "error" , err )
233221 }
234222 }
@@ -270,8 +258,8 @@ func runAlphaGenerate(tempDir, version string) error {
270258 // It was added because the alpha generate command in versions prior to v4.7.0 does
271259 // not run those commands automatically which will not allow we properly ensure
272260 // 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 ()
275263 return nil
276264}
277265
@@ -367,8 +355,8 @@ func (opts *Update) mergeOriginalToUpgrade() error {
367355 log .Info ("Merge happened without conflicts." )
368356 }
369357
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 ()
372360
373361 // Step 4: Stage and commit
374362 if err := exec .Command ("git" , "add" , "--all" ).Run (); err != nil {
0 commit comments