Merge pull request #130626 from BenTheElder/sort-client-gen

sort client-gen output
This commit is contained in:
Kubernetes Prow Robot 2025-03-11 09:49:53 -07:00 committed by GitHub
commit 67e1a1ebbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -85,7 +85,7 @@ func (args *Args) AddFlags(fs *pflag.FlagSet, inputBase string) {
fs.StringVar(&args.GoHeaderFile, "go-header-file", "", fs.StringVar(&args.GoHeaderFile, "go-header-file", "",
"the path to a file containing boilerplate header text; the string \"YEAR\" will be replaced with the current 4-digit year") "the path to a file containing boilerplate header text; the string \"YEAR\" will be replaced with the current 4-digit year")
fs.Var(NewGVPackagesValue(gvsBuilder, nil), "input", fs.Var(NewGVPackagesValue(gvsBuilder, nil), "input",
`group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format "group1/version1,group2/version2...". The order in which group/versions are listed defines the order of the generated client code. To avoid non-deterministic output, sort this list before providing it to client-gen.`) `group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format "group1/version1,group2/version2...".`)
fs.Var(NewGVTypesValue(&args.IncludedTypesOverrides, []string{}), "included-types-overrides", fs.Var(NewGVTypesValue(&args.IncludedTypesOverrides, []string{}), "included-types-overrides",
"list of group/version/type for which client should be generated. By default, client is generated for all types which have genclient in types.go. This overrides that. For each groupVersion in this list, only the types mentioned here will be included. The default check of genclient will be used for other group versions.") "list of group/version/type for which client should be generated. By default, client is generated for all types which have genclient in types.go. This overrides that. For each groupVersion in this list, only the types mentioned here will be included. The default check of genclient will be used for other group versions.")
fs.Var(NewInputBasePathValue(gvsBuilder, inputBase), "input-base", fs.Var(NewInputBasePathValue(gvsBuilder, inputBase), "input-base",

View File

@ -19,6 +19,7 @@ package main
import ( import (
"flag" "flag"
"slices"
"github.com/spf13/pflag" "github.com/spf13/pflag"
"k8s.io/klog/v2" "k8s.io/klog/v2"
@ -46,6 +47,8 @@ func main() {
inputPkgs = append(inputPkgs, v.Package) inputPkgs = append(inputPkgs, v.Package)
} }
} }
// ensure stable code generation output
slices.Sort(inputPkgs)
if err := args.Validate(); err != nil { if err := args.Validate(); err != nil {
klog.Fatalf("Error: %v", err) klog.Fatalf("Error: %v", err)