Change:
Right now on head () if you run it will end up having a modified file. This happened because some type has been changed and this file should have been generated before commit, and verification should have failed but they didn't.
This is not only a problem with openapi-gen. deepcopy-gen also has the same problem. I've a field to a type (autoscaling/v1) and verify-all passed for the commit (without adding generated code to it). those files will be generated on verify-codegen and it will not fail and the commit can be merged without generated code.
Yeah. So when the Makefile stuff originally went in those files were not checked in. Then we un-did that part, but I didn't re-add them to verify...

Discussion:
#   make verify #   make verify BRANCH=branch_x .PHONY: verify <del> verify: </del> <ins> verify: verify_generated_files </ins> KUBE_VERIFY_GIT_BRANCH=$(BRANCH) hack/make-rules/verify.sh -v hack/make-rules/vet.sh

#   make generated_files .PHONY: generated_files generated_files: <del> $(MAKE) -f Makefile.$@ $@ CALLED_FROM_MAIN_MAKEFILE=1 </del> <ins> $(MAKE) -f Makefile.generated_files $@ CALLED_FROM_MAIN_MAKEFILE=1 # Verify auto-generated files needed for the build. # # Example: #   make verify_generated_files .PHONY: verify_generated_files verify_generated_files: $(MAKE) -f Makefile.generated_files $@ CALLED_FROM_MAIN_MAKEFILE=1 </ins>

.PHONY: generated_files generated_files: gen_deepcopy gen_defaulter gen_conversion gen_openapi <ins> .PHONY: verify_generated_files verify_generated_files: verify_gen_deepcopy     verify_gen_defaulter    verify_gen_conversion   verify_gen_openapi </ins> # Code-generation logic. # # This stuff can be pretty tricky, and there's probably some corner cases that

) DEEPCOPY_FILES := $(addsuffix /$(DEEPCOPY_FILENAME), $(DEEPCOPY_DIRS)) <ins> # Shell function for reuse in rules. RUN_GEN_DEEPCOPY =                                                           function run_gen_deepcopy() {                                            if [[ -f $(META_DIR)/$(DEEPCOPY_GEN).todo ]]; then                   ./hack/run-in-gopath.sh $(DEEPCOPY_GEN)                          --v $(KUBE_VERBOSE)                                          --logtostderr                                                -i $$(cat $(META_DIR)/$(DEEPCOPY_GEN).todo | paste -sd, -)   --bounding-dirs $(PRJ_SRC_PATH)                              -O $(DEEPCOPY_BASENAME)                                      "$$@";                                                       fi                                                                   };                                                                       run_gen_deepcopy </ins> # This rule aggregates the set of files to generate and then generates them all # in a single run of the tool. .PHONY: gen_deepcopy <del> gen_deepcopy: $(DEEPCOPY_FILES) if [[ -f $(META_DIR)/$(DEEPCOPY_GEN).todo ]]; then                   ./hack/run-in-gopath.sh $(DEEPCOPY_GEN)                          --v $(KUBE_VERBOSE)                                          --logtostderr                                                -i $$(cat $(META_DIR)/$(DEEPCOPY_GEN).todo | paste -sd, -)   --bounding-dirs $(PRJ_SRC_PATH)                              -O $(DEEPCOPY_BASENAME);                                     fi </del> <ins> gen_deepcopy: $(DEEPCOPY_FILES) $(DEEPCOPY_GEN) $(RUN_GEN_DEEPCOPY) .PHONY: verify_gen_deepcopy verify_gen_deepcopy: $(DEEPCOPY_GEN) $(RUN_GEN_DEEPCOPY) --verify-only </ins> # For each dir in DEEPCOPY_DIRS, this establishes a dependency between the # output file and the input files that should trigger a rebuild.

DEFAULTER_FILES := $(addsuffix /$(DEFAULTER_FILENAME), $(DEFAULTER_DIRS)) <ins> RUN_GEN_DEFAULTER :=                                                          function run_gen_defaulter() {                                            if [[ -f $(META_DIR)/$(DEFAULTER_GEN).todo ]]; then                   ./hack/run-in-gopath.sh $(DEFAULTER_GEN)                          --v $(KUBE_VERBOSE)                                           --logtostderr                                                 -i $$(cat $(META_DIR)/$(DEFAULTER_GEN).todo | paste -sd, -)   --extra-peer-dirs $$(echo $(addprefix $(PRJ_SRC_PATH)/, $(DEFAULTER_DIRS)) | sed 's/ /,/g')  -O $(DEFAULTER_BASENAME)                                      "$$@";                                                        fi                                                                    };                                                                        run_gen_defaulter </ins> # This rule aggregates the set of files to generate and then generates them all # in a single run of the tool. .PHONY: gen_defaulter <del> gen_defaulter: $(DEFAULTER_FILES) if [[ -f $(META_DIR)/$(DEFAULTER_GEN).todo ]]; then                   ./hack/run-in-gopath.sh $(DEFAULTER_GEN)                          --v $(KUBE_VERBOSE)                                           --logtostderr                                                 -i $$(cat $(META_DIR)/$(DEFAULTER_GEN).todo | paste -sd, -)   --extra-peer-dirs $$(echo $(addprefix $(PRJ_SRC_PATH)/, $(DEFAULTER_DIRS)) | sed 's/ /,/g')  -O $(DEFAULTER_BASENAME);                                     fi </del> <ins> gen_defaulter: $(DEFAULTER_FILES) $(DEFAULTER_GEN) $(RUN_GEN_DEFAULTER) .PHONY: verify_gen_deepcopy verify_gen_defaulter: $(DEFAULTER_GEN) $(RUN_GEN_DEFAULTER) --verify-only </ins> # For each dir in DEFAULTER_DIRS, this establishes a dependency between the # output file and the input files that should trigger a rebuild.

OPENAPI_OUTFILE := $(OPENAPI_OUTPUT_PKG)/$(OPENAPI_FILENAME) <ins> # Shell function for reuse in rules. RUN_GEN_OPENAPI =                                                                        function run_gen_openapi() {                                                         ./hack/run-in-gopath.sh $(OPENAPI_GEN)                                           --v $(KUBE_VERBOSE)                                                          --logtostderr                                                                -i $$(echo $(addprefix $(PRJ_SRC_PATH)/, $(OPENAPI_DIRS)) | sed 's/ /,/g')   -p $(PRJ_SRC_PATH)/$(OPENAPI_OUTPUT_PKG)                                     -O $(OPENAPI_BASENAME)                                                       "$$@";                                                                       };                                                                                   run_gen_openapi </ins> # This rule is the user-friendly entrypoint for openapi generation. .PHONY: gen_openapi <del> gen_openapi: $(OPENAPI_OUTFILE) </del> <ins> gen_openapi: $(OPENAPI_OUTFILE) $(OPENAPI_GEN) .PHONY: verify_gen_openapi verify_gen_openapi: $(OPENAPI_GEN) $(RUN_GEN_OPENAPI) --verify-only </ins> # For each dir in OPENAPI_DIRS, this establishes a dependency between the # output file and the input files that should trigger a rebuild.

)) # How to regenerate open-api code.  This emits a single file for all results. <del> $(OPENAPI_OUTFILE): $(OPENAPI_GEN) ./hack/run-in-gopath.sh $(OPENAPI_GEN)                                           --v $(KUBE_VERBOSE)                                                          --logtostderr                                                                -i $$(echo $(addprefix $(PRJ_SRC_PATH)/, $(OPENAPI_DIRS)) | sed 's/ /,/g')   -p $(PRJ_SRC_PATH)/$(OPENAPI_OUTPUT_PKG)                                     -O $(OPENAPI_BASENAME) </del> <ins> $(OPENAPI_OUTFILE): $(OPENAPI_GEN) $(OPENAPI_GEN) $(RUN_GEN_OPENAPI) </ins> # This calculates the dependencies for the generator tool, so we only rebuild # it when needed.  It is PHONY so that it always runs, but it only updates the

CONVERSION_FILES := $(addsuffix /$(CONVERSION_FILENAME), $(CONVERSION_DIRS)) <ins> # Shell function for reuse in rules. RUN_GEN_CONVERSION =                                                           function run_gen_conversion() {                                            if [[ -f $(META_DIR)/$(CONVERSION_GEN).todo ]]; then                   ./hack/run-in-gopath.sh $(CONVERSION_GEN)                          --v $(KUBE_VERBOSE)                                            --logtostderr                                                  -i $$(cat $(META_DIR)/$(CONVERSION_GEN).todo | paste -sd, -)   -O $(CONVERSION_BASENAME)                                      "$$@";                                                         fi                                                                     };                                                                         run_gen_conversion </ins> # This rule aggregates the set of files to generate and then generates them all # in a single run of the tool. .PHONY: gen_conversion <del> gen_conversion: $(CONVERSION_FILES) if [[ -f $(META_DIR)/$(CONVERSION_GEN).todo ]]; then                   ./hack/run-in-gopath.sh $(CONVERSION_GEN)                          --v $(KUBE_VERBOSE)                                            --logtostderr                                                  -i $$(cat $(META_DIR)/$(CONVERSION_GEN).todo | paste -sd, -)   -O $(CONVERSION_BASENAME);                                     fi </del> <ins> gen_conversion: $(CONVERSION_FILES) $(CONVERSION_GEN) $(RUN_GEN_CONVERSION) .PHONY: verify_gen_conversion verify_gen_conversion: $(CONVERSION_GEN) $(RUN_GEN_CONVERSION) --verify-only </ins> # Establish a dependency between the deps file and the dir.  Whenever a dir # changes (files added or removed) the deps file will be considered stale.