diff --git a/go.mod b/go.mod index be650a7f1..45c17d876 100644 --- a/go.mod +++ b/go.mod @@ -54,7 +54,7 @@ require ( k8s.io/component-base v0.24.2 k8s.io/klog v1.0.0 k8s.io/klog/v2 v2.70.1 - k8s.io/test-infra v0.0.0-20230220183149-f6cb3f5ca17f + k8s.io/test-infra v0.0.0-20230306183230-a54d76d2416e ) require ( diff --git a/go.sum b/go.sum index 42431c4bd..6405b3ed9 100644 --- a/go.sum +++ b/go.sum @@ -1412,8 +1412,8 @@ k8s.io/klog/v2 v2.70.1 h1:7aaoSdahviPmR+XkS7FyxlkkXs6tHISSG03RxleQAVQ= k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 h1:Gii5eqf+GmIEwGNKQYQClCayuJCe2/4fZUvF7VG99sU= k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42/go.mod h1:Z/45zLw8lUo4wdiUkI+v/ImEGAvu3WatcZl3lPMR4Rk= -k8s.io/test-infra v0.0.0-20230220183149-f6cb3f5ca17f h1:OhVatd6iVYsKZ35fc8ObdonG+us5GdQzBVjqvx4bXSA= -k8s.io/test-infra v0.0.0-20230220183149-f6cb3f5ca17f/go.mod h1:a6zj8l2OE8pfLoWWUP4ypEtM32nDOIlNhaUyfjaUTBY= +k8s.io/test-infra v0.0.0-20230306183230-a54d76d2416e h1:SqQXWXFyIE0+G0/g7D1xIVsZPzji1eeySM1+Uz/gCSM= +k8s.io/test-infra v0.0.0-20230306183230-a54d76d2416e/go.mod h1:6n8IUtr6O54jvYP97p7OqCe3xIKet+GxyI2esOmNOnw= k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed h1:jAne/RjBTyawwAy0utX5eqigAwz/lQhTmy+Hr/Cpue4= diff --git a/vendor/k8s.io/test-infra/prow/config/inrepoconfig.go b/vendor/k8s.io/test-infra/prow/config/inrepoconfig.go index f3d525a05..aadcfd077 100644 --- a/vendor/k8s.io/test-infra/prow/config/inrepoconfig.go +++ b/vendor/k8s.io/test-infra/prow/config/inrepoconfig.go @@ -118,7 +118,7 @@ func prowYAMLGetter( } log.WithField("merge-strategy", mergeMethod).Debug("Using merge strategy.") - if err := ensureHeadCommits(repo, headSHAs...); err != nil { + if err := ensureCommits(repo, baseSHA, headSHAs...); err != nil { return nil, fmt.Errorf("failed to fetch headSHAs: %v", err) } if err := repo.MergeAndCheckout(baseSHA, string(mergeMethod), headSHAs...); err != nil { @@ -128,7 +128,14 @@ func prowYAMLGetter( return ReadProwYAML(log, repo.Directory(), false) } -func ensureHeadCommits(repo git.RepoClient, headSHAs ...string) error { +func ensureCommits(repo git.RepoClient, baseSHA string, headSHAs ...string) error { + //Ensure baseSHA exists. + if exists, _ := repo.CommitExists(baseSHA); !exists { + if err := repo.Fetch(baseSHA); err != nil { + return fmt.Errorf("failed to fetch baseSHA: %s: %v", baseSHA, err) + } + } + //Ensure headSHAs exist for _, sha := range headSHAs { // This is best effort. No need to check for error if exists, _ := repo.CommitExists(sha); !exists { diff --git a/vendor/k8s.io/test-infra/prow/pjutil/filter.go b/vendor/k8s.io/test-infra/prow/pjutil/filter.go index 3c001a50b..8edb9a670 100644 --- a/vendor/k8s.io/test-infra/prow/pjutil/filter.go +++ b/vendor/k8s.io/test-infra/prow/pjutil/filter.go @@ -29,9 +29,6 @@ import ( var TestAllRe = regexp.MustCompile(`(?m)^/test all,?($|\s.*)`) -// TestRe provides the regex for `/test` command -var TestRe = regexp.MustCompile(`(?m)^/test\s*?($|\s.*)`) - // RetestRe provides the regex for `/retest` var RetestRe = regexp.MustCompile(`(?m)^/retest\s*$`) diff --git a/vendor/k8s.io/test-infra/prow/plugins/config.go b/vendor/k8s.io/test-infra/prow/plugins/config.go index d9b89d3e0..b2bddab45 100644 --- a/vendor/k8s.io/test-infra/prow/plugins/config.go +++ b/vendor/k8s.io/test-infra/prow/plugins/config.go @@ -500,6 +500,12 @@ type Slack struct { type ConfigMapSpec struct { // Name of ConfigMap Name string `json:"name"` + // PartitionedNames is a slice of names of ConfigMaps that the keys should be balanced across. + // This is useful when no explicit key is given and file names/paths are used as keys instead. + // This is used to work around the 1MB ConfigMap size limit by spreading the keys across multiple + // separate ConfigMaps. + // PartitionedNames is mutually exclusive with the "Name" field. + PartitionedNames []string `json:"partitioned_names,omitempty"` // Key is the key in the ConfigMap to update with the file contents. // If no explicit key is given, the basename of the file will be used unless // use_full_path_as_key: true is set, in which case the full filepath relative @@ -571,10 +577,11 @@ func (cu *ConfigUpdater) resolve() error { } cu.Maps[k] = ConfigMapSpec{ - Name: v.Name, - Key: v.Key, - GZIP: v.GZIP, - Clusters: clusters, + Name: v.Name, + PartitionedNames: v.PartitionedNames, + Key: v.Key, + GZIP: v.GZIP, + Clusters: clusters, } } @@ -1146,10 +1153,23 @@ func validateConfigUpdater(updater *ConfigUpdater) error { updater.SetDefaults() configMapKeys := map[ConfigMapID]sets.String{} for file, config := range updater.Maps { + // Check that Name and PartitionedNames are mutually exclusive + if config.Name != "" && len(config.PartitionedNames) > 0 { + return errors.New("'name' and 'partitioned_names' are mutually exclusive in the config_updater plugin configuration") + } + name := config.Name + if name == "" { + name = strings.Join(config.PartitionedNames, ",") + } + // Check that PartitionedNames doesn't use too many partitions. + if len(config.PartitionedNames) > 256 { + return fmt.Errorf("the PartitionedNames field in config_updater plugin config currently supports a maximum of 256 partitions, but you have %d defined", len(config.PartitionedNames)) + } + // Check that keys are not associated with multiple files. for cluster, namespaces := range config.Clusters { for _, namespace := range namespaces { cmID := ConfigMapID{ - Name: config.Name, + Name: name, Namespace: namespace, Cluster: cluster, } @@ -1161,7 +1181,7 @@ func validateConfigUpdater(updater *ConfigUpdater) error { if _, ok := configMapKeys[cmID]; ok { if configMapKeys[cmID].Has(key) { - return fmt.Errorf("key %s in configmap %s updated with more than one file", key, config.Name) + return fmt.Errorf("key %s in configmap %s updated with more than one file", key, name) } configMapKeys[cmID].Insert(key) } else { diff --git a/vendor/modules.txt b/vendor/modules.txt index 9dff0e537..69f794f7a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1552,7 +1552,7 @@ k8s.io/kube-openapi/pkg/util k8s.io/kube-openapi/pkg/util/proto k8s.io/kube-openapi/pkg/util/sets k8s.io/kube-openapi/pkg/validation/spec -# k8s.io/test-infra v0.0.0-20230220183149-f6cb3f5ca17f +# k8s.io/test-infra v0.0.0-20230306183230-a54d76d2416e ## explicit; go 1.18 k8s.io/test-infra/ghproxy/ghcache k8s.io/test-infra/ghproxy/ghmetrics