From d2e4a381154eb85c3b56708c68fe34273b8edd11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ot=C3=A1vio=20Fernandes?= Date: Mon, 31 Jan 2022 15:55:09 +0100 Subject: [PATCH 1/2] Vendoring Shipwright v0.8.0 --- go.mod | 2 +- go.sum | 2 + .../pkg/apis/build/v1alpha1/build_types.go | 10 +++ .../pkg/apis/build/v1alpha1/buildstrategy.go | 20 ++++- .../pkg/apis/build/v1alpha1/parameter.go | 46 ++++++++++- .../build/v1alpha1/zz_generated.deepcopy.go | 81 ++++++++++++++++++- vendor/modules.txt | 2 +- 7 files changed, 156 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index eb0061e49..c37213bde 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.17 require ( github.com/onsi/gomega v1.17.0 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 - github.com/shipwright-io/build v0.7.1-0.20220120135729-a962084c65d6 + github.com/shipwright-io/build v0.8.0 github.com/spf13/cobra v1.3.0 github.com/spf13/pflag v1.0.5 github.com/texttheater/golang-levenshtein/levenshtein v0.0.0-20200805054039-cae8b0eaed6c diff --git a/go.sum b/go.sum index fac144258..660f9042a 100644 --- a/go.sum +++ b/go.sum @@ -1022,6 +1022,8 @@ github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shipwright-io/build v0.7.1-0.20220120135729-a962084c65d6 h1:EP5DUKFUONiYBWjaGZ0pN5BXIJsH0E/PFcoM5EkeEiU= github.com/shipwright-io/build v0.7.1-0.20220120135729-a962084c65d6/go.mod h1:jV2v0sxQJoNuZ/Px/5NuQjyig+kSZDJ5isODr1gXdLU= +github.com/shipwright-io/build v0.8.0 h1:5ijj+/mnwoEJfepTLxrrs3rNE6yapB2WzNG5++PW5mw= +github.com/shipwright-io/build v0.8.0/go.mod h1:jV2v0sxQJoNuZ/Px/5NuQjyig+kSZDJ5isODr1gXdLU= github.com/shurcooL/githubv4 v0.0.0-20190718010115-4ba037080260/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo= github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f/go.mod h1:AuYgA5Kyo4c7HfUmvRGs/6rGlMMV/6B1bVnB9JxJEEg= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= diff --git a/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/build_types.go b/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/build_types.go index 63a0b710c..cad38fb49 100644 --- a/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/build_types.go +++ b/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/build_types.go @@ -38,8 +38,18 @@ const ( RuntimePathsCanNotBeEmpty BuildReason = "RuntimePathsCanNotBeEmpty" // RestrictedParametersInUse indicates the definition of reserved shipwright parameters RestrictedParametersInUse BuildReason = "RestrictedParametersInUse" + // WrongParameterValueType indicates that a single value was provided for an array parameter, or vice-versa + WrongParameterValueType BuildReason = "WrongParameterValueType" // UndefinedParameter indicates the definition of param that was not defined in the strategy parameters UndefinedParameter BuildReason = "UndefinedParameter" + // InconsistentParameterValues indicates that parameter values have more than one of configMapValue, secretValue, or value set + InconsistentParameterValues BuildReason = "InconsistentParameterValues" + // EmptyArrayItemParameterValues indicates that array parameters contain an item where none of configMapValue, secretValue, or value is set + EmptyArrayItemParameterValues BuildReason = "EmptyArrayItemParameterValues" + // IncompleteConfigMapValueParameterValues indicates that a configMapValue is specified where the name or the key is empty + IncompleteConfigMapValueParameterValues BuildReason = "IncompleteConfigMapValueParameterValues" + // IncompleteSecretValueParameterValues indicates that a secretValue is specified where the name or the key is empty + IncompleteSecretValueParameterValues BuildReason = "IncompleteSecretValueParameterValues" // RemoteRepositoryUnreachable indicates the referenced repository is unreachable RemoteRepositoryUnreachable BuildReason = "RemoteRepositoryUnreachable" // BuildNameInvalid indicates the build name is invalid diff --git a/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/buildstrategy.go b/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/buildstrategy.go index b824a1fbd..de56316de 100644 --- a/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/buildstrategy.go +++ b/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/buildstrategy.go @@ -22,6 +22,15 @@ type BuildStrategySpec struct { Parameters []Parameter `json:"parameters,omitempty"` } +// ParameterType indicates the type of a parameter +type ParameterType string + +// Valid ParamTypes: +const ( + ParameterTypeString ParameterType = "string" + ParameterTypeArray ParameterType = "array" +) + // Parameter holds a name-description with a default value // that allows strategy steps to be parameterize. // Build users can set a value for parameter via the Build @@ -36,9 +45,18 @@ type Parameter struct { // +required Description string `json:"description"` - // Reasonable default value for the parameter + // Type of the parameter. The possible types are "string" and "array", + // and "string" is the default. + // +optional + Type ParameterType `json:"type,omitempty"` + + // Default value for a string parameter // +optional Default *string `json:"default"` + + // Default values for an array parameter + // +optional + Defaults *[]string `json:"defaults"` } // BuildStep defines a partial step that needs to run in container for building the image. diff --git a/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/parameter.go b/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/parameter.go index 84fe3fc87..0f6bfff3d 100644 --- a/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/parameter.go +++ b/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/parameter.go @@ -4,9 +4,51 @@ package v1alpha1 +type ObjectKeyRef struct { + + // Name of the object + // +required + Name string `json:"name"` + + // Key inside the object + // +required + Key string `json:"key"` + + // An optional format to add pre- or suffix to the object value. For example 'KEY=${SECRET_VALUE}' or 'KEY=${CONFIGMAP_VALUE}' depending on the context. + // +optional + Format *string `json:"format"` +} + +// The value type contains the properties for a value, this allows for an +// easy extension in the future to support more kinds +type SingleValue struct { + + // The value of the parameter + // +optional + Value *string `json:"value"` + + // The ConfigMap value of the parameter + // +optional + ConfigMapValue *ObjectKeyRef `json:"configMapValue"` + + // The secret value of the parameter + // +optional + SecretValue *ObjectKeyRef `json:"secretValue"` +} + // ParamValue is a key/value that populates a strategy parameter // used in the execution of the strategy steps type ParamValue struct { - Name string `json:"name"` - Value string `json:"value"` + + // Inline the properties of a value + // +optional + *SingleValue `json:",inline"` + + // Name of the parameter + // +required + Name string `json:"name"` + + // Values of an array parameter + // +optional + Values []SingleValue `json:"values,omitempty"` } diff --git a/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/zz_generated.deepcopy.go index 55a278e00..170b35443 100644 --- a/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/github.com/shipwright-io/build/pkg/apis/build/v1alpha1/zz_generated.deepcopy.go @@ -185,7 +185,9 @@ func (in *BuildRunSpec) DeepCopyInto(out *BuildRunSpec) { if in.ParamValues != nil { in, out := &in.ParamValues, &out.ParamValues *out = make([]ParamValue, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.Output != nil { in, out := &in.Output, &out.Output @@ -329,7 +331,9 @@ func (in *BuildSpec) DeepCopyInto(out *BuildSpec) { if in.ParamValues != nil { in, out := &in.ParamValues, &out.ParamValues *out = make([]ParamValue, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } in.Output.DeepCopyInto(&out.Output) if in.Timeout != nil { @@ -717,6 +721,27 @@ func (in *Image) DeepCopy() *Image { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ObjectKeyRef) DeepCopyInto(out *ObjectKeyRef) { + *out = *in + if in.Format != nil { + in, out := &in.Format, &out.Format + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectKeyRef. +func (in *ObjectKeyRef) DeepCopy() *ObjectKeyRef { + if in == nil { + return nil + } + out := new(ObjectKeyRef) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Output) DeepCopyInto(out *Output) { *out = *in @@ -736,6 +761,18 @@ func (in *Output) DeepCopy() *Output { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ParamValue) DeepCopyInto(out *ParamValue) { *out = *in + if in.SingleValue != nil { + in, out := &in.SingleValue, &out.SingleValue + *out = new(SingleValue) + (*in).DeepCopyInto(*out) + } + if in.Values != nil { + in, out := &in.Values, &out.Values + *out = make([]SingleValue, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -757,6 +794,15 @@ func (in *Parameter) DeepCopyInto(out *Parameter) { *out = new(string) **out = **in } + if in.Defaults != nil { + in, out := &in.Defaults, &out.Defaults + *out = new([]string) + if **in != nil { + in, out := *in, *out + *out = make([]string, len(*in)) + copy(*out, *in) + } + } return } @@ -791,6 +837,37 @@ func (in *ServiceAccount) DeepCopy() *ServiceAccount { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SingleValue) DeepCopyInto(out *SingleValue) { + *out = *in + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(string) + **out = **in + } + if in.ConfigMapValue != nil { + in, out := &in.ConfigMapValue, &out.ConfigMapValue + *out = new(ObjectKeyRef) + (*in).DeepCopyInto(*out) + } + if in.SecretValue != nil { + in, out := &in.SecretValue, &out.SecretValue + *out = new(ObjectKeyRef) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SingleValue. +func (in *SingleValue) DeepCopy() *SingleValue { + if in == nil { + return nil + } + out := new(SingleValue) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Source) DeepCopyInto(out *Source) { *out = *in diff --git a/vendor/modules.txt b/vendor/modules.txt index 782d3d986..8580ecde6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -270,7 +270,7 @@ github.com/russross/blackfriday # github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 ## explicit; go 1.13 github.com/sabhiram/go-gitignore -# github.com/shipwright-io/build v0.7.1-0.20220120135729-a962084c65d6 +# github.com/shipwright-io/build v0.8.0 ## explicit; go 1.17 github.com/shipwright-io/build/pkg/apis/build/v1alpha1 github.com/shipwright-io/build/pkg/client/clientset/versioned From 68e44db29344491a75de16a3368469e9a46e26fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ot=C3=A1vio=20Fernandes?= Date: Mon, 31 Jan 2022 15:55:26 +0100 Subject: [PATCH 2/2] Bumping default Shipwright Controller version. --- Makefile | 2 +- hack/install-shipwright.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ac7a1ee41..2a525fe92 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ ARGS ?= # Tekton and Shipwright Build Controller versions for CI TEKTON_VERSION ?= v0.30.0 -SHIPWRIGHT_VERSION ?= nightly-2022-01-21-1642741753 +SHIPWRIGHT_VERSION ?= v0.8.0 .EXPORT_ALL_VARIABLES: diff --git a/hack/install-shipwright.sh b/hack/install-shipwright.sh index 0a9af867f..ac06b7476 100755 --- a/hack/install-shipwright.sh +++ b/hack/install-shipwright.sh @@ -7,7 +7,7 @@ set -eu SHIPWRIGHT_HOST="github.com" SHIPWRIGHT_HOST_PATH="shipwright-io/build/releases/download" -SHIPWRIGHT_VERSION="${SHIPWRIGHT_VERSION:-v0.7.0}" +SHIPWRIGHT_VERSION="${SHIPWRIGHT_VERSION:-v0.8.0}" DEPLOYMENT_TIMEOUT="${DEPLOYMENT_TIMEOUT:-3m}"