From 4206745dc775b345f117f539f58b2eabda35bad4 Mon Sep 17 00:00:00 2001 From: jmccormick2001 Date: Fri, 16 Apr 2021 12:42:00 -0500 Subject: [PATCH 1/3] add storage spec to scorecard config (cherry picked from commit e245efd8031e64958764253d6411e6d186911298) --- .../scorecard/v1alpha3/configuration_types.go | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pkg/apis/scorecard/v1alpha3/configuration_types.go b/pkg/apis/scorecard/v1alpha3/configuration_types.go index ae931dff5..91dfdffb2 100644 --- a/pkg/apis/scorecard/v1alpha3/configuration_types.go +++ b/pkg/apis/scorecard/v1alpha3/configuration_types.go @@ -18,7 +18,8 @@ type Configuration struct { } `json:"metadata,omitempty" yaml:"metadata,omitempty"` // Stages is a set of test stages to run. Once a stage is finished, the next stage in the slice will be run. - Stages []StageConfiguration `json:"stages" yaml:"stages"` + Stages []StageConfiguration `json:"stages" yaml:"stages"` + Storage Storage `json:"storage,omitempty" yaml:"storage,omitempty"` } // StageConfiguration configures a set of tests to be run. @@ -39,5 +40,21 @@ type TestConfiguration struct { // Entrypoint is a list of commands and arguments passed to the test image. Entrypoint []string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"` // Labels further describe the test and enable selection. - Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + Storage Storage `json:"storage,omitempty" yaml:"storage,omitempty"` +} + +// Storage +type Storage struct { + Spec StorageSpec `yaml:"spec"` +} + +// Spec +type StorageSpec struct { + MountPath MountPath `yaml:"mountPath,omitempty" yaml:"mountPath,omitempty"` +} + +// MountPath +type MountPath struct { + Path string `yaml:"path,omitempty" yaml:"path,omitempty"` } From a5675f863ffd84e840e9d7859c5b7922629984a5 Mon Sep 17 00:00:00 2001 From: Fabian von Feilitzsch Date: Wed, 30 Jun 2021 11:55:52 -0400 Subject: [PATCH 2/3] Run make generate --- .../v1alpha3/zz_generated.deepcopy.go | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/pkg/apis/scorecard/v1alpha3/zz_generated.deepcopy.go b/pkg/apis/scorecard/v1alpha3/zz_generated.deepcopy.go index 0966f76ee..8f4e5aad6 100644 --- a/pkg/apis/scorecard/v1alpha3/zz_generated.deepcopy.go +++ b/pkg/apis/scorecard/v1alpha3/zz_generated.deepcopy.go @@ -35,6 +35,7 @@ func (in *Configuration) DeepCopyInto(out *Configuration) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + out.Storage = in.Storage } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Configuration. @@ -47,6 +48,21 @@ func (in *Configuration) DeepCopy() *Configuration { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MountPath) DeepCopyInto(out *MountPath) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MountPath. +func (in *MountPath) DeepCopy() *MountPath { + if in == nil { + return nil + } + out := new(MountPath) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *StageConfiguration) DeepCopyInto(out *StageConfiguration) { *out = *in @@ -69,6 +85,38 @@ func (in *StageConfiguration) DeepCopy() *StageConfiguration { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Storage) DeepCopyInto(out *Storage) { + *out = *in + out.Spec = in.Spec +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Storage. +func (in *Storage) DeepCopy() *Storage { + if in == nil { + return nil + } + out := new(Storage) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageSpec) DeepCopyInto(out *StorageSpec) { + *out = *in + out.MountPath = in.MountPath +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageSpec. +func (in *StorageSpec) DeepCopy() *StorageSpec { + if in == nil { + return nil + } + out := new(StorageSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Test) DeepCopyInto(out *Test) { *out = *in @@ -110,6 +158,7 @@ func (in *TestConfiguration) DeepCopyInto(out *TestConfiguration) { (*out)[key] = val } } + out.Storage = in.Storage } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestConfiguration. From cfdd9f30f4166e234afa52dba5cdd252531bcb49 Mon Sep 17 00:00:00 2001 From: Fabian von Feilitzsch Date: Fri, 2 Jul 2021 13:29:31 -0400 Subject: [PATCH 3/3] Add godocs --- .../scorecard/v1alpha3/configuration_types.go | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/pkg/apis/scorecard/v1alpha3/configuration_types.go b/pkg/apis/scorecard/v1alpha3/configuration_types.go index 91dfdffb2..9a447b22c 100644 --- a/pkg/apis/scorecard/v1alpha3/configuration_types.go +++ b/pkg/apis/scorecard/v1alpha3/configuration_types.go @@ -18,8 +18,10 @@ type Configuration struct { } `json:"metadata,omitempty" yaml:"metadata,omitempty"` // Stages is a set of test stages to run. Once a stage is finished, the next stage in the slice will be run. - Stages []StageConfiguration `json:"stages" yaml:"stages"` - Storage Storage `json:"storage,omitempty" yaml:"storage,omitempty"` + Stages []StageConfiguration `json:"stages" yaml:"stages"` + + // Storage is the optional storage configuration + Storage Storage `json:"storage,omitempty" yaml:"storage,omitempty"` } // StageConfiguration configures a set of tests to be run. @@ -40,21 +42,25 @@ type TestConfiguration struct { // Entrypoint is a list of commands and arguments passed to the test image. Entrypoint []string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"` // Labels further describe the test and enable selection. - Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` - Storage Storage `json:"storage,omitempty" yaml:"storage,omitempty"` + Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` + // Storage is the optional storage configuration for the test image. + Storage Storage `json:"storage,omitempty" yaml:"storage,omitempty"` } -// Storage +// Storage configures custom storage options type Storage struct { - Spec StorageSpec `yaml:"spec"` + // Spec contains the storage configuration options + Spec StorageSpec `json:"spec" yaml:"spec"` } -// Spec +// StorageSpec contains storage configuration options type StorageSpec struct { - MountPath MountPath `yaml:"mountPath,omitempty" yaml:"mountPath,omitempty"` + // MountPath configures the path to mount directories in the test pod + MountPath MountPath `json:"mountPath,omitempty" yaml:"mountPath,omitempty"` } -// MountPath +// MountPath configures the path to mount directories in the test pod type MountPath struct { - Path string `yaml:"path,omitempty" yaml:"path,omitempty"` + // Path is the fully qualified path that a directory should be mounted in the test pod + Path string `json:"path,omitempty" yaml:"path,omitempty"` }