diff --git a/cmd/apiserver-boot/boot/build/build_executables.go b/cmd/apiserver-boot/boot/build/build_executables.go index 0d9e508eeb..52b2281bae 100644 --- a/cmd/apiserver-boot/boot/build/build_executables.go +++ b/cmd/apiserver-boot/boot/build/build_executables.go @@ -80,6 +80,11 @@ func RunBuildExecutables(cmd *cobra.Command, args []string) { } func BazelBuild(cmd *cobra.Command, args []string) { + if GenerateForBuild { + log.Printf("regenerating generated code. To disable regeneration, run with --generate=false.") + RunGenerate(cmd, args) + } + if Gazelle { c := exec.Command("gazelle", "update", "-go_prefix", util.Repo, "-external", "vendored", "pkg", "cmd") @@ -92,11 +97,6 @@ func BazelBuild(cmd *cobra.Command, args []string) { } } - if GenerateForBuild { - log.Printf("regenerating generated code. To disable regeneration, run with --generate=false.") - RunGenerate(cmd, args) - } - c := exec.Command("bazel", "build", filepath.Join("cmd", "apiserver"), filepath.Join("cmd", "controller-manager"))