Merge pull request #139013 from yongruilin/dv-update-codegen-fix

hack: glob-remove all validation-gen outputs in update-codegen.sh
This commit is contained in:
Kubernetes Prow Robot 2026-05-13 04:20:26 +05:30 committed by GitHub
commit 042ae1c307
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
87 changed files with 7 additions and 4 deletions

View file

@ -420,8 +420,11 @@ function codegen::validation() {
k8s.io/code-generator/cmd/validation-gen
# TODO: Where do we want these output? It should be somewhere internal..
# The result file, in each pkg, of validation generation.
local output_file="${GENERATED_FILE_PREFIX}validations.go"
# All files emitted by validation-gen (the per-pkg validations file and the
# per-Kind coverage test fixtures under test/declarative_validation/) share
# this prefix so the cleanup below can glob-remove them in one pass.
local output_file_prefix="${GENERATED_FILE_PREFIX}validations."
local output_file="${output_file_prefix}go"
# All directories that request any form of validation generation.
if [[ "${DBG_CODEGEN}" == 1 ]]; then
@ -462,14 +465,14 @@ function codegen::validation() {
done
fi
git_find -z ':(glob)**'/"${output_file}" | xargs -0 rm -f
git_find -z ':(glob)**'/"${output_file_prefix}"'*' | xargs -0 rm -f
validation-gen \
-v "${KUBE_VERBOSE}" \
--go-header-file "${BOILERPLATE_FILENAME}" \
--output-file "${output_file}" \
--test-output-root "test/declarative_validation" \
--test-output-file-prefix "${GENERATED_FILE_PREFIX}" \
--test-output-file-prefix "${output_file_prefix}" \
--test-allowlist "test/declarative_validation/coverage-allowlist.yaml" \
--lint-rules=known-tags-only,require-explicit-disablement \
$(printf -- " --readonly-pkg %s" "${readonly_pkgs[@]}") \