From 2fd5495eeb4061ec3b85ce26ee52055a22ce3703 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Fri, 8 Oct 2021 11:01:39 +0200 Subject: [PATCH 1/4] update devfile/library to v1.2.0 --- go.mod | 4 ++-- go.sum | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 8ab98438213..8add35decc5 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ require ( github.com/Netflix/go-expect v0.0.0-20201125194554-85d881c3777e github.com/Xuanwo/go-locale v1.0.0 github.com/blang/semver v3.5.1+incompatible - github.com/devfile/api/v2 v2.1.0 - github.com/devfile/library v1.1.1-0.20210910214722-7c5ff63711ec + github.com/devfile/api/v2 v2.0.0-20210917193329-089a48011460 + github.com/devfile/library v1.2.0 github.com/devfile/registry-support/index/generator v0.0.0-20210916150157-08b31e03fdf0 github.com/devfile/registry-support/registry-library v0.0.0-20210928163805-b0916a4f1aca github.com/fatih/color v1.10.0 diff --git a/go.sum b/go.sum index e28342e7646..bb07a20e768 100644 --- a/go.sum +++ b/go.sum @@ -246,10 +246,14 @@ github.com/deislabs/oras v0.8.1/go.mod h1:Mx0rMSbBNaNfY9hjpccEnxkOqJL6KGjtxNHPLC github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= github.com/devfile/api/v2 v2.0.0-20210910153124-da620cd1a7a1/go.mod h1:kLX/nW93gigOHXK3NLeJL2fSS/sgEe+OHu8bo3aoOi4= +github.com/devfile/api/v2 v2.0.0-20210917193329-089a48011460 h1:cmd+3poyUwevcWchYdvE02YT1nQU4SJpA5/wrdLrpWE= +github.com/devfile/api/v2 v2.0.0-20210917193329-089a48011460/go.mod h1:kLX/nW93gigOHXK3NLeJL2fSS/sgEe+OHu8bo3aoOi4= github.com/devfile/api/v2 v2.1.0 h1:hodMaQpa9onnx8uG5NBxIuzBjC7AUkLTGCcuvZyED7g= github.com/devfile/api/v2 v2.1.0/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg= github.com/devfile/library v1.1.1-0.20210910214722-7c5ff63711ec h1:UtJiFJfnC7fhup2MbGOzt6DCKMFKJTw47aHHETLfcZA= github.com/devfile/library v1.1.1-0.20210910214722-7c5ff63711ec/go.mod h1:svPWwWb+BP15SXCHl0dyOeE4Sohrjl5a2BaOzc/riLc= +github.com/devfile/library v1.2.0 h1:OT1Irwg5EZhlCpsAFkjIzd3bqyzbLG0JmFPMHeE1e7M= +github.com/devfile/library v1.2.0/go.mod h1:gyiQS+ZImnM4/d+wFUl3gJmIozOSXMenl0WX8cx4zu4= github.com/devfile/registry-support/index/generator v0.0.0-20210916150157-08b31e03fdf0 h1:F2OkuW0ASrSz5d06tJxWfweUNYTnsOCyiGTEORisokE= github.com/devfile/registry-support/index/generator v0.0.0-20210916150157-08b31e03fdf0/go.mod h1:bLGagbW2SFn7jo5+kUPlCMehIGqWkRtLKc5O0OyJMJM= github.com/devfile/registry-support/registry-library v0.0.0-20210928163805-b0916a4f1aca h1:MioKDSUEwwYCGEjGioWYO1vodYAutS+ESkZBGCPtx/U= From b4a4bffaf61a4bf77465251f97ea7e83df3c4723 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Fri, 8 Oct 2021 11:02:08 +0200 Subject: [PATCH 2/4] go mod vendor --- .../pkg/apis/workspaces/v1alpha2/commands.go | 20 +- .../v1alpha2/component_container.go | 2 +- .../workspaces/v1alpha2/component_image.go | 38 + .../v1alpha2/component_image_dockerfile.go | 81 ++ .../workspaces/v1alpha2/component_volume.go | 2 +- .../apis/workspaces/v1alpha2/components.go | 10 +- .../v1alpha2/devworkspacetemplate_spec.go | 8 +- .../v2/pkg/apis/workspaces/v1alpha2/doc.go | 2 +- .../pkg/apis/workspaces/v1alpha2/endpoint.go | 5 +- .../workspaces/v1alpha2/import_reference.go | 2 +- .../pkg/apis/workspaces/v1alpha2/projects.go | 9 +- .../v1alpha2/zz_generated.deepcopy.go | 1182 +++++++++++++++-- .../v1alpha2/zz_generated.parent_overrides.go | 334 ++++- .../v1alpha2/zz_generated.plugin_overrides.go | 176 ++- .../zz_generated.union_definitions.go | 172 +++ .../api/v2/pkg/attributes/attributes.go | 2 +- .../devfile/api/v2/pkg/devfile/header.go | 27 + .../devfile/api/v2/pkg/validation/commands.go | 37 +- .../api/v2/pkg/validation/components.go | 50 +- .../api/v2/pkg/validation/endpoints.go | 8 +- .../devfile/api/v2/pkg/validation/errors.go | 71 + .../devfile/api/v2/pkg/validation/events.go | 20 +- .../devfile/api/v2/pkg/validation/projects.go | 87 +- .../api/v2/pkg/validation/validation-rule.md | 3 + .../v2/pkg/validation/variables/variables.go | 3 +- .../validation/variables/variables_command.go | 68 +- .../variables/variables_component.go | 233 +++- .../validation/variables/variables_project.go | 92 +- .../pkg/devfile/parser/context/apiVersion.go | 5 +- .../data/v2/2.2.0/devfileJsonSchema220.go | 263 +++- .../pkg/devfile/parser/data/v2/commands.go | 10 +- .../parser/data/v2/common/component_helper.go | 2 + .../pkg/devfile/parser/data/v2/components.go | 10 +- .../pkg/devfile/parser/data/versions.go | 2 +- .../library/pkg/devfile/parser/devfileobj.go | 1 - vendor/modules.txt | 4 +- 36 files changed, 2620 insertions(+), 421 deletions(-) create mode 100644 vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_image.go create mode 100644 vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_image_dockerfile.go diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/commands.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/commands.go index 0abf13eef59..6698a1d30ee 100644 --- a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/commands.go +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/commands.go @@ -18,14 +18,15 @@ const ( ) // CommandGroupKind describes the kind of command group. -// +kubebuilder:validation:Enum=build;run;test;debug +// +kubebuilder:validation:Enum=build;run;test;debug;deploy type CommandGroupKind string const ( - BuildCommandGroupKind CommandGroupKind = "build" - RunCommandGroupKind CommandGroupKind = "run" - TestCommandGroupKind CommandGroupKind = "test" - DebugCommandGroupKind CommandGroupKind = "debug" + BuildCommandGroupKind CommandGroupKind = "build" + RunCommandGroupKind CommandGroupKind = "run" + TestCommandGroupKind CommandGroupKind = "test" + DebugCommandGroupKind CommandGroupKind = "debug" + DeployCommandGroupKind CommandGroupKind = "deploy" ) type CommandGroup struct { @@ -34,7 +35,7 @@ type CommandGroup struct { // +optional // Identifies the default command for a given group kind - IsDefault bool `json:"isDefault,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` } type BaseCommand struct { @@ -61,6 +62,9 @@ type Command struct { Id string `json:"id"` // Map of implementation-dependant free-form YAML attributes. // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` CommandUnion `json:",inline"` } @@ -141,7 +145,7 @@ type ExecCommand struct { // If set to `true` the command won't be restarted and it is expected to handle file changes on its own. // // Default value is `false` - HotReloadCapable bool `json:"hotReloadCapable,omitempty"` + HotReloadCapable *bool `json:"hotReloadCapable,omitempty"` } type ApplyCommand struct { @@ -160,7 +164,7 @@ type CompositeCommand struct { // Indicates if the sub-commands should be executed concurrently // +optional - Parallel bool `json:"parallel,omitempty"` + Parallel *bool `json:"parallel,omitempty"` } type CustomCommand struct { diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_container.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_container.go index bec6b34e746..f6168c356d8 100644 --- a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_container.go +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_container.go @@ -69,7 +69,7 @@ type Container struct { // // Default value is `false` // +optional - DedicatedPod bool `json:"dedicatedPod,omitempty"` + DedicatedPod *bool `json:"dedicatedPod,omitempty"` } type EnvVar struct { diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_image.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_image.go new file mode 100644 index 00000000000..c6e7e6b7777 --- /dev/null +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_image.go @@ -0,0 +1,38 @@ +package v1alpha2 + +// ImageType describes the type of image. +// Only one of the following image type may be specified. +// +kubebuilder:validation:Enum=Dockerfile +type ImageType string + +const ( + DockerfileImageType ImageType = "Dockerfile" +) + +type BaseImage struct { +} + +// Component that allows the developer to build a runtime image for outerloop +type ImageComponent struct { + BaseComponent `json:",inline"` + Image `json:",inline"` +} + +type Image struct { + // Name of the image for the resulting outerloop build + ImageName string `json:"imageName"` + ImageUnion `json:",inline"` +} + +// +union +type ImageUnion struct { + // Type of image + // + // +unionDiscriminator + // +optional + ImageType ImageType `json:"imageType,omitempty"` + + // Allows specifying dockerfile type build + // +optional + Dockerfile *DockerfileImage `json:"dockerfile,omitempty"` +} diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_image_dockerfile.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_image_dockerfile.go new file mode 100644 index 00000000000..4743825e254 --- /dev/null +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_image_dockerfile.go @@ -0,0 +1,81 @@ +package v1alpha2 + +// DockerfileSrcType describes the type of +// the src for the Dockerfile outerloop build. +// Only one of the following location type may be specified. +// +kubebuilder:validation:Enum=Uri;DevfileRegistry;Git +type DockerfileSrcType string + +const ( + UriLikeDockerfileSrcType DockerfileSrcType = "Uri" + DevfileRegistryLikeDockerfileSrcType DockerfileSrcType = "DevfileRegistry" + GitLikeDockerfileSrcType DockerfileSrcType = "Git" +) + +// Dockerfile Image type to specify the outerloop build using a Dockerfile +type DockerfileImage struct { + BaseImage `json:",inline"` + DockerfileSrc `json:",inline"` + Dockerfile `json:",inline"` +} + +// +union +type DockerfileSrc struct { + // Type of Dockerfile src + // + + // +unionDiscriminator + // +optional + SrcType DockerfileSrcType `json:"srcType,omitempty"` + + // URI Reference of a Dockerfile. + // It can be a full URL or a relative URI from the current devfile as the base URI. + // +optional + Uri string `json:"uri,omitempty"` + + // Dockerfile's Devfile Registry source + // +optional + DevfileRegistry *DockerfileDevfileRegistrySource `json:"devfileRegistry,omitempty"` + + // Dockerfile's Git source + // +optional + Git *DockerfileGitProjectSource `json:"git,omitempty"` +} + +type Dockerfile struct { + // Path of source directory to establish build context. Defaults to ${PROJECT_ROOT} in the container + // +optional + BuildContext string `json:"buildContext,omitempty"` + + // The arguments to supply to the dockerfile build. + // +optional + Args []string `json:"args,omitempty" patchStrategy:"replace"` + + // Specify if a privileged builder pod is required. + // + // Default value is `false` + // +optional + RootRequired *bool `json:"rootRequired,omitempty"` +} + +type DockerfileDevfileRegistrySource struct { + // Id in a devfile registry that contains a Dockerfile. The src in the OCI registry + // required for the Dockerfile build will be downloaded for building the image. + Id string `json:"id"` + + // Devfile Registry URL to pull the Dockerfile from when using the Devfile Registry as Dockerfile src. + // To ensure the Dockerfile gets resolved consistently in different environments, + // it is recommended to always specify the `devfileRegistryUrl` when `Id` is used. + // +optional + RegistryUrl string `json:"registryUrl,omitempty"` +} + +type DockerfileGitProjectSource struct { + // Git src for the Dockerfile build. The src required for the Dockerfile build will need to be + // cloned for building the image. + GitProjectSource `json:",inline"` + + // Location of the Dockerfile in the Git repository when using git as Dockerfile src. + // Defaults to Dockerfile. + // +optional + FileLocation string `json:"fileLocation,omitempty"` +} diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_volume.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_volume.go index 54d3ecbbbb2..b2517499d2b 100644 --- a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_volume.go +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/component_volume.go @@ -15,5 +15,5 @@ type Volume struct { // +optional // Ephemeral volumes are not stored persistently across restarts. Defaults // to false - Ephemeral bool `json:"ephemeral,omitempty"` + Ephemeral *bool `json:"ephemeral,omitempty"` } diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/components.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/components.go index 519210729f2..9356aa65522 100644 --- a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/components.go +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/components.go @@ -7,7 +7,7 @@ import ( // ComponentType describes the type of component. // Only one of the following component type may be specified. -// +kubebuilder:validation:Enum=Container;Kubernetes;Openshift;Volume;Plugin;Custom +// +kubebuilder:validation:Enum=Container;Kubernetes;Openshift;Volume;Image;Plugin;Custom type ComponentType string const ( @@ -16,6 +16,7 @@ const ( OpenshiftComponentType ComponentType = "Openshift" PluginComponentType ComponentType = "Plugin" VolumeComponentType ComponentType = "Volume" + ImageComponentType ComponentType = "Image" CustomComponentType ComponentType = "Custom" ) @@ -34,6 +35,9 @@ type Component struct { Name string `json:"name"` // Map of implementation-dependant free-form YAML attributes. // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` ComponentUnion `json:",inline"` } @@ -69,6 +73,10 @@ type ComponentUnion struct { // +optional Volume *VolumeComponent `json:"volume,omitempty"` + // Allows specifying the definition of an image for outer loop builds + // +optional + Image *ImageComponent `json:"image,omitempty"` + // Allows importing a plugin. // // Plugins are mainly imported devfiles that contribute components, commands diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/devworkspacetemplate_spec.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/devworkspacetemplate_spec.go index f6afd03b25f..f398cc9dddd 100644 --- a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/devworkspacetemplate_spec.go +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/devworkspacetemplate_spec.go @@ -14,12 +14,15 @@ type DevWorkspaceTemplateSpec struct { // +devfile:overrides:generate type DevWorkspaceTemplateSpecContent struct { - // Map of key-value variables used for string replacement in the devfile. Values can can be referenced via {{variable-key}} + // Map of key-value variables used for string replacement in the devfile. Values can be referenced via {{variable-key}} // to replace the corresponding value in string fields in the devfile. Replacement cannot be used for // // - schemaVersion, metadata, parent source + // // - element identifiers, e.g. command id, component name, endpoint name, project name + // // - references to identifiers, e.g. in events, a command's component, container's volume mount name + // // - string enums, e.g. command group kind, endpoint exposure // +optional // +patchStrategy=merge @@ -30,6 +33,9 @@ type DevWorkspaceTemplateSpecContent struct { // +optional // +patchStrategy=merge // +devfile:overrides:include:omitInPlugin=true,description=Overrides of attributes encapsulated in a parent devfile. + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty" patchStrategy:"merge"` // List of the devworkspace components, such as editor and plugins, diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/doc.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/doc.go index 2557772a633..c16dcf897a7 100644 --- a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/doc.go +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/doc.go @@ -2,5 +2,5 @@ // +k8s:deepcopy-gen=package,register // +k8s:openapi-gen=true // +groupName=workspace.devfile.io -// +devfile:jsonschema:version=2.1.0 +// +devfile:jsonschema:version=2.2.0-alpha package v1alpha2 diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/endpoint.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/endpoint.go index b016984695b..8599a6e4f41 100644 --- a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/endpoint.go +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/endpoint.go @@ -94,7 +94,7 @@ type Endpoint struct { // Describes whether the endpoint should be secured and protected by some // authentication process. This requires a protocol of `https` or `wss`. // +optional - Secure bool `json:"secure,omitempty"` + Secure *bool `json:"secure,omitempty"` // Path of the endpoint URL // +optional @@ -108,5 +108,8 @@ type Endpoint struct { // // - type: "terminal" / "ide" / "ide-dev", // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` } diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/import_reference.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/import_reference.go index d422cdca259..342b7975c19 100644 --- a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/import_reference.go +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/import_reference.go @@ -47,7 +47,7 @@ type ImportReference struct { // Registry URL to pull the parent devfile from when using id in the parent reference. // To ensure the parent devfile gets resolved consistently in different environments, - // it is recommended to always specify the `regsitryURL` when `Id` is used. + // it is recommended to always specify the `registryUrl` when `id` is used. // +optional RegistryUrl string `json:"registryUrl,omitempty"` } diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/projects.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/projects.go index fded2f6cdb5..9348d4d685f 100644 --- a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/projects.go +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/projects.go @@ -13,6 +13,9 @@ type Project struct { // Map of implementation-dependant free-form YAML attributes. // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` // Path relative to the root of the projects to which this project should be cloned into. This is a unix-style relative path (i.e. uses forward slashes). The path is invalid if it is absolute or tries to escape the project root through the usage of '..'. If not specified, defaults to the project name. @@ -30,6 +33,9 @@ type StarterProject struct { // Map of implementation-dependant free-form YAML attributes. // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` // Description of a starter project @@ -103,7 +109,8 @@ type GitLikeProjectSource struct { // +optional CheckoutFrom *CheckoutFrom `json:"checkoutFrom,omitempty"` - // The remotes map which should be initialized in the git project. Must have at least one remote configured + // The remotes map which should be initialized in the git project. + // Projects must have at least one remote configured while StarterProjects & Image Component's Git source can only have at most one remote configured. Remotes map[string]string `json:"remotes"` } diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.deepcopy.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.deepcopy.go index 80d4e331c8c..ee9afdfbb7f 100644 --- a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.deepcopy.go +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.deepcopy.go @@ -79,7 +79,7 @@ func (in *BaseCommand) DeepCopyInto(out *BaseCommand) { if in.Group != nil { in, out := &in.Group, &out.Group *out = new(CommandGroup) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -99,7 +99,7 @@ func (in *BaseCommandParentOverride) DeepCopyInto(out *BaseCommandParentOverride if in.Group != nil { in, out := &in.Group, &out.Group *out = new(CommandGroupParentOverride) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -119,7 +119,7 @@ func (in *BaseCommandPluginOverride) DeepCopyInto(out *BaseCommandPluginOverride if in.Group != nil { in, out := &in.Group, &out.Group *out = new(CommandGroupPluginOverride) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -139,7 +139,7 @@ func (in *BaseCommandPluginOverrideParentOverride) DeepCopyInto(out *BaseCommand if in.Group != nil { in, out := &in.Group, &out.Group *out = new(CommandGroupPluginOverrideParentOverride) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -213,6 +213,66 @@ func (in *BaseComponentPluginOverrideParentOverride) DeepCopy() *BaseComponentPl return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BaseImage) DeepCopyInto(out *BaseImage) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BaseImage. +func (in *BaseImage) DeepCopy() *BaseImage { + if in == nil { + return nil + } + out := new(BaseImage) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BaseImageParentOverride) DeepCopyInto(out *BaseImageParentOverride) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BaseImageParentOverride. +func (in *BaseImageParentOverride) DeepCopy() *BaseImageParentOverride { + if in == nil { + return nil + } + out := new(BaseImageParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BaseImagePluginOverride) DeepCopyInto(out *BaseImagePluginOverride) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BaseImagePluginOverride. +func (in *BaseImagePluginOverride) DeepCopy() *BaseImagePluginOverride { + if in == nil { + return nil + } + out := new(BaseImagePluginOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BaseImagePluginOverrideParentOverride) DeepCopyInto(out *BaseImagePluginOverrideParentOverride) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BaseImagePluginOverrideParentOverride. +func (in *BaseImagePluginOverrideParentOverride) DeepCopy() *BaseImagePluginOverrideParentOverride { + if in == nil { + return nil + } + out := new(BaseImagePluginOverrideParentOverride) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CheckoutFrom) DeepCopyInto(out *CheckoutFrom) { *out = *in @@ -243,6 +303,36 @@ func (in *CheckoutFromParentOverride) DeepCopy() *CheckoutFromParentOverride { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CheckoutFromPluginOverride) DeepCopyInto(out *CheckoutFromPluginOverride) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheckoutFromPluginOverride. +func (in *CheckoutFromPluginOverride) DeepCopy() *CheckoutFromPluginOverride { + if in == nil { + return nil + } + out := new(CheckoutFromPluginOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CheckoutFromPluginOverrideParentOverride) DeepCopyInto(out *CheckoutFromPluginOverrideParentOverride) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheckoutFromPluginOverrideParentOverride. +func (in *CheckoutFromPluginOverrideParentOverride) DeepCopy() *CheckoutFromPluginOverrideParentOverride { + if in == nil { + return nil + } + out := new(CheckoutFromPluginOverrideParentOverride) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Command) DeepCopyInto(out *Command) { *out = *in @@ -269,6 +359,11 @@ func (in *Command) DeepCopy() *Command { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CommandGroup) DeepCopyInto(out *CommandGroup) { *out = *in + if in.IsDefault != nil { + in, out := &in.IsDefault, &out.IsDefault + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommandGroup. @@ -284,6 +379,11 @@ func (in *CommandGroup) DeepCopy() *CommandGroup { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CommandGroupParentOverride) DeepCopyInto(out *CommandGroupParentOverride) { *out = *in + if in.IsDefault != nil { + in, out := &in.IsDefault, &out.IsDefault + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommandGroupParentOverride. @@ -299,6 +399,11 @@ func (in *CommandGroupParentOverride) DeepCopy() *CommandGroupParentOverride { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CommandGroupPluginOverride) DeepCopyInto(out *CommandGroupPluginOverride) { *out = *in + if in.IsDefault != nil { + in, out := &in.IsDefault, &out.IsDefault + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommandGroupPluginOverride. @@ -314,6 +419,11 @@ func (in *CommandGroupPluginOverride) DeepCopy() *CommandGroupPluginOverride { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CommandGroupPluginOverrideParentOverride) DeepCopyInto(out *CommandGroupPluginOverrideParentOverride) { *out = *in + if in.IsDefault != nil { + in, out := &in.IsDefault, &out.IsDefault + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommandGroupPluginOverrideParentOverride. @@ -550,6 +660,36 @@ func (in *CommonProjectSourceParentOverride) DeepCopy() *CommonProjectSourcePare return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonProjectSourcePluginOverride) DeepCopyInto(out *CommonProjectSourcePluginOverride) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonProjectSourcePluginOverride. +func (in *CommonProjectSourcePluginOverride) DeepCopy() *CommonProjectSourcePluginOverride { + if in == nil { + return nil + } + out := new(CommonProjectSourcePluginOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonProjectSourcePluginOverrideParentOverride) DeepCopyInto(out *CommonProjectSourcePluginOverrideParentOverride) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonProjectSourcePluginOverrideParentOverride. +func (in *CommonProjectSourcePluginOverrideParentOverride) DeepCopy() *CommonProjectSourcePluginOverrideParentOverride { + if in == nil { + return nil + } + out := new(CommonProjectSourcePluginOverrideParentOverride) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Component) DeepCopyInto(out *Component) { *out = *in @@ -663,7 +803,12 @@ func (in *ComponentUnion) DeepCopyInto(out *ComponentUnion) { if in.Volume != nil { in, out := &in.Volume, &out.Volume *out = new(VolumeComponent) - **out = **in + (*in).DeepCopyInto(*out) + } + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(ImageComponent) + (*in).DeepCopyInto(*out) } if in.Plugin != nil { in, out := &in.Plugin, &out.Plugin @@ -708,7 +853,12 @@ func (in *ComponentUnionParentOverride) DeepCopyInto(out *ComponentUnionParentOv if in.Volume != nil { in, out := &in.Volume, &out.Volume *out = new(VolumeComponentParentOverride) - **out = **in + (*in).DeepCopyInto(*out) + } + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(ImageComponentParentOverride) + (*in).DeepCopyInto(*out) } if in.Plugin != nil { in, out := &in.Plugin, &out.Plugin @@ -748,7 +898,12 @@ func (in *ComponentUnionPluginOverride) DeepCopyInto(out *ComponentUnionPluginOv if in.Volume != nil { in, out := &in.Volume, &out.Volume *out = new(VolumeComponentPluginOverride) - **out = **in + (*in).DeepCopyInto(*out) + } + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(ImageComponentPluginOverride) + (*in).DeepCopyInto(*out) } } @@ -783,7 +938,12 @@ func (in *ComponentUnionPluginOverrideParentOverride) DeepCopyInto(out *Componen if in.Volume != nil { in, out := &in.Volume, &out.Volume *out = new(VolumeComponentPluginOverrideParentOverride) - **out = **in + (*in).DeepCopyInto(*out) + } + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(ImageComponentPluginOverrideParentOverride) + (*in).DeepCopyInto(*out) } } @@ -806,6 +966,11 @@ func (in *CompositeCommand) DeepCopyInto(out *CompositeCommand) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.Parallel != nil { + in, out := &in.Parallel, &out.Parallel + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositeCommand. @@ -827,6 +992,11 @@ func (in *CompositeCommandParentOverride) DeepCopyInto(out *CompositeCommandPare *out = make([]string, len(*in)) copy(*out, *in) } + if in.Parallel != nil { + in, out := &in.Parallel, &out.Parallel + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositeCommandParentOverride. @@ -848,6 +1018,11 @@ func (in *CompositeCommandPluginOverride) DeepCopyInto(out *CompositeCommandPlug *out = make([]string, len(*in)) copy(*out, *in) } + if in.Parallel != nil { + in, out := &in.Parallel, &out.Parallel + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositeCommandPluginOverride. @@ -869,6 +1044,11 @@ func (in *CompositeCommandPluginOverrideParentOverride) DeepCopyInto(out *Compos *out = make([]string, len(*in)) copy(*out, *in) } + if in.Parallel != nil { + in, out := &in.Parallel, &out.Parallel + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CompositeCommandPluginOverrideParentOverride. @@ -909,6 +1089,11 @@ func (in *Container) DeepCopyInto(out *Container) { *out = new(bool) **out = **in } + if in.DedicatedPod != nil { + in, out := &in.DedicatedPod, &out.DedicatedPod + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Container. @@ -1045,6 +1230,11 @@ func (in *ContainerParentOverride) DeepCopyInto(out *ContainerParentOverride) { *out = new(bool) **out = **in } + if in.DedicatedPod != nil { + in, out := &in.DedicatedPod, &out.DedicatedPod + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerParentOverride. @@ -1085,6 +1275,11 @@ func (in *ContainerPluginOverride) DeepCopyInto(out *ContainerPluginOverride) { *out = new(bool) **out = **in } + if in.DedicatedPod != nil { + in, out := &in.DedicatedPod, &out.DedicatedPod + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerPluginOverride. @@ -1125,6 +1320,11 @@ func (in *ContainerPluginOverrideParentOverride) DeepCopyInto(out *ContainerPlug *out = new(bool) **out = **in } + if in.DedicatedPod != nil { + in, out := &in.DedicatedPod, &out.DedicatedPod + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerPluginOverrideParentOverride. @@ -1476,241 +1676,677 @@ func (in *DevWorkspaceTemplateSpecContent) DeepCopy() *DevWorkspaceTemplateSpecC } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Endpoint) DeepCopyInto(out *Endpoint) { +func (in *Dockerfile) DeepCopyInto(out *Dockerfile) { *out = *in - if in.Attributes != nil { - in, out := &in.Attributes, &out.Attributes - *out = make(attributes.Attributes, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.RootRequired != nil { + in, out := &in.RootRequired, &out.RootRequired + *out = new(bool) + **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoint. -func (in *Endpoint) DeepCopy() *Endpoint { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Dockerfile. +func (in *Dockerfile) DeepCopy() *Dockerfile { if in == nil { return nil } - out := new(Endpoint) + out := new(Dockerfile) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointParentOverride) DeepCopyInto(out *EndpointParentOverride) { +func (in *DockerfileDevfileRegistrySource) DeepCopyInto(out *DockerfileDevfileRegistrySource) { *out = *in - if in.Attributes != nil { - in, out := &in.Attributes, &out.Attributes - *out = make(attributes.Attributes, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointParentOverride. -func (in *EndpointParentOverride) DeepCopy() *EndpointParentOverride { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileDevfileRegistrySource. +func (in *DockerfileDevfileRegistrySource) DeepCopy() *DockerfileDevfileRegistrySource { if in == nil { return nil } - out := new(EndpointParentOverride) + out := new(DockerfileDevfileRegistrySource) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointPluginOverride) DeepCopyInto(out *EndpointPluginOverride) { +func (in *DockerfileDevfileRegistrySourceParentOverride) DeepCopyInto(out *DockerfileDevfileRegistrySourceParentOverride) { *out = *in - if in.Attributes != nil { - in, out := &in.Attributes, &out.Attributes - *out = make(attributes.Attributes, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointPluginOverride. -func (in *EndpointPluginOverride) DeepCopy() *EndpointPluginOverride { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileDevfileRegistrySourceParentOverride. +func (in *DockerfileDevfileRegistrySourceParentOverride) DeepCopy() *DockerfileDevfileRegistrySourceParentOverride { if in == nil { return nil } - out := new(EndpointPluginOverride) + out := new(DockerfileDevfileRegistrySourceParentOverride) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EndpointPluginOverrideParentOverride) DeepCopyInto(out *EndpointPluginOverrideParentOverride) { +func (in *DockerfileDevfileRegistrySourcePluginOverride) DeepCopyInto(out *DockerfileDevfileRegistrySourcePluginOverride) { *out = *in - if in.Attributes != nil { - in, out := &in.Attributes, &out.Attributes - *out = make(attributes.Attributes, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointPluginOverrideParentOverride. -func (in *EndpointPluginOverrideParentOverride) DeepCopy() *EndpointPluginOverrideParentOverride { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileDevfileRegistrySourcePluginOverride. +func (in *DockerfileDevfileRegistrySourcePluginOverride) DeepCopy() *DockerfileDevfileRegistrySourcePluginOverride { if in == nil { return nil } - out := new(EndpointPluginOverrideParentOverride) + out := new(DockerfileDevfileRegistrySourcePluginOverride) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EnvVar) DeepCopyInto(out *EnvVar) { +func (in *DockerfileDevfileRegistrySourcePluginOverrideParentOverride) DeepCopyInto(out *DockerfileDevfileRegistrySourcePluginOverrideParentOverride) { *out = *in } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvVar. -func (in *EnvVar) DeepCopy() *EnvVar { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileDevfileRegistrySourcePluginOverrideParentOverride. +func (in *DockerfileDevfileRegistrySourcePluginOverrideParentOverride) DeepCopy() *DockerfileDevfileRegistrySourcePluginOverrideParentOverride { if in == nil { return nil } - out := new(EnvVar) + out := new(DockerfileDevfileRegistrySourcePluginOverrideParentOverride) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EnvVarParentOverride) DeepCopyInto(out *EnvVarParentOverride) { +func (in *DockerfileGitProjectSource) DeepCopyInto(out *DockerfileGitProjectSource) { *out = *in + in.GitProjectSource.DeepCopyInto(&out.GitProjectSource) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvVarParentOverride. -func (in *EnvVarParentOverride) DeepCopy() *EnvVarParentOverride { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileGitProjectSource. +func (in *DockerfileGitProjectSource) DeepCopy() *DockerfileGitProjectSource { if in == nil { return nil } - out := new(EnvVarParentOverride) + out := new(DockerfileGitProjectSource) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EnvVarPluginOverride) DeepCopyInto(out *EnvVarPluginOverride) { +func (in *DockerfileGitProjectSourceParentOverride) DeepCopyInto(out *DockerfileGitProjectSourceParentOverride) { *out = *in + in.GitProjectSourceParentOverride.DeepCopyInto(&out.GitProjectSourceParentOverride) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvVarPluginOverride. -func (in *EnvVarPluginOverride) DeepCopy() *EnvVarPluginOverride { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileGitProjectSourceParentOverride. +func (in *DockerfileGitProjectSourceParentOverride) DeepCopy() *DockerfileGitProjectSourceParentOverride { if in == nil { return nil } - out := new(EnvVarPluginOverride) + out := new(DockerfileGitProjectSourceParentOverride) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EnvVarPluginOverrideParentOverride) DeepCopyInto(out *EnvVarPluginOverrideParentOverride) { +func (in *DockerfileGitProjectSourcePluginOverride) DeepCopyInto(out *DockerfileGitProjectSourcePluginOverride) { *out = *in + in.GitProjectSourcePluginOverride.DeepCopyInto(&out.GitProjectSourcePluginOverride) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvVarPluginOverrideParentOverride. -func (in *EnvVarPluginOverrideParentOverride) DeepCopy() *EnvVarPluginOverrideParentOverride { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileGitProjectSourcePluginOverride. +func (in *DockerfileGitProjectSourcePluginOverride) DeepCopy() *DockerfileGitProjectSourcePluginOverride { if in == nil { return nil } - out := new(EnvVarPluginOverrideParentOverride) + out := new(DockerfileGitProjectSourcePluginOverride) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Events) DeepCopyInto(out *Events) { +func (in *DockerfileGitProjectSourcePluginOverrideParentOverride) DeepCopyInto(out *DockerfileGitProjectSourcePluginOverrideParentOverride) { *out = *in - in.DevWorkspaceEvents.DeepCopyInto(&out.DevWorkspaceEvents) + in.GitProjectSourcePluginOverrideParentOverride.DeepCopyInto(&out.GitProjectSourcePluginOverrideParentOverride) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Events. -func (in *Events) DeepCopy() *Events { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileGitProjectSourcePluginOverrideParentOverride. +func (in *DockerfileGitProjectSourcePluginOverrideParentOverride) DeepCopy() *DockerfileGitProjectSourcePluginOverrideParentOverride { if in == nil { return nil } - out := new(Events) + out := new(DockerfileGitProjectSourcePluginOverrideParentOverride) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExecCommand) DeepCopyInto(out *ExecCommand) { +func (in *DockerfileImage) DeepCopyInto(out *DockerfileImage) { *out = *in - in.LabeledCommand.DeepCopyInto(&out.LabeledCommand) - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]EnvVar, len(*in)) - copy(*out, *in) - } + out.BaseImage = in.BaseImage + in.DockerfileSrc.DeepCopyInto(&out.DockerfileSrc) + in.Dockerfile.DeepCopyInto(&out.Dockerfile) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecCommand. -func (in *ExecCommand) DeepCopy() *ExecCommand { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileImage. +func (in *DockerfileImage) DeepCopy() *DockerfileImage { if in == nil { return nil } - out := new(ExecCommand) + out := new(DockerfileImage) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExecCommandParentOverride) DeepCopyInto(out *ExecCommandParentOverride) { +func (in *DockerfileImageParentOverride) DeepCopyInto(out *DockerfileImageParentOverride) { *out = *in - in.LabeledCommandParentOverride.DeepCopyInto(&out.LabeledCommandParentOverride) - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]EnvVarParentOverride, len(*in)) - copy(*out, *in) - } + out.BaseImageParentOverride = in.BaseImageParentOverride + in.DockerfileSrcParentOverride.DeepCopyInto(&out.DockerfileSrcParentOverride) + in.DockerfileParentOverride.DeepCopyInto(&out.DockerfileParentOverride) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecCommandParentOverride. -func (in *ExecCommandParentOverride) DeepCopy() *ExecCommandParentOverride { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileImageParentOverride. +func (in *DockerfileImageParentOverride) DeepCopy() *DockerfileImageParentOverride { if in == nil { return nil } - out := new(ExecCommandParentOverride) + out := new(DockerfileImageParentOverride) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExecCommandPluginOverride) DeepCopyInto(out *ExecCommandPluginOverride) { +func (in *DockerfileImagePluginOverride) DeepCopyInto(out *DockerfileImagePluginOverride) { *out = *in - in.LabeledCommandPluginOverride.DeepCopyInto(&out.LabeledCommandPluginOverride) - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]EnvVarPluginOverride, len(*in)) - copy(*out, *in) - } + out.BaseImagePluginOverride = in.BaseImagePluginOverride + in.DockerfileSrcPluginOverride.DeepCopyInto(&out.DockerfileSrcPluginOverride) + in.DockerfilePluginOverride.DeepCopyInto(&out.DockerfilePluginOverride) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecCommandPluginOverride. -func (in *ExecCommandPluginOverride) DeepCopy() *ExecCommandPluginOverride { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileImagePluginOverride. +func (in *DockerfileImagePluginOverride) DeepCopy() *DockerfileImagePluginOverride { if in == nil { return nil } - out := new(ExecCommandPluginOverride) + out := new(DockerfileImagePluginOverride) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExecCommandPluginOverrideParentOverride) DeepCopyInto(out *ExecCommandPluginOverrideParentOverride) { +func (in *DockerfileImagePluginOverrideParentOverride) DeepCopyInto(out *DockerfileImagePluginOverrideParentOverride) { *out = *in - in.LabeledCommandPluginOverrideParentOverride.DeepCopyInto(&out.LabeledCommandPluginOverrideParentOverride) - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]EnvVarPluginOverrideParentOverride, len(*in)) - copy(*out, *in) - } + out.BaseImagePluginOverrideParentOverride = in.BaseImagePluginOverrideParentOverride + in.DockerfileSrcPluginOverrideParentOverride.DeepCopyInto(&out.DockerfileSrcPluginOverrideParentOverride) + in.DockerfilePluginOverrideParentOverride.DeepCopyInto(&out.DockerfilePluginOverrideParentOverride) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileImagePluginOverrideParentOverride. +func (in *DockerfileImagePluginOverrideParentOverride) DeepCopy() *DockerfileImagePluginOverrideParentOverride { + if in == nil { + return nil + } + out := new(DockerfileImagePluginOverrideParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerfileParentOverride) DeepCopyInto(out *DockerfileParentOverride) { + *out = *in + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.RootRequired != nil { + in, out := &in.RootRequired, &out.RootRequired + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileParentOverride. +func (in *DockerfileParentOverride) DeepCopy() *DockerfileParentOverride { + if in == nil { + return nil + } + out := new(DockerfileParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerfilePluginOverride) DeepCopyInto(out *DockerfilePluginOverride) { + *out = *in + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.RootRequired != nil { + in, out := &in.RootRequired, &out.RootRequired + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfilePluginOverride. +func (in *DockerfilePluginOverride) DeepCopy() *DockerfilePluginOverride { + if in == nil { + return nil + } + out := new(DockerfilePluginOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerfilePluginOverrideParentOverride) DeepCopyInto(out *DockerfilePluginOverrideParentOverride) { + *out = *in + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.RootRequired != nil { + in, out := &in.RootRequired, &out.RootRequired + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfilePluginOverrideParentOverride. +func (in *DockerfilePluginOverrideParentOverride) DeepCopy() *DockerfilePluginOverrideParentOverride { + if in == nil { + return nil + } + out := new(DockerfilePluginOverrideParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerfileSrc) DeepCopyInto(out *DockerfileSrc) { + *out = *in + if in.DevfileRegistry != nil { + in, out := &in.DevfileRegistry, &out.DevfileRegistry + *out = new(DockerfileDevfileRegistrySource) + **out = **in + } + if in.Git != nil { + in, out := &in.Git, &out.Git + *out = new(DockerfileGitProjectSource) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileSrc. +func (in *DockerfileSrc) DeepCopy() *DockerfileSrc { + if in == nil { + return nil + } + out := new(DockerfileSrc) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerfileSrcParentOverride) DeepCopyInto(out *DockerfileSrcParentOverride) { + *out = *in + if in.DevfileRegistry != nil { + in, out := &in.DevfileRegistry, &out.DevfileRegistry + *out = new(DockerfileDevfileRegistrySourceParentOverride) + **out = **in + } + if in.Git != nil { + in, out := &in.Git, &out.Git + *out = new(DockerfileGitProjectSourceParentOverride) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileSrcParentOverride. +func (in *DockerfileSrcParentOverride) DeepCopy() *DockerfileSrcParentOverride { + if in == nil { + return nil + } + out := new(DockerfileSrcParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerfileSrcPluginOverride) DeepCopyInto(out *DockerfileSrcPluginOverride) { + *out = *in + if in.DevfileRegistry != nil { + in, out := &in.DevfileRegistry, &out.DevfileRegistry + *out = new(DockerfileDevfileRegistrySourcePluginOverride) + **out = **in + } + if in.Git != nil { + in, out := &in.Git, &out.Git + *out = new(DockerfileGitProjectSourcePluginOverride) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileSrcPluginOverride. +func (in *DockerfileSrcPluginOverride) DeepCopy() *DockerfileSrcPluginOverride { + if in == nil { + return nil + } + out := new(DockerfileSrcPluginOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerfileSrcPluginOverrideParentOverride) DeepCopyInto(out *DockerfileSrcPluginOverrideParentOverride) { + *out = *in + if in.DevfileRegistry != nil { + in, out := &in.DevfileRegistry, &out.DevfileRegistry + *out = new(DockerfileDevfileRegistrySourcePluginOverrideParentOverride) + **out = **in + } + if in.Git != nil { + in, out := &in.Git, &out.Git + *out = new(DockerfileGitProjectSourcePluginOverrideParentOverride) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerfileSrcPluginOverrideParentOverride. +func (in *DockerfileSrcPluginOverrideParentOverride) DeepCopy() *DockerfileSrcPluginOverrideParentOverride { + if in == nil { + return nil + } + out := new(DockerfileSrcPluginOverrideParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Endpoint) DeepCopyInto(out *Endpoint) { + *out = *in + if in.Secure != nil { + in, out := &in.Secure, &out.Secure + *out = new(bool) + **out = **in + } + if in.Attributes != nil { + in, out := &in.Attributes, &out.Attributes + *out = make(attributes.Attributes, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoint. +func (in *Endpoint) DeepCopy() *Endpoint { + if in == nil { + return nil + } + out := new(Endpoint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointParentOverride) DeepCopyInto(out *EndpointParentOverride) { + *out = *in + if in.Secure != nil { + in, out := &in.Secure, &out.Secure + *out = new(bool) + **out = **in + } + if in.Attributes != nil { + in, out := &in.Attributes, &out.Attributes + *out = make(attributes.Attributes, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointParentOverride. +func (in *EndpointParentOverride) DeepCopy() *EndpointParentOverride { + if in == nil { + return nil + } + out := new(EndpointParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointPluginOverride) DeepCopyInto(out *EndpointPluginOverride) { + *out = *in + if in.Secure != nil { + in, out := &in.Secure, &out.Secure + *out = new(bool) + **out = **in + } + if in.Attributes != nil { + in, out := &in.Attributes, &out.Attributes + *out = make(attributes.Attributes, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointPluginOverride. +func (in *EndpointPluginOverride) DeepCopy() *EndpointPluginOverride { + if in == nil { + return nil + } + out := new(EndpointPluginOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointPluginOverrideParentOverride) DeepCopyInto(out *EndpointPluginOverrideParentOverride) { + *out = *in + if in.Secure != nil { + in, out := &in.Secure, &out.Secure + *out = new(bool) + **out = **in + } + if in.Attributes != nil { + in, out := &in.Attributes, &out.Attributes + *out = make(attributes.Attributes, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointPluginOverrideParentOverride. +func (in *EndpointPluginOverrideParentOverride) DeepCopy() *EndpointPluginOverrideParentOverride { + if in == nil { + return nil + } + out := new(EndpointPluginOverrideParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvVar) DeepCopyInto(out *EnvVar) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvVar. +func (in *EnvVar) DeepCopy() *EnvVar { + if in == nil { + return nil + } + out := new(EnvVar) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvVarParentOverride) DeepCopyInto(out *EnvVarParentOverride) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvVarParentOverride. +func (in *EnvVarParentOverride) DeepCopy() *EnvVarParentOverride { + if in == nil { + return nil + } + out := new(EnvVarParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvVarPluginOverride) DeepCopyInto(out *EnvVarPluginOverride) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvVarPluginOverride. +func (in *EnvVarPluginOverride) DeepCopy() *EnvVarPluginOverride { + if in == nil { + return nil + } + out := new(EnvVarPluginOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvVarPluginOverrideParentOverride) DeepCopyInto(out *EnvVarPluginOverrideParentOverride) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvVarPluginOverrideParentOverride. +func (in *EnvVarPluginOverrideParentOverride) DeepCopy() *EnvVarPluginOverrideParentOverride { + if in == nil { + return nil + } + out := new(EnvVarPluginOverrideParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Events) DeepCopyInto(out *Events) { + *out = *in + in.DevWorkspaceEvents.DeepCopyInto(&out.DevWorkspaceEvents) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Events. +func (in *Events) DeepCopy() *Events { + if in == nil { + return nil + } + out := new(Events) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecCommand) DeepCopyInto(out *ExecCommand) { + *out = *in + in.LabeledCommand.DeepCopyInto(&out.LabeledCommand) + if in.Env != nil { + in, out := &in.Env, &out.Env + *out = make([]EnvVar, len(*in)) + copy(*out, *in) + } + if in.HotReloadCapable != nil { + in, out := &in.HotReloadCapable, &out.HotReloadCapable + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecCommand. +func (in *ExecCommand) DeepCopy() *ExecCommand { + if in == nil { + return nil + } + out := new(ExecCommand) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecCommandParentOverride) DeepCopyInto(out *ExecCommandParentOverride) { + *out = *in + in.LabeledCommandParentOverride.DeepCopyInto(&out.LabeledCommandParentOverride) + if in.Env != nil { + in, out := &in.Env, &out.Env + *out = make([]EnvVarParentOverride, len(*in)) + copy(*out, *in) + } + if in.HotReloadCapable != nil { + in, out := &in.HotReloadCapable, &out.HotReloadCapable + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecCommandParentOverride. +func (in *ExecCommandParentOverride) DeepCopy() *ExecCommandParentOverride { + if in == nil { + return nil + } + out := new(ExecCommandParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecCommandPluginOverride) DeepCopyInto(out *ExecCommandPluginOverride) { + *out = *in + in.LabeledCommandPluginOverride.DeepCopyInto(&out.LabeledCommandPluginOverride) + if in.Env != nil { + in, out := &in.Env, &out.Env + *out = make([]EnvVarPluginOverride, len(*in)) + copy(*out, *in) + } + if in.HotReloadCapable != nil { + in, out := &in.HotReloadCapable, &out.HotReloadCapable + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecCommandPluginOverride. +func (in *ExecCommandPluginOverride) DeepCopy() *ExecCommandPluginOverride { + if in == nil { + return nil + } + out := new(ExecCommandPluginOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExecCommandPluginOverrideParentOverride) DeepCopyInto(out *ExecCommandPluginOverrideParentOverride) { + *out = *in + in.LabeledCommandPluginOverrideParentOverride.DeepCopyInto(&out.LabeledCommandPluginOverrideParentOverride) + if in.Env != nil { + in, out := &in.Env, &out.Env + *out = make([]EnvVarPluginOverrideParentOverride, len(*in)) + copy(*out, *in) + } + if in.HotReloadCapable != nil { + in, out := &in.HotReloadCapable, &out.HotReloadCapable + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecCommandPluginOverrideParentOverride. @@ -1779,6 +2415,62 @@ func (in *GitLikeProjectSourceParentOverride) DeepCopy() *GitLikeProjectSourcePa return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GitLikeProjectSourcePluginOverride) DeepCopyInto(out *GitLikeProjectSourcePluginOverride) { + *out = *in + out.CommonProjectSourcePluginOverride = in.CommonProjectSourcePluginOverride + if in.CheckoutFrom != nil { + in, out := &in.CheckoutFrom, &out.CheckoutFrom + *out = new(CheckoutFromPluginOverride) + **out = **in + } + if in.Remotes != nil { + in, out := &in.Remotes, &out.Remotes + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitLikeProjectSourcePluginOverride. +func (in *GitLikeProjectSourcePluginOverride) DeepCopy() *GitLikeProjectSourcePluginOverride { + if in == nil { + return nil + } + out := new(GitLikeProjectSourcePluginOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GitLikeProjectSourcePluginOverrideParentOverride) DeepCopyInto(out *GitLikeProjectSourcePluginOverrideParentOverride) { + *out = *in + out.CommonProjectSourcePluginOverrideParentOverride = in.CommonProjectSourcePluginOverrideParentOverride + if in.CheckoutFrom != nil { + in, out := &in.CheckoutFrom, &out.CheckoutFrom + *out = new(CheckoutFromPluginOverrideParentOverride) + **out = **in + } + if in.Remotes != nil { + in, out := &in.Remotes, &out.Remotes + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitLikeProjectSourcePluginOverrideParentOverride. +func (in *GitLikeProjectSourcePluginOverrideParentOverride) DeepCopy() *GitLikeProjectSourcePluginOverrideParentOverride { + if in == nil { + return nil + } + out := new(GitLikeProjectSourcePluginOverrideParentOverride) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GitProjectSource) DeepCopyInto(out *GitProjectSource) { *out = *in @@ -1811,6 +2503,250 @@ func (in *GitProjectSourceParentOverride) DeepCopy() *GitProjectSourceParentOver return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GitProjectSourcePluginOverride) DeepCopyInto(out *GitProjectSourcePluginOverride) { + *out = *in + in.GitLikeProjectSourcePluginOverride.DeepCopyInto(&out.GitLikeProjectSourcePluginOverride) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitProjectSourcePluginOverride. +func (in *GitProjectSourcePluginOverride) DeepCopy() *GitProjectSourcePluginOverride { + if in == nil { + return nil + } + out := new(GitProjectSourcePluginOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GitProjectSourcePluginOverrideParentOverride) DeepCopyInto(out *GitProjectSourcePluginOverrideParentOverride) { + *out = *in + in.GitLikeProjectSourcePluginOverrideParentOverride.DeepCopyInto(&out.GitLikeProjectSourcePluginOverrideParentOverride) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitProjectSourcePluginOverrideParentOverride. +func (in *GitProjectSourcePluginOverrideParentOverride) DeepCopy() *GitProjectSourcePluginOverrideParentOverride { + if in == nil { + return nil + } + out := new(GitProjectSourcePluginOverrideParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Image) DeepCopyInto(out *Image) { + *out = *in + in.ImageUnion.DeepCopyInto(&out.ImageUnion) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image. +func (in *Image) DeepCopy() *Image { + if in == nil { + return nil + } + out := new(Image) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageComponent) DeepCopyInto(out *ImageComponent) { + *out = *in + out.BaseComponent = in.BaseComponent + in.Image.DeepCopyInto(&out.Image) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageComponent. +func (in *ImageComponent) DeepCopy() *ImageComponent { + if in == nil { + return nil + } + out := new(ImageComponent) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageComponentParentOverride) DeepCopyInto(out *ImageComponentParentOverride) { + *out = *in + out.BaseComponentParentOverride = in.BaseComponentParentOverride + in.ImageParentOverride.DeepCopyInto(&out.ImageParentOverride) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageComponentParentOverride. +func (in *ImageComponentParentOverride) DeepCopy() *ImageComponentParentOverride { + if in == nil { + return nil + } + out := new(ImageComponentParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageComponentPluginOverride) DeepCopyInto(out *ImageComponentPluginOverride) { + *out = *in + out.BaseComponentPluginOverride = in.BaseComponentPluginOverride + in.ImagePluginOverride.DeepCopyInto(&out.ImagePluginOverride) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageComponentPluginOverride. +func (in *ImageComponentPluginOverride) DeepCopy() *ImageComponentPluginOverride { + if in == nil { + return nil + } + out := new(ImageComponentPluginOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageComponentPluginOverrideParentOverride) DeepCopyInto(out *ImageComponentPluginOverrideParentOverride) { + *out = *in + out.BaseComponentPluginOverrideParentOverride = in.BaseComponentPluginOverrideParentOverride + in.ImagePluginOverrideParentOverride.DeepCopyInto(&out.ImagePluginOverrideParentOverride) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageComponentPluginOverrideParentOverride. +func (in *ImageComponentPluginOverrideParentOverride) DeepCopy() *ImageComponentPluginOverrideParentOverride { + if in == nil { + return nil + } + out := new(ImageComponentPluginOverrideParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageParentOverride) DeepCopyInto(out *ImageParentOverride) { + *out = *in + in.ImageUnionParentOverride.DeepCopyInto(&out.ImageUnionParentOverride) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageParentOverride. +func (in *ImageParentOverride) DeepCopy() *ImageParentOverride { + if in == nil { + return nil + } + out := new(ImageParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImagePluginOverride) DeepCopyInto(out *ImagePluginOverride) { + *out = *in + in.ImageUnionPluginOverride.DeepCopyInto(&out.ImageUnionPluginOverride) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImagePluginOverride. +func (in *ImagePluginOverride) DeepCopy() *ImagePluginOverride { + if in == nil { + return nil + } + out := new(ImagePluginOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImagePluginOverrideParentOverride) DeepCopyInto(out *ImagePluginOverrideParentOverride) { + *out = *in + in.ImageUnionPluginOverrideParentOverride.DeepCopyInto(&out.ImageUnionPluginOverrideParentOverride) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImagePluginOverrideParentOverride. +func (in *ImagePluginOverrideParentOverride) DeepCopy() *ImagePluginOverrideParentOverride { + if in == nil { + return nil + } + out := new(ImagePluginOverrideParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageUnion) DeepCopyInto(out *ImageUnion) { + *out = *in + if in.Dockerfile != nil { + in, out := &in.Dockerfile, &out.Dockerfile + *out = new(DockerfileImage) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageUnion. +func (in *ImageUnion) DeepCopy() *ImageUnion { + if in == nil { + return nil + } + out := new(ImageUnion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageUnionParentOverride) DeepCopyInto(out *ImageUnionParentOverride) { + *out = *in + if in.Dockerfile != nil { + in, out := &in.Dockerfile, &out.Dockerfile + *out = new(DockerfileImageParentOverride) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageUnionParentOverride. +func (in *ImageUnionParentOverride) DeepCopy() *ImageUnionParentOverride { + if in == nil { + return nil + } + out := new(ImageUnionParentOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageUnionPluginOverride) DeepCopyInto(out *ImageUnionPluginOverride) { + *out = *in + if in.Dockerfile != nil { + in, out := &in.Dockerfile, &out.Dockerfile + *out = new(DockerfileImagePluginOverride) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageUnionPluginOverride. +func (in *ImageUnionPluginOverride) DeepCopy() *ImageUnionPluginOverride { + if in == nil { + return nil + } + out := new(ImageUnionPluginOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageUnionPluginOverrideParentOverride) DeepCopyInto(out *ImageUnionPluginOverrideParentOverride) { + *out = *in + if in.Dockerfile != nil { + in, out := &in.Dockerfile, &out.Dockerfile + *out = new(DockerfileImagePluginOverrideParentOverride) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageUnionPluginOverrideParentOverride. +func (in *ImageUnionPluginOverrideParentOverride) DeepCopy() *ImageUnionPluginOverrideParentOverride { + if in == nil { + return nil + } + out := new(ImageUnionPluginOverrideParentOverride) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ImportReference) DeepCopyInto(out *ImportReference) { *out = *in @@ -2637,6 +3573,11 @@ func (in *StarterProjectParentOverride) DeepCopy() *StarterProjectParentOverride // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Volume) DeepCopyInto(out *Volume) { *out = *in + if in.Ephemeral != nil { + in, out := &in.Ephemeral, &out.Ephemeral + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Volume. @@ -2653,7 +3594,7 @@ func (in *Volume) DeepCopy() *Volume { func (in *VolumeComponent) DeepCopyInto(out *VolumeComponent) { *out = *in out.BaseComponent = in.BaseComponent - out.Volume = in.Volume + in.Volume.DeepCopyInto(&out.Volume) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeComponent. @@ -2670,7 +3611,7 @@ func (in *VolumeComponent) DeepCopy() *VolumeComponent { func (in *VolumeComponentParentOverride) DeepCopyInto(out *VolumeComponentParentOverride) { *out = *in out.BaseComponentParentOverride = in.BaseComponentParentOverride - out.VolumeParentOverride = in.VolumeParentOverride + in.VolumeParentOverride.DeepCopyInto(&out.VolumeParentOverride) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeComponentParentOverride. @@ -2687,7 +3628,7 @@ func (in *VolumeComponentParentOverride) DeepCopy() *VolumeComponentParentOverri func (in *VolumeComponentPluginOverride) DeepCopyInto(out *VolumeComponentPluginOverride) { *out = *in out.BaseComponentPluginOverride = in.BaseComponentPluginOverride - out.VolumePluginOverride = in.VolumePluginOverride + in.VolumePluginOverride.DeepCopyInto(&out.VolumePluginOverride) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeComponentPluginOverride. @@ -2704,7 +3645,7 @@ func (in *VolumeComponentPluginOverride) DeepCopy() *VolumeComponentPluginOverri func (in *VolumeComponentPluginOverrideParentOverride) DeepCopyInto(out *VolumeComponentPluginOverrideParentOverride) { *out = *in out.BaseComponentPluginOverrideParentOverride = in.BaseComponentPluginOverrideParentOverride - out.VolumePluginOverrideParentOverride = in.VolumePluginOverrideParentOverride + in.VolumePluginOverrideParentOverride.DeepCopyInto(&out.VolumePluginOverrideParentOverride) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeComponentPluginOverrideParentOverride. @@ -2780,6 +3721,11 @@ func (in *VolumeMountPluginOverrideParentOverride) DeepCopy() *VolumeMountPlugin // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VolumeParentOverride) DeepCopyInto(out *VolumeParentOverride) { *out = *in + if in.Ephemeral != nil { + in, out := &in.Ephemeral, &out.Ephemeral + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeParentOverride. @@ -2795,6 +3741,11 @@ func (in *VolumeParentOverride) DeepCopy() *VolumeParentOverride { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VolumePluginOverride) DeepCopyInto(out *VolumePluginOverride) { *out = *in + if in.Ephemeral != nil { + in, out := &in.Ephemeral, &out.Ephemeral + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumePluginOverride. @@ -2810,6 +3761,11 @@ func (in *VolumePluginOverride) DeepCopy() *VolumePluginOverride { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VolumePluginOverrideParentOverride) DeepCopyInto(out *VolumePluginOverrideParentOverride) { *out = *in + if in.Ephemeral != nil { + in, out := &in.Ephemeral, &out.Ephemeral + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumePluginOverrideParentOverride. diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.parent_overrides.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.parent_overrides.go index 4d2c8fbde00..4886db49e64 100644 --- a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.parent_overrides.go +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.parent_overrides.go @@ -18,6 +18,9 @@ type ParentOverrides struct { // Overriding is done according to K8S strategic merge patch standard rules. // +optional // +patchStrategy=merge + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty" patchStrategy:"merge"` // Overrides of components encapsulated in a parent devfile or a plugin. @@ -65,6 +68,9 @@ type ComponentParentOverride struct { // Map of implementation-dependant free-form YAML attributes. // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` ComponentUnionParentOverride `json:",inline"` } @@ -78,6 +84,9 @@ type ProjectParentOverride struct { // Map of implementation-dependant free-form YAML attributes. // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` // Path relative to the root of the projects to which this project should be cloned into. This is a unix-style relative path (i.e. uses forward slashes). The path is invalid if it is absolute or tries to escape the project root through the usage of '..'. If not specified, defaults to the project name. @@ -96,6 +105,9 @@ type StarterProjectParentOverride struct { // Map of implementation-dependant free-form YAML attributes. // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` // Description of a starter project @@ -120,6 +132,9 @@ type CommandParentOverride struct { // Map of implementation-dependant free-form YAML attributes. // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` CommandUnionParentOverride `json:",inline"` } @@ -127,7 +142,7 @@ type CommandParentOverride struct { // +union type ComponentUnionParentOverride struct { - // +kubebuilder:validation:Enum=Container;Kubernetes;Openshift;Volume;Plugin + // +kubebuilder:validation:Enum=Container;Kubernetes;Openshift;Volume;Image;Plugin // Type of component // // +unionDiscriminator @@ -157,6 +172,10 @@ type ComponentUnionParentOverride struct { // +optional Volume *VolumeComponentParentOverride `json:"volume,omitempty"` + // Allows specifying the definition of an image for outer loop builds + // +optional + Image *ImageComponentParentOverride `json:"image,omitempty"` + // Allows importing a plugin. // // Plugins are mainly imported devfiles that contribute components, commands @@ -247,6 +266,12 @@ type VolumeComponentParentOverride struct { VolumeParentOverride `json:",inline"` } +// Component that allows the developer to build a runtime image for outerloop +type ImageComponentParentOverride struct { + BaseComponentParentOverride `json:",inline"` + ImageParentOverride `json:",inline"` +} + type PluginComponentParentOverride struct { BaseComponentParentOverride `json:",inline"` ImportReferenceParentOverride `json:",inline"` @@ -315,7 +340,7 @@ type ExecCommandParentOverride struct { // If set to `true` the command won't be restarted and it is expected to handle file changes on its own. // // Default value is `false` - HotReloadCapable bool `json:"hotReloadCapable,omitempty"` + HotReloadCapable *bool `json:"hotReloadCapable,omitempty"` } type ApplyCommandParentOverride struct { @@ -335,7 +360,7 @@ type CompositeCommandParentOverride struct { // Indicates if the sub-commands should be executed concurrently // +optional - Parallel bool `json:"parallel,omitempty"` + Parallel *bool `json:"parallel,omitempty"` } // DevWorkspace component: Anything that will bring additional features / tooling / behaviour / context @@ -405,7 +430,7 @@ type ContainerParentOverride struct { // // Default value is `false` // +optional - DedicatedPod bool `json:"dedicatedPod,omitempty"` + DedicatedPod *bool `json:"dedicatedPod,omitempty"` } type EndpointParentOverride struct { @@ -456,7 +481,7 @@ type EndpointParentOverride struct { // Describes whether the endpoint should be secured and protected by some // authentication process. This requires a protocol of `https` or `wss`. // +optional - Secure bool `json:"secure,omitempty"` + Secure *bool `json:"secure,omitempty"` // Path of the endpoint URL // +optional @@ -470,6 +495,9 @@ type EndpointParentOverride struct { // // - type: "terminal" / "ide" / "ide-dev", // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` } @@ -489,7 +517,15 @@ type VolumeParentOverride struct { // +optional // Ephemeral volumes are not stored persistently across restarts. Defaults // to false - Ephemeral bool `json:"ephemeral,omitempty"` + Ephemeral *bool `json:"ephemeral,omitempty"` +} + +type ImageParentOverride struct { + + // +optional + // Name of the image for the resulting outerloop build + ImageName string `json:"imageName,omitempty"` + ImageUnionParentOverride `json:",inline"` } type ImportReferenceParentOverride struct { @@ -497,7 +533,7 @@ type ImportReferenceParentOverride struct { // Registry URL to pull the parent devfile from when using id in the parent reference. // To ensure the parent devfile gets resolved consistently in different environments, - // it is recommended to always specify the `regsitryURL` when `Id` is used. + // it is recommended to always specify the `registryUrl` when `id` is used. // +optional RegistryUrl string `json:"registryUrl,omitempty"` } @@ -530,7 +566,8 @@ type GitLikeProjectSourceParentOverride struct { CheckoutFrom *CheckoutFromParentOverride `json:"checkoutFrom,omitempty"` // +optional - // The remotes map which should be initialized in the git project. Must have at least one remote configured + // The remotes map which should be initialized in the git project. + // Projects must have at least one remote configured while StarterProjects & Image Component's Git source can only have at most one remote configured. Remotes map[string]string `json:"remotes,omitempty"` } @@ -597,6 +634,21 @@ type K8sLikeComponentLocationParentOverride struct { Inlined string `json:"inlined,omitempty"` } +// +union +type ImageUnionParentOverride struct { + + // +kubebuilder:validation:Enum=Dockerfile + // Type of image + // + // +unionDiscriminator + // +optional + ImageType ImageTypeParentOverride `json:"imageType,omitempty"` + + // Allows specifying dockerfile type build + // +optional + Dockerfile *DockerfileImageParentOverride `json:"dockerfile,omitempty"` +} + // Location from where the an import reference is retrieved // +union type ImportReferenceUnionParentOverride struct { @@ -638,6 +690,9 @@ type ComponentPluginOverrideParentOverride struct { // Map of implementation-dependant free-form YAML attributes. // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` ComponentUnionPluginOverrideParentOverride `json:",inline"` } @@ -653,6 +708,9 @@ type CommandPluginOverrideParentOverride struct { // Map of implementation-dependant free-form YAML attributes. // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` CommandUnionPluginOverrideParentOverride `json:",inline"` } @@ -681,6 +739,17 @@ type BaseCommandParentOverride struct { // Only one of the following component type may be specified. type K8sLikeComponentLocationTypeParentOverride string +// ImageType describes the type of image. +// Only one of the following image type may be specified. +type ImageTypeParentOverride string + +// Dockerfile Image type to specify the outerloop build using a Dockerfile +type DockerfileImageParentOverride struct { + BaseImageParentOverride `json:",inline"` + DockerfileSrcParentOverride `json:",inline"` + DockerfileParentOverride `json:",inline"` +} + // ImportReferenceType describes the type of location // from where the referenced template structure should be retrieved. // Only one of the following parent locations may be specified. @@ -697,7 +766,7 @@ type KubernetesCustomResourceImportReferenceParentOverride struct { // +union type ComponentUnionPluginOverrideParentOverride struct { - // +kubebuilder:validation:Enum=Container;Kubernetes;Openshift;Volume + // +kubebuilder:validation:Enum=Container;Kubernetes;Openshift;Volume;Image // Type of component // // +unionDiscriminator @@ -726,6 +795,10 @@ type ComponentUnionPluginOverrideParentOverride struct { // shared by several other components // +optional Volume *VolumeComponentPluginOverrideParentOverride `json:"volume,omitempty"` + + // Allows specifying the definition of an image for outer loop builds + // +optional + Image *ImageComponentPluginOverrideParentOverride `json:"image,omitempty"` } // +union @@ -769,7 +842,51 @@ type CommandGroupParentOverride struct { // +optional // Identifies the default command for a given group kind - IsDefault bool `json:"isDefault,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` +} + +type BaseImageParentOverride struct { +} + +// +union +type DockerfileSrcParentOverride struct { + + // +kubebuilder:validation:Enum=Uri;DevfileRegistry;Git + // Type of Dockerfile src + // + + // +unionDiscriminator + // +optional + SrcType DockerfileSrcTypeParentOverride `json:"srcType,omitempty"` + + // URI Reference of a Dockerfile. + // It can be a full URL or a relative URI from the current devfile as the base URI. + // +optional + Uri string `json:"uri,omitempty"` + + // Dockerfile's Devfile Registry source + // +optional + DevfileRegistry *DockerfileDevfileRegistrySourceParentOverride `json:"devfileRegistry,omitempty"` + + // Dockerfile's Git source + // +optional + Git *DockerfileGitProjectSourceParentOverride `json:"git,omitempty"` +} + +type DockerfileParentOverride struct { + + // Path of source directory to establish build context. Defaults to ${PROJECT_ROOT} in the container + // +optional + BuildContext string `json:"buildContext,omitempty"` + + // The arguments to supply to the dockerfile build. + // +optional + Args []string `json:"args,omitempty" patchStrategy:"replace"` + + // Specify if a privileged builder pod is required. + // + // Default value is `false` + // +optional + RootRequired *bool `json:"rootRequired,omitempty"` } // ComponentType describes the type of component. @@ -799,6 +916,12 @@ type VolumeComponentPluginOverrideParentOverride struct { VolumePluginOverrideParentOverride `json:",inline"` } +// Component that allows the developer to build a runtime image for outerloop +type ImageComponentPluginOverrideParentOverride struct { + BaseComponentPluginOverrideParentOverride `json:",inline"` + ImagePluginOverrideParentOverride `json:",inline"` +} + // CommandType describes the type of command. // Only one of the following command type may be specified. type CommandTypePluginOverrideParentOverride string @@ -843,7 +966,7 @@ type ExecCommandPluginOverrideParentOverride struct { // If set to `true` the command won't be restarted and it is expected to handle file changes on its own. // // Default value is `false` - HotReloadCapable bool `json:"hotReloadCapable,omitempty"` + HotReloadCapable *bool `json:"hotReloadCapable,omitempty"` } type ApplyCommandPluginOverrideParentOverride struct { @@ -863,13 +986,44 @@ type CompositeCommandPluginOverrideParentOverride struct { // Indicates if the sub-commands should be executed concurrently // +optional - Parallel bool `json:"parallel,omitempty"` + Parallel *bool `json:"parallel,omitempty"` } // CommandGroupKind describes the kind of command group. -// +kubebuilder:validation:Enum=build;run;test;debug +// +kubebuilder:validation:Enum=build;run;test;debug;deploy type CommandGroupKindParentOverride string +// DockerfileSrcType describes the type of +// the src for the Dockerfile outerloop build. +// Only one of the following location type may be specified. +type DockerfileSrcTypeParentOverride string + +type DockerfileDevfileRegistrySourceParentOverride struct { + + // +optional + // Id in a devfile registry that contains a Dockerfile. The src in the OCI registry + // required for the Dockerfile build will be downloaded for building the image. + Id string `json:"id,omitempty"` + + // Devfile Registry URL to pull the Dockerfile from when using the Devfile Registry as Dockerfile src. + // To ensure the Dockerfile gets resolved consistently in different environments, + // it is recommended to always specify the `devfileRegistryUrl` when `Id` is used. + // +optional + RegistryUrl string `json:"registryUrl,omitempty"` +} + +type DockerfileGitProjectSourceParentOverride struct { + + // Git src for the Dockerfile build. The src required for the Dockerfile build will need to be + // cloned for building the image. + GitProjectSourceParentOverride `json:",inline"` + + // Location of the Dockerfile in the Git repository when using git as Dockerfile src. + // Defaults to Dockerfile. + // +optional + FileLocation string `json:"fileLocation,omitempty"` +} + // DevWorkspace component: Anything that will bring additional features / tooling / behaviour / context // to the devworkspace, in order to make working in it easier. type BaseComponentPluginOverrideParentOverride struct { @@ -938,7 +1092,7 @@ type ContainerPluginOverrideParentOverride struct { // // Default value is `false` // +optional - DedicatedPod bool `json:"dedicatedPod,omitempty"` + DedicatedPod *bool `json:"dedicatedPod,omitempty"` } type EndpointPluginOverrideParentOverride struct { @@ -989,7 +1143,7 @@ type EndpointPluginOverrideParentOverride struct { // Describes whether the endpoint should be secured and protected by some // authentication process. This requires a protocol of `https` or `wss`. // +optional - Secure bool `json:"secure,omitempty"` + Secure *bool `json:"secure,omitempty"` // Path of the endpoint URL // +optional @@ -1003,6 +1157,9 @@ type EndpointPluginOverrideParentOverride struct { // // - type: "terminal" / "ide" / "ide-dev", // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` } @@ -1022,7 +1179,15 @@ type VolumePluginOverrideParentOverride struct { // +optional // Ephemeral volumes are not stored persistently across restarts. Defaults // to false - Ephemeral bool `json:"ephemeral,omitempty"` + Ephemeral *bool `json:"ephemeral,omitempty"` +} + +type ImagePluginOverrideParentOverride struct { + + // +optional + // Name of the image for the resulting outerloop build + ImageName string `json:"imageName,omitempty"` + ImageUnionPluginOverrideParentOverride `json:",inline"` } type LabeledCommandPluginOverrideParentOverride struct { @@ -1086,6 +1251,21 @@ type K8sLikeComponentLocationPluginOverrideParentOverride struct { Inlined string `json:"inlined,omitempty"` } +// +union +type ImageUnionPluginOverrideParentOverride struct { + + // +kubebuilder:validation:Enum=Dockerfile + // Type of image + // + // +unionDiscriminator + // +optional + ImageType ImageTypePluginOverrideParentOverride `json:"imageType,omitempty"` + + // Allows specifying dockerfile type build + // +optional + Dockerfile *DockerfileImagePluginOverrideParentOverride `json:"dockerfile,omitempty"` +} + type BaseCommandPluginOverrideParentOverride struct { // +optional @@ -1098,6 +1278,17 @@ type BaseCommandPluginOverrideParentOverride struct { // Only one of the following component type may be specified. type K8sLikeComponentLocationTypePluginOverrideParentOverride string +// ImageType describes the type of image. +// Only one of the following image type may be specified. +type ImageTypePluginOverrideParentOverride string + +// Dockerfile Image type to specify the outerloop build using a Dockerfile +type DockerfileImagePluginOverrideParentOverride struct { + BaseImagePluginOverrideParentOverride `json:",inline"` + DockerfileSrcPluginOverrideParentOverride `json:",inline"` + DockerfilePluginOverrideParentOverride `json:",inline"` +} + type CommandGroupPluginOverrideParentOverride struct { // +optional @@ -1106,11 +1297,118 @@ type CommandGroupPluginOverrideParentOverride struct { // +optional // Identifies the default command for a given group kind - IsDefault bool `json:"isDefault,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` +} + +type BaseImagePluginOverrideParentOverride struct { +} + +// +union +type DockerfileSrcPluginOverrideParentOverride struct { + + // +kubebuilder:validation:Enum=Uri;DevfileRegistry;Git + // Type of Dockerfile src + // + + // +unionDiscriminator + // +optional + SrcType DockerfileSrcTypePluginOverrideParentOverride `json:"srcType,omitempty"` + + // URI Reference of a Dockerfile. + // It can be a full URL or a relative URI from the current devfile as the base URI. + // +optional + Uri string `json:"uri,omitempty"` + + // Dockerfile's Devfile Registry source + // +optional + DevfileRegistry *DockerfileDevfileRegistrySourcePluginOverrideParentOverride `json:"devfileRegistry,omitempty"` + + // Dockerfile's Git source + // +optional + Git *DockerfileGitProjectSourcePluginOverrideParentOverride `json:"git,omitempty"` +} + +type DockerfilePluginOverrideParentOverride struct { + + // Path of source directory to establish build context. Defaults to ${PROJECT_ROOT} in the container + // +optional + BuildContext string `json:"buildContext,omitempty"` + + // The arguments to supply to the dockerfile build. + // +optional + Args []string `json:"args,omitempty" patchStrategy:"replace"` + + // Specify if a privileged builder pod is required. + // + // Default value is `false` + // +optional + RootRequired *bool `json:"rootRequired,omitempty"` } // CommandGroupKind describes the kind of command group. -// +kubebuilder:validation:Enum=build;run;test;debug +// +kubebuilder:validation:Enum=build;run;test;debug;deploy type CommandGroupKindPluginOverrideParentOverride string +// DockerfileSrcType describes the type of +// the src for the Dockerfile outerloop build. +// Only one of the following location type may be specified. +type DockerfileSrcTypePluginOverrideParentOverride string + +type DockerfileDevfileRegistrySourcePluginOverrideParentOverride struct { + + // +optional + // Id in a devfile registry that contains a Dockerfile. The src in the OCI registry + // required for the Dockerfile build will be downloaded for building the image. + Id string `json:"id,omitempty"` + + // Devfile Registry URL to pull the Dockerfile from when using the Devfile Registry as Dockerfile src. + // To ensure the Dockerfile gets resolved consistently in different environments, + // it is recommended to always specify the `devfileRegistryUrl` when `Id` is used. + // +optional + RegistryUrl string `json:"registryUrl,omitempty"` +} + +type DockerfileGitProjectSourcePluginOverrideParentOverride struct { + + // Git src for the Dockerfile build. The src required for the Dockerfile build will need to be + // cloned for building the image. + GitProjectSourcePluginOverrideParentOverride `json:",inline"` + + // Location of the Dockerfile in the Git repository when using git as Dockerfile src. + // Defaults to Dockerfile. + // +optional + FileLocation string `json:"fileLocation,omitempty"` +} + +type GitProjectSourcePluginOverrideParentOverride struct { + GitLikeProjectSourcePluginOverrideParentOverride `json:",inline"` +} + +type GitLikeProjectSourcePluginOverrideParentOverride struct { + CommonProjectSourcePluginOverrideParentOverride `json:",inline"` + + // Defines from what the project should be checked out. Required if there are more than one remote configured + // +optional + CheckoutFrom *CheckoutFromPluginOverrideParentOverride `json:"checkoutFrom,omitempty"` + + // +optional + // The remotes map which should be initialized in the git project. + // Projects must have at least one remote configured while StarterProjects & Image Component's Git source can only have at most one remote configured. + Remotes map[string]string `json:"remotes,omitempty"` +} + +type CommonProjectSourcePluginOverrideParentOverride struct { +} + +type CheckoutFromPluginOverrideParentOverride struct { + + // The revision to checkout from. Should be branch name, tag or commit id. + // Default branch is used if missing or specified revision is not found. + // +optional + Revision string `json:"revision,omitempty"` + + // The remote name should be used as init. Required if there are more than one remote configured + // +optional + Remote string `json:"remote,omitempty"` +} + func (overrides ParentOverrides) isOverride() {} diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.plugin_overrides.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.plugin_overrides.go index d94b3e6851d..93ccf8102ff 100644 --- a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.plugin_overrides.go +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.plugin_overrides.go @@ -37,6 +37,9 @@ type ComponentPluginOverride struct { // Map of implementation-dependant free-form YAML attributes. // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` ComponentUnionPluginOverride `json:",inline"` } @@ -52,6 +55,9 @@ type CommandPluginOverride struct { // Map of implementation-dependant free-form YAML attributes. // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` CommandUnionPluginOverride `json:",inline"` } @@ -59,7 +65,7 @@ type CommandPluginOverride struct { // +union type ComponentUnionPluginOverride struct { - // +kubebuilder:validation:Enum=Container;Kubernetes;Openshift;Volume + // +kubebuilder:validation:Enum=Container;Kubernetes;Openshift;Volume;Image // Type of component // // +unionDiscriminator @@ -88,6 +94,10 @@ type ComponentUnionPluginOverride struct { // shared by several other components // +optional Volume *VolumeComponentPluginOverride `json:"volume,omitempty"` + + // Allows specifying the definition of an image for outer loop builds + // +optional + Image *ImageComponentPluginOverride `json:"image,omitempty"` } // +union @@ -150,6 +160,12 @@ type VolumeComponentPluginOverride struct { VolumePluginOverride `json:",inline"` } +// Component that allows the developer to build a runtime image for outerloop +type ImageComponentPluginOverride struct { + BaseComponentPluginOverride `json:",inline"` + ImagePluginOverride `json:",inline"` +} + // CommandType describes the type of command. // Only one of the following command type may be specified. type CommandTypePluginOverride string @@ -194,7 +210,7 @@ type ExecCommandPluginOverride struct { // If set to `true` the command won't be restarted and it is expected to handle file changes on its own. // // Default value is `false` - HotReloadCapable bool `json:"hotReloadCapable,omitempty"` + HotReloadCapable *bool `json:"hotReloadCapable,omitempty"` } type ApplyCommandPluginOverride struct { @@ -214,7 +230,7 @@ type CompositeCommandPluginOverride struct { // Indicates if the sub-commands should be executed concurrently // +optional - Parallel bool `json:"parallel,omitempty"` + Parallel *bool `json:"parallel,omitempty"` } // DevWorkspace component: Anything that will bring additional features / tooling / behaviour / context @@ -284,7 +300,7 @@ type ContainerPluginOverride struct { // // Default value is `false` // +optional - DedicatedPod bool `json:"dedicatedPod,omitempty"` + DedicatedPod *bool `json:"dedicatedPod,omitempty"` } type EndpointPluginOverride struct { @@ -335,7 +351,7 @@ type EndpointPluginOverride struct { // Describes whether the endpoint should be secured and protected by some // authentication process. This requires a protocol of `https` or `wss`. // +optional - Secure bool `json:"secure,omitempty"` + Secure *bool `json:"secure,omitempty"` // Path of the endpoint URL // +optional @@ -349,6 +365,9 @@ type EndpointPluginOverride struct { // // - type: "terminal" / "ide" / "ide-dev", // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` } @@ -368,7 +387,15 @@ type VolumePluginOverride struct { // +optional // Ephemeral volumes are not stored persistently across restarts. Defaults // to false - Ephemeral bool `json:"ephemeral,omitempty"` + Ephemeral *bool `json:"ephemeral,omitempty"` +} + +type ImagePluginOverride struct { + + // +optional + // Name of the image for the resulting outerloop build + ImageName string `json:"imageName,omitempty"` + ImageUnionPluginOverride `json:",inline"` } type LabeledCommandPluginOverride struct { @@ -431,6 +458,21 @@ type K8sLikeComponentLocationPluginOverride struct { Inlined string `json:"inlined,omitempty"` } +// +union +type ImageUnionPluginOverride struct { + + // +kubebuilder:validation:Enum=Dockerfile + // Type of image + // + // +unionDiscriminator + // +optional + ImageType ImageTypePluginOverride `json:"imageType,omitempty"` + + // Allows specifying dockerfile type build + // +optional + Dockerfile *DockerfileImagePluginOverride `json:"dockerfile,omitempty"` +} + type BaseCommandPluginOverride struct { // +optional @@ -443,6 +485,17 @@ type BaseCommandPluginOverride struct { // Only one of the following component type may be specified. type K8sLikeComponentLocationTypePluginOverride string +// ImageType describes the type of image. +// Only one of the following image type may be specified. +type ImageTypePluginOverride string + +// Dockerfile Image type to specify the outerloop build using a Dockerfile +type DockerfileImagePluginOverride struct { + BaseImagePluginOverride `json:",inline"` + DockerfileSrcPluginOverride `json:",inline"` + DockerfilePluginOverride `json:",inline"` +} + type CommandGroupPluginOverride struct { // +optional @@ -451,11 +504,118 @@ type CommandGroupPluginOverride struct { // +optional // Identifies the default command for a given group kind - IsDefault bool `json:"isDefault,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` +} + +type BaseImagePluginOverride struct { +} + +// +union +type DockerfileSrcPluginOverride struct { + + // +kubebuilder:validation:Enum=Uri;DevfileRegistry;Git + // Type of Dockerfile src + // + + // +unionDiscriminator + // +optional + SrcType DockerfileSrcTypePluginOverride `json:"srcType,omitempty"` + + // URI Reference of a Dockerfile. + // It can be a full URL or a relative URI from the current devfile as the base URI. + // +optional + Uri string `json:"uri,omitempty"` + + // Dockerfile's Devfile Registry source + // +optional + DevfileRegistry *DockerfileDevfileRegistrySourcePluginOverride `json:"devfileRegistry,omitempty"` + + // Dockerfile's Git source + // +optional + Git *DockerfileGitProjectSourcePluginOverride `json:"git,omitempty"` +} + +type DockerfilePluginOverride struct { + + // Path of source directory to establish build context. Defaults to ${PROJECT_ROOT} in the container + // +optional + BuildContext string `json:"buildContext,omitempty"` + + // The arguments to supply to the dockerfile build. + // +optional + Args []string `json:"args,omitempty" patchStrategy:"replace"` + + // Specify if a privileged builder pod is required. + // + // Default value is `false` + // +optional + RootRequired *bool `json:"rootRequired,omitempty"` } // CommandGroupKind describes the kind of command group. -// +kubebuilder:validation:Enum=build;run;test;debug +// +kubebuilder:validation:Enum=build;run;test;debug;deploy type CommandGroupKindPluginOverride string +// DockerfileSrcType describes the type of +// the src for the Dockerfile outerloop build. +// Only one of the following location type may be specified. +type DockerfileSrcTypePluginOverride string + +type DockerfileDevfileRegistrySourcePluginOverride struct { + + // +optional + // Id in a devfile registry that contains a Dockerfile. The src in the OCI registry + // required for the Dockerfile build will be downloaded for building the image. + Id string `json:"id,omitempty"` + + // Devfile Registry URL to pull the Dockerfile from when using the Devfile Registry as Dockerfile src. + // To ensure the Dockerfile gets resolved consistently in different environments, + // it is recommended to always specify the `devfileRegistryUrl` when `Id` is used. + // +optional + RegistryUrl string `json:"registryUrl,omitempty"` +} + +type DockerfileGitProjectSourcePluginOverride struct { + + // Git src for the Dockerfile build. The src required for the Dockerfile build will need to be + // cloned for building the image. + GitProjectSourcePluginOverride `json:",inline"` + + // Location of the Dockerfile in the Git repository when using git as Dockerfile src. + // Defaults to Dockerfile. + // +optional + FileLocation string `json:"fileLocation,omitempty"` +} + +type GitProjectSourcePluginOverride struct { + GitLikeProjectSourcePluginOverride `json:",inline"` +} + +type GitLikeProjectSourcePluginOverride struct { + CommonProjectSourcePluginOverride `json:",inline"` + + // Defines from what the project should be checked out. Required if there are more than one remote configured + // +optional + CheckoutFrom *CheckoutFromPluginOverride `json:"checkoutFrom,omitempty"` + + // +optional + // The remotes map which should be initialized in the git project. + // Projects must have at least one remote configured while StarterProjects & Image Component's Git source can only have at most one remote configured. + Remotes map[string]string `json:"remotes,omitempty"` +} + +type CommonProjectSourcePluginOverride struct { +} + +type CheckoutFromPluginOverride struct { + + // The revision to checkout from. Should be branch name, tag or commit id. + // Default branch is used if missing or specified revision is not found. + // +optional + Revision string `json:"revision,omitempty"` + + // The remote name should be used as init. Required if there are more than one remote configured + // +optional + Remote string `json:"remote,omitempty"` +} + func (overrides PluginOverrides) isOverride() {} diff --git a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.union_definitions.go b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.union_definitions.go index 50116cb1bef..3efd841aebc 100644 --- a/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.union_definitions.go +++ b/vendor/github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2/zz_generated.union_definitions.go @@ -27,6 +27,48 @@ type CommandUnionVisitor struct { Custom func(*CustomCommand) error } +var imageUnion reflect.Type = reflect.TypeOf(ImageUnionVisitor{}) + +func (union ImageUnion) Visit(visitor ImageUnionVisitor) error { + return visitUnion(union, visitor) +} +func (union *ImageUnion) discriminator() *string { + return (*string)(&union.ImageType) +} +func (union *ImageUnion) Normalize() error { + return normalizeUnion(union, imageUnion) +} +func (union *ImageUnion) Simplify() { + simplifyUnion(union, imageUnion) +} + +// +k8s:deepcopy-gen=false +type ImageUnionVisitor struct { + Dockerfile func(*DockerfileImage) error +} + +var dockerfileSrc reflect.Type = reflect.TypeOf(DockerfileSrcVisitor{}) + +func (union DockerfileSrc) Visit(visitor DockerfileSrcVisitor) error { + return visitUnion(union, visitor) +} +func (union *DockerfileSrc) discriminator() *string { + return (*string)(&union.SrcType) +} +func (union *DockerfileSrc) Normalize() error { + return normalizeUnion(union, dockerfileSrc) +} +func (union *DockerfileSrc) Simplify() { + simplifyUnion(union, dockerfileSrc) +} + +// +k8s:deepcopy-gen=false +type DockerfileSrcVisitor struct { + Uri func(string) error + DevfileRegistry func(*DockerfileDevfileRegistrySource) error + Git func(*DockerfileGitProjectSource) error +} + var k8sLikeComponentLocation reflect.Type = reflect.TypeOf(K8sLikeComponentLocationVisitor{}) func (union K8sLikeComponentLocation) Visit(visitor K8sLikeComponentLocationVisitor) error { @@ -69,6 +111,7 @@ type ComponentUnionVisitor struct { Kubernetes func(*KubernetesComponent) error Openshift func(*OpenshiftComponent) error Volume func(*VolumeComponent) error + Image func(*ImageComponent) error Plugin func(*PluginComponent) error Custom func(*CustomComponent) error } @@ -138,6 +181,7 @@ type ComponentUnionParentOverrideVisitor struct { Kubernetes func(*KubernetesComponentParentOverride) error Openshift func(*OpenshiftComponentParentOverride) error Volume func(*VolumeComponentParentOverride) error + Image func(*ImageComponentParentOverride) error Plugin func(*PluginComponentParentOverride) error } @@ -205,6 +249,26 @@ type K8sLikeComponentLocationParentOverrideVisitor struct { Inlined func(string) error } +var imageUnionParentOverride reflect.Type = reflect.TypeOf(ImageUnionParentOverrideVisitor{}) + +func (union ImageUnionParentOverride) Visit(visitor ImageUnionParentOverrideVisitor) error { + return visitUnion(union, visitor) +} +func (union *ImageUnionParentOverride) discriminator() *string { + return (*string)(&union.ImageType) +} +func (union *ImageUnionParentOverride) Normalize() error { + return normalizeUnion(union, imageUnionParentOverride) +} +func (union *ImageUnionParentOverride) Simplify() { + simplifyUnion(union, imageUnionParentOverride) +} + +// +k8s:deepcopy-gen=false +type ImageUnionParentOverrideVisitor struct { + Dockerfile func(*DockerfileImageParentOverride) error +} + var importReferenceUnionParentOverride reflect.Type = reflect.TypeOf(ImportReferenceUnionParentOverrideVisitor{}) func (union ImportReferenceUnionParentOverride) Visit(visitor ImportReferenceUnionParentOverrideVisitor) error { @@ -248,6 +312,7 @@ type ComponentUnionPluginOverrideParentOverrideVisitor struct { Kubernetes func(*KubernetesComponentPluginOverrideParentOverride) error Openshift func(*OpenshiftComponentPluginOverrideParentOverride) error Volume func(*VolumeComponentPluginOverrideParentOverride) error + Image func(*ImageComponentPluginOverrideParentOverride) error } var commandUnionPluginOverrideParentOverride reflect.Type = reflect.TypeOf(CommandUnionPluginOverrideParentOverrideVisitor{}) @@ -272,6 +337,28 @@ type CommandUnionPluginOverrideParentOverrideVisitor struct { Composite func(*CompositeCommandPluginOverrideParentOverride) error } +var dockerfileSrcParentOverride reflect.Type = reflect.TypeOf(DockerfileSrcParentOverrideVisitor{}) + +func (union DockerfileSrcParentOverride) Visit(visitor DockerfileSrcParentOverrideVisitor) error { + return visitUnion(union, visitor) +} +func (union *DockerfileSrcParentOverride) discriminator() *string { + return (*string)(&union.SrcType) +} +func (union *DockerfileSrcParentOverride) Normalize() error { + return normalizeUnion(union, dockerfileSrcParentOverride) +} +func (union *DockerfileSrcParentOverride) Simplify() { + simplifyUnion(union, dockerfileSrcParentOverride) +} + +// +k8s:deepcopy-gen=false +type DockerfileSrcParentOverrideVisitor struct { + Uri func(string) error + DevfileRegistry func(*DockerfileDevfileRegistrySourceParentOverride) error + Git func(*DockerfileGitProjectSourceParentOverride) error +} + var k8sLikeComponentLocationPluginOverrideParentOverride reflect.Type = reflect.TypeOf(K8sLikeComponentLocationPluginOverrideParentOverrideVisitor{}) func (union K8sLikeComponentLocationPluginOverrideParentOverride) Visit(visitor K8sLikeComponentLocationPluginOverrideParentOverrideVisitor) error { @@ -293,6 +380,48 @@ type K8sLikeComponentLocationPluginOverrideParentOverrideVisitor struct { Inlined func(string) error } +var imageUnionPluginOverrideParentOverride reflect.Type = reflect.TypeOf(ImageUnionPluginOverrideParentOverrideVisitor{}) + +func (union ImageUnionPluginOverrideParentOverride) Visit(visitor ImageUnionPluginOverrideParentOverrideVisitor) error { + return visitUnion(union, visitor) +} +func (union *ImageUnionPluginOverrideParentOverride) discriminator() *string { + return (*string)(&union.ImageType) +} +func (union *ImageUnionPluginOverrideParentOverride) Normalize() error { + return normalizeUnion(union, imageUnionPluginOverrideParentOverride) +} +func (union *ImageUnionPluginOverrideParentOverride) Simplify() { + simplifyUnion(union, imageUnionPluginOverrideParentOverride) +} + +// +k8s:deepcopy-gen=false +type ImageUnionPluginOverrideParentOverrideVisitor struct { + Dockerfile func(*DockerfileImagePluginOverrideParentOverride) error +} + +var dockerfileSrcPluginOverrideParentOverride reflect.Type = reflect.TypeOf(DockerfileSrcPluginOverrideParentOverrideVisitor{}) + +func (union DockerfileSrcPluginOverrideParentOverride) Visit(visitor DockerfileSrcPluginOverrideParentOverrideVisitor) error { + return visitUnion(union, visitor) +} +func (union *DockerfileSrcPluginOverrideParentOverride) discriminator() *string { + return (*string)(&union.SrcType) +} +func (union *DockerfileSrcPluginOverrideParentOverride) Normalize() error { + return normalizeUnion(union, dockerfileSrcPluginOverrideParentOverride) +} +func (union *DockerfileSrcPluginOverrideParentOverride) Simplify() { + simplifyUnion(union, dockerfileSrcPluginOverrideParentOverride) +} + +// +k8s:deepcopy-gen=false +type DockerfileSrcPluginOverrideParentOverrideVisitor struct { + Uri func(string) error + DevfileRegistry func(*DockerfileDevfileRegistrySourcePluginOverrideParentOverride) error + Git func(*DockerfileGitProjectSourcePluginOverrideParentOverride) error +} + var componentUnionPluginOverride reflect.Type = reflect.TypeOf(ComponentUnionPluginOverrideVisitor{}) func (union ComponentUnionPluginOverride) Visit(visitor ComponentUnionPluginOverrideVisitor) error { @@ -314,6 +443,7 @@ type ComponentUnionPluginOverrideVisitor struct { Kubernetes func(*KubernetesComponentPluginOverride) error Openshift func(*OpenshiftComponentPluginOverride) error Volume func(*VolumeComponentPluginOverride) error + Image func(*ImageComponentPluginOverride) error } var commandUnionPluginOverride reflect.Type = reflect.TypeOf(CommandUnionPluginOverrideVisitor{}) @@ -358,3 +488,45 @@ type K8sLikeComponentLocationPluginOverrideVisitor struct { Uri func(string) error Inlined func(string) error } + +var imageUnionPluginOverride reflect.Type = reflect.TypeOf(ImageUnionPluginOverrideVisitor{}) + +func (union ImageUnionPluginOverride) Visit(visitor ImageUnionPluginOverrideVisitor) error { + return visitUnion(union, visitor) +} +func (union *ImageUnionPluginOverride) discriminator() *string { + return (*string)(&union.ImageType) +} +func (union *ImageUnionPluginOverride) Normalize() error { + return normalizeUnion(union, imageUnionPluginOverride) +} +func (union *ImageUnionPluginOverride) Simplify() { + simplifyUnion(union, imageUnionPluginOverride) +} + +// +k8s:deepcopy-gen=false +type ImageUnionPluginOverrideVisitor struct { + Dockerfile func(*DockerfileImagePluginOverride) error +} + +var dockerfileSrcPluginOverride reflect.Type = reflect.TypeOf(DockerfileSrcPluginOverrideVisitor{}) + +func (union DockerfileSrcPluginOverride) Visit(visitor DockerfileSrcPluginOverrideVisitor) error { + return visitUnion(union, visitor) +} +func (union *DockerfileSrcPluginOverride) discriminator() *string { + return (*string)(&union.SrcType) +} +func (union *DockerfileSrcPluginOverride) Normalize() error { + return normalizeUnion(union, dockerfileSrcPluginOverride) +} +func (union *DockerfileSrcPluginOverride) Simplify() { + simplifyUnion(union, dockerfileSrcPluginOverride) +} + +// +k8s:deepcopy-gen=false +type DockerfileSrcPluginOverrideVisitor struct { + Uri func(string) error + DevfileRegistry func(*DockerfileDevfileRegistrySourcePluginOverride) error + Git func(*DockerfileGitProjectSourcePluginOverride) error +} diff --git a/vendor/github.com/devfile/api/v2/pkg/attributes/attributes.go b/vendor/github.com/devfile/api/v2/pkg/attributes/attributes.go index 96186c47717..43c77c4e6ee 100644 --- a/vendor/github.com/devfile/api/v2/pkg/attributes/attributes.go +++ b/vendor/github.com/devfile/api/v2/pkg/attributes/attributes.go @@ -19,7 +19,7 @@ func (attributes Attributes) MarshalJSON() ([]byte, error) { return json.Marshal(map[string]apiext.JSON(attributes)) } -// UnmarshalJSON implements custom JSON unmarshaling +// UnmarshalJSON implements custom JSON unmarshalling // to support free-form attributes func (attributes *Attributes) UnmarshalJSON(data []byte) error { return json.Unmarshal(data, (*map[string]apiext.JSON)(attributes)) diff --git a/vendor/github.com/devfile/api/v2/pkg/devfile/header.go b/vendor/github.com/devfile/api/v2/pkg/devfile/header.go index f40380e3653..6606b068ae1 100644 --- a/vendor/github.com/devfile/api/v2/pkg/devfile/header.go +++ b/vendor/github.com/devfile/api/v2/pkg/devfile/header.go @@ -17,6 +17,17 @@ type DevfileHeader struct { Metadata DevfileMetadata `json:"metadata,omitempty"` } +// Architecture describes the architecture type +// +kubebuilder:validation:Enum=amd64;arm64;ppc64le;s390x +type Architecture string + +const ( + AMD64 Architecture = "amd64" + ARM64 Architecture = "arm64" + PPC64LE Architecture = "ppc64le" + S390X Architecture = "s390x" +) + type DevfileMetadata struct { // Optional devfile name // +optional @@ -29,6 +40,9 @@ type DevfileMetadata struct { // Map of implementation-dependant free-form YAML attributes. Deprecated, use the top-level attributes field instead. // +optional + // +kubebuilder:validation:Type=object + // +kubebuilder:pruning:PreserveUnknownFields + // +kubebuilder:validation:Schemaless Attributes attributes.Attributes `json:"attributes,omitempty"` // Optional devfile display name @@ -43,6 +57,11 @@ type DevfileMetadata struct { // +optional Tags []string `json:"tags,omitempty"` + // Optional list of processor architectures that the devfile supports, empty list suggests that the devfile can be used on any architecture + // +optional + // +kubebuilder:validation:UniqueItems=true + Architectures []Architecture `json:"architectures,omitempty"` + // Optional devfile icon, can be a URI or a relative path in the project // +optional Icon string `json:"icon,omitempty"` @@ -62,4 +81,12 @@ type DevfileMetadata struct { // Optional devfile website // +optional Website string `json:"website,omitempty"` + + // Optional devfile provider information + // +optional + Provider string `json:"provider,omitempty"` + + // Optional link to a page that provides support information + // +optional + SupportUrl string `json:"supportUrl,omitempty"` } diff --git a/vendor/github.com/devfile/api/v2/pkg/validation/commands.go b/vendor/github.com/devfile/api/v2/pkg/validation/commands.go index 64d024bb1eb..909489825d5 100644 --- a/vendor/github.com/devfile/api/v2/pkg/validation/commands.go +++ b/vendor/github.com/devfile/api/v2/pkg/validation/commands.go @@ -5,27 +5,28 @@ import ( "strings" "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" + "github.com/hashicorp/go-multierror" ) // ValidateCommands validates the devfile commands and checks: // 1. there are no duplicate command ids // 2. the command type is not invalid // 3. if a command is part of a command group, there is a single default command -func ValidateCommands(commands []v1alpha2.Command, components []v1alpha2.Component) (err error) { +func ValidateCommands(commands []v1alpha2.Command, components []v1alpha2.Component) (returnedErr error) { groupKindCommandMap := make(map[v1alpha2.CommandGroupKind][]v1alpha2.Command) commandMap := getCommandsMap(commands) - err = v1alpha2.CheckDuplicateKeys(commands) + err := v1alpha2.CheckDuplicateKeys(commands) if err != nil { - return err + returnedErr = multierror.Append(returnedErr, err) } for _, command := range commands { // parentCommands is a map to keep a track of all the parent commands when validating the composite command's subcommands recursively parentCommands := make(map[string]string) - err = validateCommand(command, parentCommands, commandMap, components) + err := validateCommand(command, parentCommands, commandMap, components) if err != nil { - return resolveErrorMessageWithImportAttributes(err, command.Attributes) + returnedErr = multierror.Append(returnedErr, resolveErrorMessageWithImportAttributes(err, command.Attributes)) } commandGroup := getGroup(command) @@ -34,19 +35,13 @@ func ValidateCommands(commands []v1alpha2.Command, components []v1alpha2.Compone } } - var groupErrorsList []string for groupKind, commands := range groupKindCommandMap { - if err = validateGroup(commands); err != nil { - groupErrorsList = append(groupErrorsList, fmt.Sprintf("command group %s error - %s", groupKind, err.Error())) + if err := validateGroup(commands, groupKind); err != nil { + returnedErr = multierror.Append(returnedErr, err) } } - if len(groupErrorsList) > 0 { - groupErrors := strings.Join(groupErrorsList, "\n") - err = fmt.Errorf("\n%s", groupErrors) - } - - return err + return returnedErr } // validateCommand validates a given devfile command where parentCommands is a map to track all the parent commands when validating @@ -67,12 +62,13 @@ func validateCommand(command v1alpha2.Command, parentCommands map[string]string, // validateGroup validates commands belonging to a specific group kind. If there are multiple commands belonging to the same group: // 1. without any default, err out // 2. with more than one default, err out -func validateGroup(commands []v1alpha2.Command) error { +func validateGroup(commands []v1alpha2.Command, groupKind v1alpha2.CommandGroupKind) error { defaultCommandCount := 0 var defaultCommands []v1alpha2.Command if len(commands) > 1 { for _, command := range commands { - if getGroup(command).IsDefault { + defaultVal := getGroup(command).IsDefault + if defaultVal != nil && *defaultVal { defaultCommandCount++ defaultCommands = append(defaultCommands, command) } @@ -82,7 +78,7 @@ func validateGroup(commands []v1alpha2.Command) error { } if defaultCommandCount == 0 { - return fmt.Errorf("there should be exactly one default command, currently there is no default command") + return &MissingDefaultCmdWarning{groupKind: groupKind} } else if defaultCommandCount > 1 { var commandsReferenceList []string for _, command := range defaultCommands { @@ -90,9 +86,12 @@ func validateGroup(commands []v1alpha2.Command) error { resolveErrorMessageWithImportAttributes(fmt.Errorf("command: %s", command.Id), command.Attributes).Error()) } commandsReference := strings.Join(commandsReferenceList, "; ") - // example: there should be exactly one default command, currently there is more than one default command; + // example: there should be exactly one default command, currently there are multiple commands; // command: ; command: , imported from uri: http://127.0.0.1:8080, in parent overrides from main devfile" - return fmt.Errorf("there should be exactly one default command, currently there is more than one default command; %s", commandsReference) + return &MultipleDefaultCmdError{ + groupKind: groupKind, + commandsReference: commandsReference, + } } return nil diff --git a/vendor/github.com/devfile/api/v2/pkg/validation/components.go b/vendor/github.com/devfile/api/v2/pkg/validation/components.go index 5833abc298c..10b3c89ad2f 100644 --- a/vendor/github.com/devfile/api/v2/pkg/validation/components.go +++ b/vendor/github.com/devfile/api/v2/pkg/validation/components.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" + "github.com/hashicorp/go-multierror" "k8s.io/apimachinery/pkg/api/resource" ) @@ -21,7 +22,8 @@ const ( // 2. makes sure the volume components are unique // 3. checks the URI specified in openshift components and kubernetes components are with valid format // 4. makes sure the component name is unique -func ValidateComponents(components []v1alpha2.Component) error { +// 5. makes sure the image dockerfile component git src has at most one remote +func ValidateComponents(components []v1alpha2.Component) (returnedErr error) { processedVolumes := make(map[string]bool) processedVolumeMounts := make(map[string][]string) @@ -31,7 +33,7 @@ func ValidateComponents(components []v1alpha2.Component) error { err := v1alpha2.CheckDuplicateKeys(components) if err != nil { - return err + returnedErr = multierror.Append(returnedErr, err) } for _, component := range components { @@ -47,15 +49,19 @@ func ValidateComponents(components []v1alpha2.Component) error { // Check if any containers are customizing the reserved PROJECT_SOURCE or PROJECTS_ROOT env for _, env := range component.Container.Env { if env.Name == EnvProjectsSrc { - return &ReservedEnvError{envName: EnvProjectsSrc, componentName: component.Name} + reservedEnvErr := &ReservedEnvError{envName: EnvProjectsSrc, componentName: component.Name} + returnedErr = multierror.Append(returnedErr, reservedEnvErr) } else if env.Name == EnvProjectsRoot { - return &ReservedEnvError{envName: EnvProjectsRoot, componentName: component.Name} + reservedEnvErr := &ReservedEnvError{envName: EnvProjectsRoot, componentName: component.Name} + returnedErr = multierror.Append(returnedErr, reservedEnvErr) } } err := validateEndpoints(component.Container.Endpoints, processedEndPointPort, processedEndPointName) - if err != nil { - return resolveErrorMessageWithImportAttributes(err, component.Attributes) + if len(err) > 0 { + for _, endpointErr := range err { + returnedErr = multierror.Append(returnedErr, resolveErrorMessageWithImportAttributes(endpointErr, component.Attributes)) + } } case component.Volume != nil: processedVolumes[component.Name] = true @@ -65,37 +71,49 @@ func ValidateComponents(components []v1alpha2.Component) error { // https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ if _, err := resource.ParseQuantity(component.Volume.Size); err != nil { invalidVolErr := &InvalidVolumeError{name: component.Name, reason: fmt.Sprintf("size %s for volume component is invalid, %v. Example - 2Gi, 1024Mi", component.Volume.Size, err)} - return resolveErrorMessageWithImportAttributes(invalidVolErr, component.Attributes) + returnedErr = multierror.Append(returnedErr, resolveErrorMessageWithImportAttributes(invalidVolErr, component.Attributes)) } } case component.Openshift != nil: if component.Openshift.Uri != "" { err := ValidateURI(component.Openshift.Uri) if err != nil { - return resolveErrorMessageWithImportAttributes(err, component.Attributes) + returnedErr = multierror.Append(returnedErr, resolveErrorMessageWithImportAttributes(err, component.Attributes)) } } err := validateEndpoints(component.Openshift.Endpoints, processedEndPointPort, processedEndPointName) - if err != nil { - return resolveErrorMessageWithImportAttributes(err, component.Attributes) + if len(err) > 0 { + for _, endpointErr := range err { + returnedErr = multierror.Append(returnedErr, resolveErrorMessageWithImportAttributes(endpointErr, component.Attributes)) + } } case component.Kubernetes != nil: if component.Kubernetes.Uri != "" { err := ValidateURI(component.Kubernetes.Uri) if err != nil { - return resolveErrorMessageWithImportAttributes(err, component.Attributes) + returnedErr = multierror.Append(returnedErr, resolveErrorMessageWithImportAttributes(err, component.Attributes)) } } err := validateEndpoints(component.Kubernetes.Endpoints, processedEndPointPort, processedEndPointName) - if err != nil { - return resolveErrorMessageWithImportAttributes(err, component.Attributes) + if len(err) > 0 { + for _, endpointErr := range err { + returnedErr = multierror.Append(returnedErr, resolveErrorMessageWithImportAttributes(endpointErr, component.Attributes)) + } + } + case component.Image != nil: + var gitSource v1alpha2.GitLikeProjectSource + if component.Image.Dockerfile != nil && component.Image.Dockerfile.Git != nil { + gitSource = component.Image.Dockerfile.Git.GitLikeProjectSource + if err := validateSingleRemoteGitSrc("component", component.Name, gitSource); err != nil { + returnedErr = multierror.Append(returnedErr, resolveErrorMessageWithImportAttributes(err, component.Attributes)) + } } case component.Plugin != nil: if component.Plugin.RegistryUrl != "" { err := ValidateURI(component.Plugin.RegistryUrl) if err != nil { - return resolveErrorMessageWithImportAttributes(err, component.Attributes) + returnedErr = multierror.Append(returnedErr, resolveErrorMessageWithImportAttributes(err, component.Attributes)) } } } @@ -116,8 +134,8 @@ func ValidateComponents(components []v1alpha2.Component) error { if len(invalidVolumeMountsErrList) > 0 { invalidVolumeMountsErr := fmt.Sprintf("\n%s", strings.Join(invalidVolumeMountsErrList, "\n")) - return &MissingVolumeMountError{errMsg: invalidVolumeMountsErr} + returnedErr = multierror.Append(returnedErr, &MissingVolumeMountError{errMsg: invalidVolumeMountsErr}) } - return nil + return returnedErr } diff --git a/vendor/github.com/devfile/api/v2/pkg/validation/endpoints.go b/vendor/github.com/devfile/api/v2/pkg/validation/endpoints.go index 4ca099e9ccf..9970c899d0d 100644 --- a/vendor/github.com/devfile/api/v2/pkg/validation/endpoints.go +++ b/vendor/github.com/devfile/api/v2/pkg/validation/endpoints.go @@ -7,12 +7,12 @@ import "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" // 2. endpoint port are unique across component containers // ie; two component containers cannot have the same target port but two endpoints // in a single component container can have the same target port -func validateEndpoints(endpoints []v1alpha2.Endpoint, processedEndPointPort map[int]bool, processedEndPointName map[string]bool) error { +func validateEndpoints(endpoints []v1alpha2.Endpoint, processedEndPointPort map[int]bool, processedEndPointName map[string]bool) (errList []error) { currentComponentEndPointPort := make(map[int]bool) for _, endPoint := range endpoints { if _, ok := processedEndPointName[endPoint.Name]; ok { - return &InvalidEndpointError{name: endPoint.Name} + errList = append(errList, &InvalidEndpointError{name: endPoint.Name}) } processedEndPointName[endPoint.Name] = true currentComponentEndPointPort[endPoint.TargetPort] = true @@ -20,9 +20,9 @@ func validateEndpoints(endpoints []v1alpha2.Endpoint, processedEndPointPort map[ for targetPort := range currentComponentEndPointPort { if _, ok := processedEndPointPort[targetPort]; ok { - return &InvalidEndpointError{port: targetPort} + errList = append(errList, &InvalidEndpointError{port: targetPort}) } processedEndPointPort[targetPort] = true } - return nil + return errList } diff --git a/vendor/github.com/devfile/api/v2/pkg/validation/errors.go b/vendor/github.com/devfile/api/v2/pkg/validation/errors.go index 667565e3fbb..efb42a8c845 100644 --- a/vendor/github.com/devfile/api/v2/pkg/validation/errors.go +++ b/vendor/github.com/devfile/api/v2/pkg/validation/errors.go @@ -2,6 +2,8 @@ package validation import ( "fmt" + + "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" attributesAPI "github.com/devfile/api/v2/pkg/attributes" ) @@ -34,6 +36,26 @@ func (e *InvalidCommandTypeError) Error() string { return fmt.Sprintf("command %s has invalid type", e.commandId) } +// MultipleDefaultCmdError returns an error if there are multiple default commands for a single group kind +type MultipleDefaultCmdError struct { + groupKind v1alpha2.CommandGroupKind + commandsReference string +} + +func (e *MultipleDefaultCmdError) Error() string { + return fmt.Sprintf("command group %s error - there should be exactly one default command, currently there are multiple default commands; %s", + e.groupKind, e.commandsReference) +} + +// MissingDefaultCmdWarning returns an error if there is no default command for a single group kind +type MissingDefaultCmdWarning struct { + groupKind v1alpha2.CommandGroupKind +} + +func (e *MissingDefaultCmdWarning) Error() string { + return fmt.Sprintf("command group %s warning - there should be exactly one default command, currently there is no default command", e.groupKind) +} + // ReservedEnvError returns an error if the user attempts to customize a reserved ENV in a container type ReservedEnvError struct { componentName string @@ -90,6 +112,55 @@ func (e *InvalidComponentError) Error() string { return fmt.Sprintf("the component %q is invalid - %s", e.componentName, e.reason) } +//MissingProjectRemoteError returns an error if the git remotes object under a project is empty +type MissingProjectRemoteError struct { + projectName string +} + +func (e *MissingProjectRemoteError) Error() string { + return fmt.Sprintf("project %s should have at least one remote", e.projectName) +} + +//MissingRemoteError returns an error if the git remotes object is empty +type MissingRemoteError struct { + objectType string + objectName string +} + +func (e *MissingRemoteError) Error() string { + return fmt.Sprintf("%s %s should have at least one remote", e.objectType, e.objectName) +} + +//MultipleRemoteError returns an error if multiple git remotes are specified. There can only be one remote. +type MultipleRemoteError struct { + objectType string + objectName string +} + +func (e *MultipleRemoteError) Error() string { + return fmt.Sprintf("%s %s should have one remote only", e.objectType, e.objectName) +} + +//MissingProjectCheckoutFromRemoteError returns an error if there are multiple git remotes but the checkoutFrom remote has not been specified +type MissingProjectCheckoutFromRemoteError struct { + projectName string +} + +func (e *MissingProjectCheckoutFromRemoteError) Error() string { + return fmt.Sprintf("project %s has more than one remote defined, but has no checkoutfrom remote defined", e.projectName) +} + +//InvalidProjectCheckoutRemoteError returns an error if there is an unmatched, checkoutFrom remote specified +type InvalidProjectCheckoutRemoteError struct { + objectType string + objectName string + checkoutRemote string +} + +func (e *InvalidProjectCheckoutRemoteError) Error() string { + return fmt.Sprintf("unable to find the checkout remote %s in the remotes for %s %s", e.checkoutRemote, e.objectType, e.objectName) +} + // resolveErrorMessageWithImportAttributes returns an updated error message // with detailed information on the imported and overriden resource. // example: diff --git a/vendor/github.com/devfile/api/v2/pkg/validation/events.go b/vendor/github.com/devfile/api/v2/pkg/validation/events.go index 20d4668b565..e31e474ba72 100644 --- a/vendor/github.com/devfile/api/v2/pkg/validation/events.go +++ b/vendor/github.com/devfile/api/v2/pkg/validation/events.go @@ -2,6 +2,7 @@ package validation import ( "fmt" + "github.com/hashicorp/go-multierror" "strings" "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" @@ -15,40 +16,33 @@ const ( ) // ValidateEvents validates all the devfile events -func ValidateEvents(events v1alpha2.Events, commands []v1alpha2.Command) error { +func ValidateEvents(events v1alpha2.Events, commands []v1alpha2.Command) (err error) { commandMap := getCommandsMap(commands) - var eventErrorsList []string switch { case len(events.PreStart) > 0: if preStartErr := isEventValid(events.PreStart, preStart, commandMap); preStartErr != nil { - eventErrorsList = append(eventErrorsList, preStartErr.Error()) + err = multierror.Append(err, preStartErr) } fallthrough case len(events.PostStart) > 0: if postStartErr := isEventValid(events.PostStart, postStart, commandMap); postStartErr != nil { - eventErrorsList = append(eventErrorsList, postStartErr.Error()) + err = multierror.Append(err, postStartErr) } fallthrough case len(events.PreStop) > 0: if preStopErr := isEventValid(events.PreStop, preStop, commandMap); preStopErr != nil { - eventErrorsList = append(eventErrorsList, preStopErr.Error()) + err = multierror.Append(err, preStopErr) } fallthrough case len(events.PostStop) > 0: if postStopErr := isEventValid(events.PostStop, postStop, commandMap); postStopErr != nil { - eventErrorsList = append(eventErrorsList, postStopErr.Error()) + err = multierror.Append(err, postStopErr) } } - // if there is any validation error, return it - if len(eventErrorsList) > 0 { - eventErrors := fmt.Sprintf("\n%s", strings.Join(eventErrorsList, "\n")) - return fmt.Errorf("devfile events validation error: %s", eventErrors) - } - - return nil + return err } // isEventValid checks if events belonging to a specific event type are valid ie; diff --git a/vendor/github.com/devfile/api/v2/pkg/validation/projects.go b/vendor/github.com/devfile/api/v2/pkg/validation/projects.go index 3fea1b8caff..4cbc875c0df 100644 --- a/vendor/github.com/devfile/api/v2/pkg/validation/projects.go +++ b/vendor/github.com/devfile/api/v2/pkg/validation/projects.go @@ -1,17 +1,14 @@ package validation import ( - "fmt" - "strings" - "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" + "github.com/hashicorp/go-multierror" ) // ValidateStarterProjects checks if starter project has only one remote configured -// and if the checkout remote matches the renote configured -func ValidateStarterProjects(starterProjects []v1alpha2.StarterProject) error { +// and if the checkout remote matches the remote configured +func ValidateStarterProjects(starterProjects []v1alpha2.StarterProject) (returnedErr error) { - var projectErrorsList []string for _, starterProject := range starterProjects { var gitSource v1alpha2.GitLikeProjectSource if starterProject.Git != nil { @@ -20,40 +17,19 @@ func ValidateStarterProjects(starterProjects []v1alpha2.StarterProject) error { continue } - switch len(gitSource.Remotes) { - case 0: - starterProjectErr := fmt.Errorf("starterProject %s should have at least one remote", starterProject.Name) - newErr := resolveErrorMessageWithImportAttributes(starterProjectErr, starterProject.Attributes) - projectErrorsList = append(projectErrorsList, newErr.Error()) - case 1: - if gitSource.CheckoutFrom != nil && gitSource.CheckoutFrom.Remote != "" { - err := validateRemoteMap(gitSource.Remotes, gitSource.CheckoutFrom.Remote, starterProject.Name) - if err != nil { - newErr := resolveErrorMessageWithImportAttributes(err, starterProject.Attributes) - projectErrorsList = append(projectErrorsList, newErr.Error()) - } - } - default: // len(gitSource.Remotes) >= 2 - starterProjectErr := fmt.Errorf("starterProject %s should have one remote only", starterProject.Name) + if starterProjectErr := validateSingleRemoteGitSrc("starterProject", starterProject.Name, gitSource); starterProjectErr != nil { newErr := resolveErrorMessageWithImportAttributes(starterProjectErr, starterProject.Attributes) - projectErrorsList = append(projectErrorsList, newErr.Error()) + returnedErr = multierror.Append(returnedErr, newErr) } } - var err error - if len(projectErrorsList) > 0 { - projectErrors := fmt.Sprintf("\n%s", strings.Join(projectErrorsList, "\n")) - err = fmt.Errorf("error validating starter projects:%s", projectErrors) - } - - return err + return returnedErr } // ValidateProjects checks if the project has more than one remote configured then a checkout // remote is mandatory and if the checkout remote matches the renote configured -func ValidateProjects(projects []v1alpha2.Project) error { +func ValidateProjects(projects []v1alpha2.Project) (returnedErr error) { - var projectErrorsList []string for _, project := range projects { var gitSource v1alpha2.GitLikeProjectSource if project.Git != nil { @@ -63,45 +39,56 @@ func ValidateProjects(projects []v1alpha2.Project) error { } switch len(gitSource.Remotes) { case 0: - projectErr := fmt.Errorf("projects %s should have at least one remote", project.Name) - newErr := resolveErrorMessageWithImportAttributes(projectErr, project.Attributes) - projectErrorsList = append(projectErrorsList, newErr.Error()) + + newErr := resolveErrorMessageWithImportAttributes(&MissingProjectRemoteError{projectName: project.Name}, project.Attributes) + returnedErr = multierror.Append(returnedErr, newErr) case 1: if gitSource.CheckoutFrom != nil && gitSource.CheckoutFrom.Remote != "" { - if err := validateRemoteMap(gitSource.Remotes, gitSource.CheckoutFrom.Remote, project.Name); err != nil { + if err := validateRemoteMap(gitSource.Remotes, gitSource.CheckoutFrom.Remote, "project", project.Name); err != nil { newErr := resolveErrorMessageWithImportAttributes(err, project.Attributes) - projectErrorsList = append(projectErrorsList, newErr.Error()) + returnedErr = multierror.Append(returnedErr, newErr) } } default: // len(gitSource.Remotes) >= 2 if gitSource.CheckoutFrom == nil || gitSource.CheckoutFrom.Remote == "" { - projectErr := fmt.Errorf("project %s has more than one remote defined, but has no checkoutfrom remote defined", project.Name) - newErr := resolveErrorMessageWithImportAttributes(projectErr, project.Attributes) - projectErrorsList = append(projectErrorsList, newErr.Error()) + + newErr := resolveErrorMessageWithImportAttributes(&MissingProjectCheckoutFromRemoteError{projectName: project.Name}, project.Attributes) + returnedErr = multierror.Append(returnedErr, newErr) continue } - if err := validateRemoteMap(gitSource.Remotes, gitSource.CheckoutFrom.Remote, project.Name); err != nil { + if err := validateRemoteMap(gitSource.Remotes, gitSource.CheckoutFrom.Remote, "project", project.Name); err != nil { newErr := resolveErrorMessageWithImportAttributes(err, project.Attributes) - projectErrorsList = append(projectErrorsList, newErr.Error()) + returnedErr = multierror.Append(returnedErr, newErr) } } } - var err error - if len(projectErrorsList) > 0 { - projectErrors := fmt.Sprintf("\n%s", strings.Join(projectErrorsList, "\n")) - err = fmt.Errorf("error validating projects:%s", projectErrors) - } - - return err + return returnedErr } // validateRemoteMap checks if the checkout remote is present in the project remote map -func validateRemoteMap(remotes map[string]string, checkoutRemote, projectName string) error { +func validateRemoteMap(remotes map[string]string, checkoutRemote, objectType, objectName string) error { if _, ok := remotes[checkoutRemote]; !ok { - return fmt.Errorf("unable to find the checkout remote %s in the remotes for project %s", checkoutRemote, projectName) + + return &InvalidProjectCheckoutRemoteError{objectName: objectName, objectType: objectType, checkoutRemote: checkoutRemote} } return nil } + +// validateSingleRemoteGitSrc validates a git src for a single remote only +func validateSingleRemoteGitSrc(objectType, objectName string, gitSource v1alpha2.GitLikeProjectSource) (err error) { + switch len(gitSource.Remotes) { + case 0: + err = &MissingRemoteError{objectType: objectType, objectName: objectName} + case 1: + if gitSource.CheckoutFrom != nil && gitSource.CheckoutFrom.Remote != "" { + err = validateRemoteMap(gitSource.Remotes, gitSource.CheckoutFrom.Remote, objectType, objectName) + } + default: // len(gitSource.Remotes) >= 2 + err = &MultipleRemoteError{objectType: objectType, objectName: objectName} + } + + return err +} diff --git a/vendor/github.com/devfile/api/v2/pkg/validation/validation-rule.md b/vendor/github.com/devfile/api/v2/pkg/validation/validation-rule.md index 454ffa4142d..ac9c0f99162 100644 --- a/vendor/github.com/devfile/api/v2/pkg/validation/validation-rule.md +++ b/vendor/github.com/devfile/api/v2/pkg/validation/validation-rule.md @@ -41,6 +41,9 @@ Common rules for all components types: #### Kubernetes & Openshift component - URI needs to be in valid URI format +#### Image component +- A Dockerfile Image component's git source cannot have more than one remote defined. If checkout remote is mentioned, validate it against the remote configured map + ### Events: 1. preStart and postStop events can only be Apply commands diff --git a/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables.go b/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables.go index 0de2f0d258b..0abba8f8169 100644 --- a/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables.go +++ b/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables.go @@ -7,7 +7,8 @@ import ( "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" ) -var globalVariableRegex = regexp.MustCompile(`\{\{(.*?)\}\}`) +// example of the regex: {{variable}} / {{ variable }} +var globalVariableRegex = regexp.MustCompile(`\{\{\s*(.*?)\s*\}\}`) // VariableWarning stores the invalid variable references for each devfile object type VariableWarning struct { diff --git a/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables_command.go b/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables_command.go index 8e9c0867992..eb51b230a14 100644 --- a/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables_command.go +++ b/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables_command.go @@ -41,31 +41,33 @@ func ValidateAndReplaceForCommands(variables map[string]string, commands []v1alp // validateAndReplaceForExecCommand validates the exec command data for global variable references and replaces them with the variable value func validateAndReplaceForExecCommand(variables map[string]string, exec *v1alpha2.ExecCommand) error { - var err error + if exec == nil { + return nil + } + + var err error invalidKeys := make(map[string]bool) - if exec != nil { - // Validate exec command line - if exec.CommandLine, err = validateAndReplaceDataWithVariable(exec.CommandLine, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate exec command line + if exec.CommandLine, err = validateAndReplaceDataWithVariable(exec.CommandLine, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } - // Validate exec working dir - if exec.WorkingDir, err = validateAndReplaceDataWithVariable(exec.WorkingDir, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate exec working dir + if exec.WorkingDir, err = validateAndReplaceDataWithVariable(exec.WorkingDir, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } - // Validate exec label - if exec.Label, err = validateAndReplaceDataWithVariable(exec.Label, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate exec label + if exec.Label, err = validateAndReplaceDataWithVariable(exec.Label, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } - // Validate exec env - if len(exec.Env) > 0 { - if err = validateAndReplaceForEnv(variables, exec.Env); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate exec env + if len(exec.Env) > 0 { + if err = validateAndReplaceForEnv(variables, exec.Env); err != nil { + checkForInvalidError(invalidKeys, err) } } @@ -74,15 +76,17 @@ func validateAndReplaceForExecCommand(variables map[string]string, exec *v1alpha // validateAndReplaceForCompositeCommand validates the composite command data for global variable references and replaces them with the variable value func validateAndReplaceForCompositeCommand(variables map[string]string, composite *v1alpha2.CompositeCommand) error { - var err error + if composite == nil { + return nil + } + + var err error invalidKeys := make(map[string]bool) - if composite != nil { - // Validate composite label - if composite.Label, err = validateAndReplaceDataWithVariable(composite.Label, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate composite label + if composite.Label, err = validateAndReplaceDataWithVariable(composite.Label, variables); err != nil { + checkForInvalidError(invalidKeys, err) } return newInvalidKeysError(invalidKeys) @@ -90,15 +94,17 @@ func validateAndReplaceForCompositeCommand(variables map[string]string, composit // validateAndReplaceForApplyCommand validates the apply command data for global variable references and replaces them with the variable value func validateAndReplaceForApplyCommand(variables map[string]string, apply *v1alpha2.ApplyCommand) error { - var err error + if apply == nil { + return nil + } + + var err error invalidKeys := make(map[string]bool) - if apply != nil { - // Validate apply label - if apply.Label, err = validateAndReplaceDataWithVariable(apply.Label, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate apply label + if apply.Label, err = validateAndReplaceDataWithVariable(apply.Label, variables); err != nil { + checkForInvalidError(invalidKeys, err) } return newInvalidKeysError(invalidKeys) diff --git a/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables_component.go b/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables_component.go index ce5a3f1bc78..a42aa2f171d 100644 --- a/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables_component.go +++ b/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables_component.go @@ -33,6 +33,12 @@ func ValidateAndReplaceForComponents(variables map[string]string, components []v componentsWarningMap[components[i].Name] = verr.Keys } } + case components[i].Image != nil: + if err = validateAndReplaceForImageComponent(variables, components[i].Image); err != nil { + if verr, ok := err.(*InvalidKeysError); ok { + componentsWarningMap[components[i].Name] = verr.Keys + } + } case components[i].Volume != nil: if err = validateAndReplaceForVolumeComponent(variables, components[i].Volume); err != nil { if verr, ok := err.(*InvalidKeysError); ok { @@ -47,64 +53,66 @@ func ValidateAndReplaceForComponents(variables map[string]string, components []v // validateAndReplaceForContainerComponent validates the container component data for global variable references and replaces them with the variable value func validateAndReplaceForContainerComponent(variables map[string]string, container *v1alpha2.ContainerComponent) error { - var err error + if container == nil { + return nil + } + + var err error invalidKeys := make(map[string]bool) - if container != nil { - // Validate container image - if container.Image, err = validateAndReplaceDataWithVariable(container.Image, variables); err != nil { + // Validate container image + if container.Image, err = validateAndReplaceDataWithVariable(container.Image, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } + + // Validate container commands + for i := range container.Command { + if container.Command[i], err = validateAndReplaceDataWithVariable(container.Command[i], variables); err != nil { checkForInvalidError(invalidKeys, err) } + } - // Validate container commands - for i := range container.Command { - if container.Command[i], err = validateAndReplaceDataWithVariable(container.Command[i], variables); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate container args + for i := range container.Args { + if container.Args[i], err = validateAndReplaceDataWithVariable(container.Args[i], variables); err != nil { + checkForInvalidError(invalidKeys, err) } + } - // Validate container args - for i := range container.Args { - if container.Args[i], err = validateAndReplaceDataWithVariable(container.Args[i], variables); err != nil { - checkForInvalidError(invalidKeys, err) - } - } + // Validate memory limit + if container.MemoryLimit, err = validateAndReplaceDataWithVariable(container.MemoryLimit, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } - // Validate memory limit - if container.MemoryLimit, err = validateAndReplaceDataWithVariable(container.MemoryLimit, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate memory request + if container.MemoryRequest, err = validateAndReplaceDataWithVariable(container.MemoryRequest, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } - // Validate memory request - if container.MemoryRequest, err = validateAndReplaceDataWithVariable(container.MemoryRequest, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate source mapping + if container.SourceMapping, err = validateAndReplaceDataWithVariable(container.SourceMapping, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } - // Validate source mapping - if container.SourceMapping, err = validateAndReplaceDataWithVariable(container.SourceMapping, variables); err != nil { + // Validate container env + if len(container.Env) > 0 { + if err = validateAndReplaceForEnv(variables, container.Env); err != nil { checkForInvalidError(invalidKeys, err) } + } - // Validate container env - if len(container.Env) > 0 { - if err = validateAndReplaceForEnv(variables, container.Env); err != nil { - checkForInvalidError(invalidKeys, err) - } - } - - // Validate container volume mounts - for i := range container.VolumeMounts { - if container.VolumeMounts[i].Path, err = validateAndReplaceDataWithVariable(container.VolumeMounts[i].Path, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate container volume mounts + for i := range container.VolumeMounts { + if container.VolumeMounts[i].Path, err = validateAndReplaceDataWithVariable(container.VolumeMounts[i].Path, variables); err != nil { + checkForInvalidError(invalidKeys, err) } + } - // Validate container endpoints - if len(container.Endpoints) > 0 { - if err = validateAndReplaceForEndpoint(variables, container.Endpoints); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate container endpoints + if len(container.Endpoints) > 0 { + if err = validateAndReplaceForEndpoint(variables, container.Endpoints); err != nil { + checkForInvalidError(invalidKeys, err) } } @@ -135,26 +143,28 @@ func validateAndReplaceForEnv(variables map[string]string, env []v1alpha2.EnvVar // validateAndReplaceForKubernetesComponent validates the kubernetes component data for global variable references and replaces them with the variable value func validateAndReplaceForKubernetesComponent(variables map[string]string, kubernetes *v1alpha2.KubernetesComponent) error { - var err error + if kubernetes == nil { + return nil + } + + var err error invalidKeys := make(map[string]bool) - if kubernetes != nil { - // Validate kubernetes uri - if kubernetes.Uri, err = validateAndReplaceDataWithVariable(kubernetes.Uri, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate kubernetes uri + if kubernetes.Uri, err = validateAndReplaceDataWithVariable(kubernetes.Uri, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } - // Validate kubernetes inlined - if kubernetes.Inlined, err = validateAndReplaceDataWithVariable(kubernetes.Inlined, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate kubernetes inlined + if kubernetes.Inlined, err = validateAndReplaceDataWithVariable(kubernetes.Inlined, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } - // Validate kubernetes endpoints - if len(kubernetes.Endpoints) > 0 { - if err = validateAndReplaceForEndpoint(variables, kubernetes.Endpoints); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate kubernetes endpoints + if len(kubernetes.Endpoints) > 0 { + if err = validateAndReplaceForEndpoint(variables, kubernetes.Endpoints); err != nil { + checkForInvalidError(invalidKeys, err) } } @@ -163,26 +173,101 @@ func validateAndReplaceForKubernetesComponent(variables map[string]string, kuber // validateAndReplaceForOpenShiftComponent validates the openshift component data for global variable references and replaces them with the variable value func validateAndReplaceForOpenShiftComponent(variables map[string]string, openshift *v1alpha2.OpenshiftComponent) error { + + if openshift == nil { + return nil + } + var err error + invalidKeys := make(map[string]bool) + + // Validate openshift uri + if openshift.Uri, err = validateAndReplaceDataWithVariable(openshift.Uri, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } + + // Validate openshift inlined + if openshift.Inlined, err = validateAndReplaceDataWithVariable(openshift.Inlined, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } + + // Validate openshift endpoints + if len(openshift.Endpoints) > 0 { + if err = validateAndReplaceForEndpoint(variables, openshift.Endpoints); err != nil { + checkForInvalidError(invalidKeys, err) + } + } + + return newInvalidKeysError(invalidKeys) +} + +// validateAndReplaceForImageComponent validates the image component data for global variable references and replaces them with the variable value +func validateAndReplaceForImageComponent(variables map[string]string, image *v1alpha2.ImageComponent) error { + + if image == nil { + return nil + } + + var err error + invalidKeys := make(map[string]bool) + + // Validate image's image name + if image.ImageName, err = validateAndReplaceDataWithVariable(image.ImageName, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } + + if err = validateAndReplaceForDockerfileImageComponent(variables, image.Dockerfile); err != nil { + checkForInvalidError(invalidKeys, err) + } + + return newInvalidKeysError(invalidKeys) +} + +// validateAndReplaceForDockerfileImageComponent validates the dockerfile image component data for global variable references and replaces them with the variable value +func validateAndReplaceForDockerfileImageComponent(variables map[string]string, dockerfileImage *v1alpha2.DockerfileImage) error { + if dockerfileImage == nil { + return nil + } + + var err error invalidKeys := make(map[string]bool) - if openshift != nil { - // Validate openshift uri - if openshift.Uri, err = validateAndReplaceDataWithVariable(openshift.Uri, variables); err != nil { + switch { + case dockerfileImage.Uri != "": + // Validate dockerfile image URI + if dockerfileImage.Uri, err = validateAndReplaceDataWithVariable(dockerfileImage.Uri, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } + case dockerfileImage.Git != nil: + // Validate dockerfile Git location + if dockerfileImage.Git.FileLocation, err = validateAndReplaceDataWithVariable(dockerfileImage.Git.FileLocation, variables); err != nil { checkForInvalidError(invalidKeys, err) } - // Validate openshift inlined - if openshift.Inlined, err = validateAndReplaceDataWithVariable(openshift.Inlined, variables); err != nil { + gitProject := &dockerfileImage.Git.GitLikeProjectSource + if err = validateAndReplaceForGitProjectSource(variables, gitProject); err != nil { + checkForInvalidError(invalidKeys, err) + } + case dockerfileImage.DevfileRegistry != nil: + // Validate dockerfile devfile registry src + if dockerfileImage.DevfileRegistry.Id, err = validateAndReplaceDataWithVariable(dockerfileImage.DevfileRegistry.Id, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } + if dockerfileImage.DevfileRegistry.RegistryUrl, err = validateAndReplaceDataWithVariable(dockerfileImage.DevfileRegistry.RegistryUrl, variables); err != nil { checkForInvalidError(invalidKeys, err) } + } - // Validate openshift endpoints - if len(openshift.Endpoints) > 0 { - if err = validateAndReplaceForEndpoint(variables, openshift.Endpoints); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate dockerfile image's build context + if dockerfileImage.BuildContext, err = validateAndReplaceDataWithVariable(dockerfileImage.BuildContext, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } + + // Validate dockerfile image's args + for i := range dockerfileImage.Args { + if dockerfileImage.Args[i], err = validateAndReplaceDataWithVariable(dockerfileImage.Args[i], variables); err != nil { + checkForInvalidError(invalidKeys, err) } } @@ -191,15 +276,17 @@ func validateAndReplaceForOpenShiftComponent(variables map[string]string, opensh // validateAndReplaceForVolumeComponent validates the volume component data for global variable references and replaces them with the variable value func validateAndReplaceForVolumeComponent(variables map[string]string, volume *v1alpha2.VolumeComponent) error { - var err error + if volume == nil { + return nil + } + + var err error invalidKeys := make(map[string]bool) - if volume != nil { - // Validate volume size - if volume.Size, err = validateAndReplaceDataWithVariable(volume.Size, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } + // Validate volume size + if volume.Size, err = validateAndReplaceDataWithVariable(volume.Size, variables); err != nil { + checkForInvalidError(invalidKeys, err) } return newInvalidKeysError(invalidKeys) diff --git a/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables_project.go b/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables_project.go index 09d1cdab146..15afe461696 100644 --- a/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables_project.go +++ b/vendor/github.com/devfile/api/v2/pkg/validation/variables/variables_project.go @@ -72,47 +72,65 @@ func ValidateAndReplaceForStarterProjects(variables map[string]string, starterPr // validateandReplaceForProjectSource validates a project source location for global variable references and replaces them with the variable value func validateandReplaceForProjectSource(variables map[string]string, projectSource *v1alpha2.ProjectSource) error { + if projectSource == nil { + return nil + } + var err error + invalidKeys := make(map[string]bool) + + switch { + case projectSource.Zip != nil: + if projectSource.Zip.Location, err = validateAndReplaceDataWithVariable(projectSource.Zip.Location, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } + case projectSource.Git != nil: + gitProject := &projectSource.Git.GitLikeProjectSource + + if err = validateAndReplaceForGitProjectSource(variables, gitProject); err != nil { + checkForInvalidError(invalidKeys, err) + } + } + + return newInvalidKeysError(invalidKeys) +} + +// validateAndReplaceForGitProjectSource validates a project git src for global variable references and replaces them with the variable value +func validateAndReplaceForGitProjectSource(variables map[string]string, gitProject *v1alpha2.GitLikeProjectSource) error { + if gitProject == nil { + return nil + } + + var err error invalidKeys := make(map[string]bool) - if projectSource != nil { - switch { - case projectSource.Zip != nil: - if projectSource.Zip.Location, err = validateAndReplaceDataWithVariable(projectSource.Zip.Location, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } - case projectSource.Git != nil: - gitProject := &projectSource.Git.GitLikeProjectSource - - if gitProject.CheckoutFrom != nil { - // validate git checkout revision - if gitProject.CheckoutFrom.Revision, err = validateAndReplaceDataWithVariable(gitProject.CheckoutFrom.Revision, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } - - // // validate git checkout remote - if gitProject.CheckoutFrom.Remote, err = validateAndReplaceDataWithVariable(gitProject.CheckoutFrom.Remote, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } - } - - // validate git remotes - for k := range gitProject.Remotes { - // validate remote map value - if gitProject.Remotes[k], err = validateAndReplaceDataWithVariable(gitProject.Remotes[k], variables); err != nil { - checkForInvalidError(invalidKeys, err) - } - - // validate remote map key - var updatedKey string - if updatedKey, err = validateAndReplaceDataWithVariable(k, variables); err != nil { - checkForInvalidError(invalidKeys, err) - } else if updatedKey != k { - gitProject.Remotes[updatedKey] = gitProject.Remotes[k] - delete(gitProject.Remotes, k) - } - } + if gitProject.CheckoutFrom != nil { + // validate git checkout revision + if gitProject.CheckoutFrom.Revision, err = validateAndReplaceDataWithVariable(gitProject.CheckoutFrom.Revision, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } + + // // validate git checkout remote + if gitProject.CheckoutFrom.Remote, err = validateAndReplaceDataWithVariable(gitProject.CheckoutFrom.Remote, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } + } + + // validate git remotes + for k := range gitProject.Remotes { + // validate remote map value + if gitProject.Remotes[k], err = validateAndReplaceDataWithVariable(gitProject.Remotes[k], variables); err != nil { + checkForInvalidError(invalidKeys, err) + } + + // validate remote map key + var updatedKey string + if updatedKey, err = validateAndReplaceDataWithVariable(k, variables); err != nil { + checkForInvalidError(invalidKeys, err) + } else if updatedKey != k { + gitProject.Remotes[updatedKey] = gitProject.Remotes[k] + delete(gitProject.Remotes, k) } } diff --git a/vendor/github.com/devfile/library/pkg/devfile/parser/context/apiVersion.go b/vendor/github.com/devfile/library/pkg/devfile/parser/context/apiVersion.go index a6928a6e270..e07d706dc9f 100644 --- a/vendor/github.com/devfile/library/pkg/devfile/parser/context/apiVersion.go +++ b/vendor/github.com/devfile/library/pkg/devfile/parser/context/apiVersion.go @@ -3,6 +3,7 @@ package parser import ( "encoding/json" "fmt" + "strings" "github.com/devfile/library/pkg/devfile/parser/data" "github.com/pkg/errors" @@ -38,7 +39,9 @@ func (d *DevfileCtx) SetDevfileAPIVersion() error { } // Successful - d.apiVersion = schemaVersion.(string) + // split by `-` and get the first substring as schema version, schemaVersion without `-` won't get affected + // e.g. 2.2.0-latest => 2.2.0, 2.2.0 => 2.2.0 + d.apiVersion = strings.Split(schemaVersion.(string), "-")[0] klog.V(4).Infof("devfile schemaVersion: '%s'", d.apiVersion) return nil } diff --git a/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/2.2.0/devfileJsonSchema220.go b/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/2.2.0/devfileJsonSchema220.go index 0357afe3ad6..15c05b6356d 100644 --- a/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/2.2.0/devfileJsonSchema220.go +++ b/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/2.2.0/devfileJsonSchema220.go @@ -69,7 +69,8 @@ const JsonSchema220 = `{ "build", "run", "test", - "debug" + "debug", + "deploy" ] } }, @@ -116,7 +117,8 @@ const JsonSchema220 = `{ "build", "run", "test", - "debug" + "debug", + "deploy" ] } }, @@ -187,7 +189,8 @@ const JsonSchema220 = `{ "build", "run", "test", - "debug" + "debug", + "deploy" ] } }, @@ -246,6 +249,11 @@ const JsonSchema220 = `{ "required": [ "volume" ] + }, + { + "required": [ + "image" + ] } ], "properties": { @@ -407,6 +415,124 @@ const JsonSchema220 = `{ }, "additionalProperties": false }, + "image": { + "description": "Allows specifying the definition of an image for outer loop builds", + "type": "object", + "required": [ + "imageName" + ], + "oneOf": [ + { + "required": [ + "dockerfile" + ] + } + ], + "properties": { + "dockerfile": { + "description": "Allows specifying dockerfile type build", + "type": "object", + "oneOf": [ + { + "required": [ + "uri" + ] + }, + { + "required": [ + "devfileRegistry" + ] + }, + { + "required": [ + "git" + ] + } + ], + "properties": { + "args": { + "description": "The arguments to supply to the dockerfile build.", + "type": "array", + "items": { + "type": "string" + } + }, + "buildContext": { + "description": "Path of source directory to establish build context. Defaults to ${PROJECT_ROOT} in the container", + "type": "string" + }, + "devfileRegistry": { + "description": "Dockerfile's Devfile Registry source", + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "description": "Id in a devfile registry that contains a Dockerfile. The src in the OCI registry required for the Dockerfile build will be downloaded for building the image.", + "type": "string" + }, + "registryUrl": { + "description": "Devfile Registry URL to pull the Dockerfile from when using the Devfile Registry as Dockerfile src. To ensure the Dockerfile gets resolved consistently in different environments, it is recommended to always specify the 'devfileRegistryUrl' when 'Id' is used.", + "type": "string" + } + }, + "additionalProperties": false + }, + "git": { + "description": "Dockerfile's Git source", + "type": "object", + "required": [ + "remotes" + ], + "properties": { + "checkoutFrom": { + "description": "Defines from what the project should be checked out. Required if there are more than one remote configured", + "type": "object", + "properties": { + "remote": { + "description": "The remote name should be used as init. Required if there are more than one remote configured", + "type": "string" + }, + "revision": { + "description": "The revision to checkout from. Should be branch name, tag or commit id. Default branch is used if missing or specified revision is not found.", + "type": "string" + } + }, + "additionalProperties": false + }, + "fileLocation": { + "description": "Location of the Dockerfile in the Git repository when using git as Dockerfile src. Defaults to Dockerfile.", + "type": "string" + }, + "remotes": { + "description": "The remotes map which should be initialized in the git project. Projects must have at least one remote configured while StarterProjects \u0026 Image Component's Git source can only have at most one remote configured.", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "rootRequired": { + "description": "Specify if a privileged builder pod is required.\n\nDefault value is 'false'", + "type": "boolean" + }, + "uri": { + "description": "URI Reference of a Dockerfile. It can be a full URL or a relative URI from the current devfile as the base URI.", + "type": "string" + } + }, + "additionalProperties": false + }, + "imageName": { + "description": "Name of the image for the resulting outerloop build", + "type": "string" + } + }, + "additionalProperties": false + }, "kubernetes": { "description": "Allows importing into the devworkspace the Kubernetes resources defined in a given manifest. For example this allows reusing the Kubernetes definitions used to deploy some runtime components in production.", "type": "object", @@ -789,7 +915,8 @@ const JsonSchema220 = `{ "build", "run", "test", - "debug" + "debug", + "deploy" ] } }, @@ -833,7 +960,8 @@ const JsonSchema220 = `{ "build", "run", "test", - "debug" + "debug", + "deploy" ] } }, @@ -896,7 +1024,8 @@ const JsonSchema220 = `{ "build", "run", "test", - "debug" + "debug", + "deploy" ] } }, @@ -955,6 +1084,11 @@ const JsonSchema220 = `{ "required": [ "volume" ] + }, + { + "required": [ + "image" + ] } ], "properties": { @@ -1108,6 +1242,115 @@ const JsonSchema220 = `{ }, "additionalProperties": false }, + "image": { + "description": "Allows specifying the definition of an image for outer loop builds", + "type": "object", + "oneOf": [ + { + "required": [ + "dockerfile" + ] + } + ], + "properties": { + "dockerfile": { + "description": "Allows specifying dockerfile type build", + "type": "object", + "oneOf": [ + { + "required": [ + "uri" + ] + }, + { + "required": [ + "devfileRegistry" + ] + }, + { + "required": [ + "git" + ] + } + ], + "properties": { + "args": { + "description": "The arguments to supply to the dockerfile build.", + "type": "array", + "items": { + "type": "string" + } + }, + "buildContext": { + "description": "Path of source directory to establish build context. Defaults to ${PROJECT_ROOT} in the container", + "type": "string" + }, + "devfileRegistry": { + "description": "Dockerfile's Devfile Registry source", + "type": "object", + "properties": { + "id": { + "description": "Id in a devfile registry that contains a Dockerfile. The src in the OCI registry required for the Dockerfile build will be downloaded for building the image.", + "type": "string" + }, + "registryUrl": { + "description": "Devfile Registry URL to pull the Dockerfile from when using the Devfile Registry as Dockerfile src. To ensure the Dockerfile gets resolved consistently in different environments, it is recommended to always specify the 'devfileRegistryUrl' when 'Id' is used.", + "type": "string" + } + }, + "additionalProperties": false + }, + "git": { + "description": "Dockerfile's Git source", + "type": "object", + "properties": { + "checkoutFrom": { + "description": "Defines from what the project should be checked out. Required if there are more than one remote configured", + "type": "object", + "properties": { + "remote": { + "description": "The remote name should be used as init. Required if there are more than one remote configured", + "type": "string" + }, + "revision": { + "description": "The revision to checkout from. Should be branch name, tag or commit id. Default branch is used if missing or specified revision is not found.", + "type": "string" + } + }, + "additionalProperties": false + }, + "fileLocation": { + "description": "Location of the Dockerfile in the Git repository when using git as Dockerfile src. Defaults to Dockerfile.", + "type": "string" + }, + "remotes": { + "description": "The remotes map which should be initialized in the git project. Projects must have at least one remote configured while StarterProjects \u0026 Image Component's Git source can only have at most one remote configured.", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "rootRequired": { + "description": "Specify if a privileged builder pod is required.\n\nDefault value is 'false'", + "type": "boolean" + }, + "uri": { + "description": "URI Reference of a Dockerfile. It can be a full URL or a relative URI from the current devfile as the base URI.", + "type": "string" + } + }, + "additionalProperties": false + }, + "imageName": { + "description": "Name of the image for the resulting outerloop build", + "type": "string" + } + }, + "additionalProperties": false + }, "kubernetes": { "description": "Allows importing into the devworkspace the Kubernetes resources defined in a given manifest. For example this allows reusing the Kubernetes definitions used to deploy some runtime components in production.", "type": "object", @@ -1365,7 +1608,7 @@ const JsonSchema220 = `{ "additionalProperties": false }, "remotes": { - "description": "The remotes map which should be initialized in the git project. Projects must have at least one remote configured while StarterProjects can only have at most one remote configured.", + "description": "The remotes map which should be initialized in the git project. Projects must have at least one remote configured while StarterProjects \u0026 Image Component's Git source can only have at most one remote configured.", "type": "object", "additionalProperties": { "type": "string" @@ -1449,7 +1692,7 @@ const JsonSchema220 = `{ "additionalProperties": false }, "remotes": { - "description": "The remotes map which should be initialized in the git project. Projects must have at least one remote configured while StarterProjects can only have at most one remote configured.", + "description": "The remotes map which should be initialized in the git project. Projects must have at least one remote configured while StarterProjects \u0026 Image Component's Git source can only have at most one remote configured.", "type": "object", "additionalProperties": { "type": "string" @@ -1550,7 +1793,7 @@ const JsonSchema220 = `{ "additionalProperties": false }, "remotes": { - "description": "The remotes map which should be initialized in the git project. Projects must have at least one remote configured while StarterProjects can only have at most one remote configured.", + "description": "The remotes map which should be initialized in the git project. Projects must have at least one remote configured while StarterProjects \u0026 Image Component's Git source can only have at most one remote configured.", "type": "object", "additionalProperties": { "type": "string" @@ -1638,7 +1881,7 @@ const JsonSchema220 = `{ "additionalProperties": false }, "remotes": { - "description": "The remotes map which should be initialized in the git project. Projects must have at least one remote configured while StarterProjects can only have at most one remote configured.", + "description": "The remotes map which should be initialized in the git project. Projects must have at least one remote configured while StarterProjects \u0026 Image Component's Git source can only have at most one remote configured.", "type": "object", "additionalProperties": { "type": "string" diff --git a/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/commands.go b/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/commands.go index 0bb29a8ab95..42a1b6a12a1 100644 --- a/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/commands.go +++ b/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/commands.go @@ -55,13 +55,17 @@ func (d *DevfileV2) GetCommands(options common.DevfileOptions) ([]v1.Command, er func (d *DevfileV2) AddCommands(commands []v1.Command) error { var errorsList []string for _, command := range commands { + var err error for _, devfileCommand := range d.Commands { if command.Id == devfileCommand.Id { - errorsList = append(errorsList, (&common.FieldAlreadyExistError{Name: command.Id, Field: "command"}).Error()) - continue + err = &common.FieldAlreadyExistError{Name: command.Id, Field: "command"} + errorsList = append(errorsList, err.Error()) + break } } - d.Commands = append(d.Commands, command) + if err == nil { + d.Commands = append(d.Commands, command) + } } if len(errorsList) > 0 { return fmt.Errorf("errors while adding commands:\n%s", strings.Join(errorsList, "\n")) diff --git a/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/common/component_helper.go b/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/common/component_helper.go index dede54285d4..1a5ba3323ca 100644 --- a/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/common/component_helper.go +++ b/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/common/component_helper.go @@ -29,6 +29,8 @@ func GetComponentType(component v1.Component) (v1.ComponentType, error) { return v1.KubernetesComponentType, nil case component.Openshift != nil: return v1.OpenshiftComponentType, nil + case component.Image != nil: + return v1.ImageComponentType, nil case component.Custom != nil: return v1.CustomComponentType, nil diff --git a/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/components.go b/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/components.go index acd62ec1fda..13a905b6584 100644 --- a/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/components.go +++ b/vendor/github.com/devfile/library/pkg/devfile/parser/data/v2/components.go @@ -79,13 +79,17 @@ func (d *DevfileV2) GetDevfileVolumeComponents(options common.DevfileOptions) ([ func (d *DevfileV2) AddComponents(components []v1.Component) error { var errorsList []string for _, component := range components { + var err error for _, devfileComponent := range d.Components { if component.Name == devfileComponent.Name { - errorsList = append(errorsList, (&common.FieldAlreadyExistError{Name: component.Name, Field: "component"}).Error()) - continue + err = &common.FieldAlreadyExistError{Name: component.Name, Field: "component"} + errorsList = append(errorsList, err.Error()) + break } } - d.Components = append(d.Components, component) + if err == nil { + d.Components = append(d.Components, component) + } } if len(errorsList) > 0 { return fmt.Errorf("errors while adding components:\n%s", strings.Join(errorsList, "\n")) diff --git a/vendor/github.com/devfile/library/pkg/devfile/parser/data/versions.go b/vendor/github.com/devfile/library/pkg/devfile/parser/data/versions.go index bec46aff9f1..e85a026e27e 100644 --- a/vendor/github.com/devfile/library/pkg/devfile/parser/data/versions.go +++ b/vendor/github.com/devfile/library/pkg/devfile/parser/data/versions.go @@ -44,5 +44,5 @@ func init() { devfileApiVersionToJSONSchema[APISchemaVersion210] = v210.JsonSchema210 devfileApiVersionToJSONSchema[APISchemaVersion220] = v220.JsonSchema220 // should use hightest v2 schema version since it is expected to be backward compatible with the same api version - devfileApiVersionToJSONSchema[APIVersionAlpha2] = v210.JsonSchema210 + devfileApiVersionToJSONSchema[APIVersionAlpha2] = v220.JsonSchema220 } diff --git a/vendor/github.com/devfile/library/pkg/devfile/parser/devfileobj.go b/vendor/github.com/devfile/library/pkg/devfile/parser/devfileobj.go index f7ee33e9ee2..65c669c8c1e 100644 --- a/vendor/github.com/devfile/library/pkg/devfile/parser/devfileobj.go +++ b/vendor/github.com/devfile/library/pkg/devfile/parser/devfileobj.go @@ -7,7 +7,6 @@ import ( // Default filenames for create devfile const ( - OutputDevfileJsonPath = "devfile.json" OutputDevfileYamlPath = "devfile.yaml" ) diff --git a/vendor/modules.txt b/vendor/modules.txt index 9a000052380..8c9fe343043 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -93,7 +93,7 @@ github.com/deislabs/oras/pkg/artifact github.com/deislabs/oras/pkg/content github.com/deislabs/oras/pkg/context github.com/deislabs/oras/pkg/oras -# github.com/devfile/api/v2 v2.1.0 +# github.com/devfile/api/v2 v2.0.0-20210917193329-089a48011460 ## explicit github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2 github.com/devfile/api/v2/pkg/attributes @@ -102,7 +102,7 @@ github.com/devfile/api/v2/pkg/utils/overriding github.com/devfile/api/v2/pkg/utils/unions github.com/devfile/api/v2/pkg/validation github.com/devfile/api/v2/pkg/validation/variables -# github.com/devfile/library v1.1.1-0.20210910214722-7c5ff63711ec +# github.com/devfile/library v1.2.0 ## explicit github.com/devfile/library/pkg/devfile github.com/devfile/library/pkg/devfile/generator From 8b87d8553c10020a97e8a221819b75de7518a4a5 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Fri, 8 Oct 2021 11:27:04 +0200 Subject: [PATCH 3/4] updates to make it work with devfile/library v1.2.0 --- pkg/devfile/adapters/common/command.go | 5 +- pkg/devfile/adapters/common/command_test.go | 54 +++++++++---------- pkg/devfile/adapters/common/generic.go | 3 +- pkg/devfile/adapters/common/generic_test.go | 49 ++++++++--------- pkg/devfile/adapters/common/utils_test.go | 15 +++--- .../adapters/kubernetes/utils/utils_test.go | 7 +-- pkg/devfile/convert/convert.go | 11 ++-- pkg/devfile/validate/commands_test.go | 5 +- pkg/envinfo/envinfo_test.go | 31 +++++------ pkg/envinfo/url.go | 8 +-- pkg/envinfo/url_test.go | 9 +++- pkg/testingutil/devfile.go | 5 +- pkg/url/status_test.go | 3 +- pkg/util/util.go | 13 +++++ pkg/util/util_test.go | 32 +++++++++++ .../devfile/cmd_devfile_test_test.go | 2 +- 16 files changed, 156 insertions(+), 96 deletions(-) diff --git a/pkg/devfile/adapters/common/command.go b/pkg/devfile/adapters/common/command.go index d9182d54a4b..9f58b7ff084 100644 --- a/pkg/devfile/adapters/common/command.go +++ b/pkg/devfile/adapters/common/command.go @@ -8,6 +8,7 @@ import ( devfilev1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" "github.com/devfile/library/pkg/devfile/parser/data" parsercommon "github.com/devfile/library/pkg/devfile/parser/data/v2/common" + "github.com/openshift/odo/pkg/util" "github.com/pkg/errors" "k8s.io/klog" ) @@ -34,7 +35,7 @@ func New(devfile devfilev1.Command, knowCommands map[string]devfilev1.Command, e return nil, fmt.Errorf("composite command %q has command %v not found in devfile", cmd, devfile) } } - if composite.Parallel { + if util.SafeGetBool(composite.Parallel) { return newParallelCompositeCommand(components...), nil } return newCompositeCommand(components...), nil @@ -69,7 +70,7 @@ func getCommandFromDevfile(data data.DevfileData, groupType devfilev1.CommandGro for _, command := range commands { cmdGroup := parsercommon.GetGroup(command) if cmdGroup != nil && cmdGroup.Kind == groupType { - if cmdGroup.IsDefault { + if util.SafeGetBool(cmdGroup.IsDefault) { return command, nil } else if reflect.DeepEqual(onlyCommand, devfilev1.Command{}) { // return the only remaining command for the group if there is no default command diff --git a/pkg/devfile/adapters/common/command_test.go b/pkg/devfile/adapters/common/command_test.go index 39c0594b2b4..af802303528 100644 --- a/pkg/devfile/adapters/common/command_test.go +++ b/pkg/devfile/adapters/common/command_test.go @@ -102,7 +102,7 @@ func TestGetCommand(t *testing.T) { Exec: &devfilev1.ExecCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: runGroup, IsDefault: true}, + Group: &devfilev1.CommandGroup{Kind: runGroup, IsDefault: util.GetBoolPtr(true)}, }, }, CommandLine: commands[0], @@ -138,7 +138,7 @@ func TestGetCommand(t *testing.T) { Exec: &devfilev1.ExecCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: false}, + Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: util.GetBoolPtr(false)}, }, }, CommandLine: commands[0], @@ -168,7 +168,7 @@ func TestGetCommand(t *testing.T) { Composite: &devfilev1.CompositeCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: true}, + Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: util.GetBoolPtr(true)}, }, }, Commands: []string{"build", "run"}, @@ -284,7 +284,7 @@ func TestGetCommandFromDevfile(t *testing.T) { Exec: &devfilev1.ExecCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: runGroup, IsDefault: true}, + Group: &devfilev1.CommandGroup{Kind: runGroup, IsDefault: util.GetBoolPtr(true)}, }, }, CommandLine: commands[0], @@ -364,7 +364,7 @@ func TestGetCommandFromDevfile(t *testing.T) { Composite: &devfilev1.CompositeCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: true}, + Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: util.GetBoolPtr(true)}, }, }, Commands: []string{"build1", "run"}, @@ -385,7 +385,7 @@ func TestGetCommandFromDevfile(t *testing.T) { Exec: &devfilev1.ExecCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: false}, + Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: util.GetBoolPtr(false)}, }, }, CommandLine: commands[0], @@ -415,7 +415,7 @@ func TestGetCommandFromDevfile(t *testing.T) { Composite: &devfilev1.CompositeCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: true}, + Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: util.GetBoolPtr(true)}, }, }, Commands: []string{"build", "run"}, @@ -428,7 +428,7 @@ func TestGetCommandFromDevfile(t *testing.T) { Composite: &devfilev1.CompositeCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: false}, + Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: util.GetBoolPtr(false)}, }, }, Commands: []string{"build", "run"}, @@ -606,7 +606,7 @@ func TestGetCommandFromFlag(t *testing.T) { Exec: &devfilev1.ExecCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: runGroup, IsDefault: true}, + Group: &devfilev1.CommandGroup{Kind: runGroup, IsDefault: util.GetBoolPtr(true)}, }, }, CommandLine: commands[0], @@ -620,7 +620,7 @@ func TestGetCommandFromFlag(t *testing.T) { Exec: &devfilev1.ExecCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: runGroup, IsDefault: true}, + Group: &devfilev1.CommandGroup{Kind: runGroup, IsDefault: util.GetBoolPtr(true)}, }, }, CommandLine: commands[0], @@ -698,7 +698,7 @@ func TestGetCommandFromFlag(t *testing.T) { Exec: &devfilev1.ExecCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: false}, + Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: util.GetBoolPtr(false)}, }, }, CommandLine: commands[0], @@ -728,7 +728,7 @@ func TestGetCommandFromFlag(t *testing.T) { Composite: &devfilev1.CompositeCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: true}, + Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: util.GetBoolPtr(true)}, }, }, Commands: []string{"build", "run"}, @@ -741,7 +741,7 @@ func TestGetCommandFromFlag(t *testing.T) { Composite: &devfilev1.CompositeCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: false}, + Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: util.GetBoolPtr(false)}, }, }, Commands: []string{"build", "run"}, @@ -824,7 +824,7 @@ func TestGetBuildCommand(t *testing.T) { Exec: &devfilev1.ExecCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: true}, + Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: util.GetBoolPtr(true)}, }, }, CommandLine: command, @@ -839,7 +839,7 @@ func TestGetBuildCommand(t *testing.T) { Exec: &devfilev1.ExecCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: true}, + Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: util.GetBoolPtr(true)}, }, }, CommandLine: command, @@ -984,7 +984,7 @@ func TestGetDebugCommand(t *testing.T) { LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ - IsDefault: true, + IsDefault: util.GetBoolPtr(true), Kind: devfilev1.DebugCommandGroupKind, }, }, @@ -1009,7 +1009,7 @@ func TestGetDebugCommand(t *testing.T) { LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ - IsDefault: false, + IsDefault: util.GetBoolPtr(false), Kind: devfilev1.DebugCommandGroupKind, }, }, @@ -1033,7 +1033,7 @@ func TestGetDebugCommand(t *testing.T) { LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ - IsDefault: true, + IsDefault: util.GetBoolPtr(true), Kind: devfilev1.BuildCommandGroupKind, }, }, @@ -1109,7 +1109,7 @@ func TestGetTestCommand(t *testing.T) { LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ - IsDefault: true, + IsDefault: util.GetBoolPtr(true), Kind: devfilev1.TestCommandGroupKind, }, }, @@ -1134,7 +1134,7 @@ func TestGetTestCommand(t *testing.T) { LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ - IsDefault: false, + IsDefault: util.GetBoolPtr(false), Kind: devfilev1.TestCommandGroupKind, }, }, @@ -1158,7 +1158,7 @@ func TestGetTestCommand(t *testing.T) { LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ - IsDefault: true, + IsDefault: util.GetBoolPtr(true), Kind: devfilev1.BuildCommandGroupKind, }, }, @@ -1233,7 +1233,7 @@ func TestGetRunCommand(t *testing.T) { Exec: &devfilev1.ExecCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: runGroup, IsDefault: true}, + Group: &devfilev1.CommandGroup{Kind: runGroup, IsDefault: util.GetBoolPtr(true)}, }, }, CommandLine: command, @@ -1351,7 +1351,7 @@ func TestValidateAndGetDebugDevfileCommands(t *testing.T) { LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ - IsDefault: true, + IsDefault: util.GetBoolPtr(true), Kind: devfilev1.DebugCommandGroupKind, }, }, @@ -1369,7 +1369,7 @@ func TestValidateAndGetDebugDevfileCommands(t *testing.T) { LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ - IsDefault: false, + IsDefault: util.GetBoolPtr(false), Kind: devfilev1.DebugCommandGroupKind, }, }, @@ -1465,7 +1465,7 @@ func TestValidateAndGetPushDevfileCommands(t *testing.T) { BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ Kind: runGroup, - IsDefault: true, + IsDefault: util.GetBoolPtr(true), }, }, }, @@ -1641,7 +1641,7 @@ func TestValidateAndGetTestDevfileCommands(t *testing.T) { LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ - IsDefault: true, + IsDefault: util.GetBoolPtr(true), Kind: devfilev1.TestCommandGroupKind, }, }, @@ -1659,7 +1659,7 @@ func TestValidateAndGetTestDevfileCommands(t *testing.T) { LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ - IsDefault: false, + IsDefault: util.GetBoolPtr(false), Kind: devfilev1.TestCommandGroupKind, }, }, diff --git a/pkg/devfile/adapters/common/generic.go b/pkg/devfile/adapters/common/generic.go index bdf6d1f2b49..96e46f9e3cc 100644 --- a/pkg/devfile/adapters/common/generic.go +++ b/pkg/devfile/adapters/common/generic.go @@ -8,6 +8,7 @@ import ( "github.com/devfile/library/pkg/devfile/parser/data/v2/common" "github.com/openshift/odo/pkg/log" "github.com/openshift/odo/pkg/machineoutput" + "github.com/openshift/odo/pkg/util" "github.com/pkg/errors" "k8s.io/klog" ) @@ -145,7 +146,7 @@ func (a GenericAdapter) ExecDevfile(commandsMap PushCommandsMap, componentExists } } - restart := IsRestartRequired(command.Exec.HotReloadCapable, params.RunModeChanged) + restart := IsRestartRequired(util.SafeGetBool(command.Exec.HotReloadCapable), params.RunModeChanged) // if we need to restart, issue supervisor command to stop all running commands first // we do not need to restart Hot reload capable commands diff --git a/pkg/devfile/adapters/common/generic_test.go b/pkg/devfile/adapters/common/generic_test.go index df14d518675..39aca70d1b4 100644 --- a/pkg/devfile/adapters/common/generic_test.go +++ b/pkg/devfile/adapters/common/generic_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/devfile/library/pkg/devfile/parser/data" + "github.com/openshift/odo/pkg/util" devfilev1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" devfileParser "github.com/devfile/library/pkg/devfile/parser" @@ -50,13 +51,13 @@ func TestExecuteDevfileCommand(t *testing.T) { { Id: commands[0], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { Id: commands[1], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { @@ -69,7 +70,7 @@ func TestExecuteDevfileCommand(t *testing.T) { cmd: createCommandFrom(commands[2], devfilev1.CompositeCommand{ Commands: []string{commands[0], commands[1]}, - Parallel: false, + Parallel: util.GetBoolPtr(false), }), execClient: fakeExecClient, wantErr: false, @@ -80,13 +81,13 @@ func TestExecuteDevfileCommand(t *testing.T) { { Id: commands[0], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { Id: commands[1], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { @@ -98,7 +99,7 @@ func TestExecuteDevfileCommand(t *testing.T) { }, cmd: createCommandFrom(commands[2], devfilev1.CompositeCommand{ Commands: []string{commands[0], commands[1]}, - Parallel: false, + Parallel: util.GetBoolPtr(false), }), execClient: fakeExecErrorClient, wantErr: true, @@ -109,13 +110,13 @@ func TestExecuteDevfileCommand(t *testing.T) { { Id: commands[0], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { Id: commands[1], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { @@ -127,7 +128,7 @@ func TestExecuteDevfileCommand(t *testing.T) { }, cmd: createCommandFrom(commands[2], devfilev1.CompositeCommand{ Commands: []string{commands[0], commands[1]}, - Parallel: true, + Parallel: util.GetBoolPtr(true), }), execClient: fakeExecClient, wantErr: false, @@ -138,13 +139,13 @@ func TestExecuteDevfileCommand(t *testing.T) { { Id: commands[0], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { Id: commands[1], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { @@ -156,7 +157,7 @@ func TestExecuteDevfileCommand(t *testing.T) { }, cmd: createCommandFrom(commands[2], devfilev1.CompositeCommand{ Commands: []string{commands[0], commands[1]}, - Parallel: true, + Parallel: util.GetBoolPtr(true), }), execClient: fakeExecErrorClient, wantErr: true, @@ -167,13 +168,13 @@ func TestExecuteDevfileCommand(t *testing.T) { { Id: commands[0], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { Id: commands[1], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { @@ -185,7 +186,7 @@ func TestExecuteDevfileCommand(t *testing.T) { }, cmd: createCommandFrom(commands[2], devfilev1.CompositeCommand{ Commands: []string{commands[0], "fake-command"}, - Parallel: false, + Parallel: util.GetBoolPtr(false), }), execClient: fakeExecClient, wantErr: true, @@ -196,13 +197,13 @@ func TestExecuteDevfileCommand(t *testing.T) { { Id: commands[0], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { Id: commands[1], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { @@ -214,7 +215,7 @@ func TestExecuteDevfileCommand(t *testing.T) { }, cmd: createCommandFrom(commands[2], devfilev1.CompositeCommand{ Commands: []string{commands[0], "fake-command"}, - Parallel: true, + Parallel: util.GetBoolPtr(true), }), execClient: fakeExecClient, wantErr: true, @@ -225,13 +226,13 @@ func TestExecuteDevfileCommand(t *testing.T) { { Id: commands[0], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { Id: commands[1], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { @@ -249,7 +250,7 @@ func TestExecuteDevfileCommand(t *testing.T) { }, cmd: createCommandFrom(commands[3], devfilev1.CompositeCommand{ Commands: []string{commands[0], commands[2]}, - Parallel: false, + Parallel: util.GetBoolPtr(false), }), execClient: fakeExecClient, wantErr: false, @@ -260,13 +261,13 @@ func TestExecuteDevfileCommand(t *testing.T) { { Id: commands[0], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { Id: commands[1], CommandUnion: devfilev1.CommandUnion{ - Exec: &devfilev1.ExecCommand{HotReloadCapable: false}, + Exec: &devfilev1.ExecCommand{HotReloadCapable: util.GetBoolPtr(false)}, }, }, { @@ -284,7 +285,7 @@ func TestExecuteDevfileCommand(t *testing.T) { }, cmd: createCommandFrom(commands[3], devfilev1.CompositeCommand{ Commands: []string{commands[0], commands[2]}, - Parallel: true, + Parallel: util.GetBoolPtr(true), }), execClient: fakeExecClient, wantErr: false, diff --git a/pkg/devfile/adapters/common/utils_test.go b/pkg/devfile/adapters/common/utils_test.go index 92d69273b19..90827cd3c1b 100644 --- a/pkg/devfile/adapters/common/utils_test.go +++ b/pkg/devfile/adapters/common/utils_test.go @@ -14,6 +14,7 @@ import ( "github.com/devfile/library/pkg/testingutil" devfileFileSystem "github.com/devfile/library/pkg/testingutil/filesystem" odotestingutil "github.com/openshift/odo/pkg/testingutil" + "github.com/openshift/odo/pkg/util" ) func TestIsEnvPresent(t *testing.T) { @@ -146,7 +147,7 @@ func TestGetCommandsForGroup(t *testing.T) { BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ Kind: runGroup, - IsDefault: true, + IsDefault: util.GetBoolPtr(true), }, }, }, @@ -303,7 +304,7 @@ func TestGetCommands(t *testing.T) { Id: "somecommand", CommandUnion: devfilev1.CommandUnion{ Exec: &devfilev1.ExecCommand{ - HotReloadCapable: false, + HotReloadCapable: util.GetBoolPtr(false), }, }, }, @@ -313,7 +314,7 @@ func TestGetCommands(t *testing.T) { Id: "somecommand", CommandUnion: devfilev1.CommandUnion{ Exec: &devfilev1.ExecCommand{ - HotReloadCapable: false, + HotReloadCapable: util.GetBoolPtr(false), }, }, }, @@ -326,7 +327,7 @@ func TestGetCommands(t *testing.T) { Id: "somecommand", CommandUnion: devfilev1.CommandUnion{ Exec: &devfilev1.ExecCommand{ - HotReloadCapable: false, + HotReloadCapable: util.GetBoolPtr(false), }, }, }, @@ -334,7 +335,7 @@ func TestGetCommands(t *testing.T) { Id: "somecommand2", CommandUnion: devfilev1.CommandUnion{ Exec: &devfilev1.ExecCommand{ - HotReloadCapable: false, + HotReloadCapable: util.GetBoolPtr(false), }, }, }, @@ -354,7 +355,7 @@ func TestGetCommands(t *testing.T) { Id: "somecommand", CommandUnion: devfilev1.CommandUnion{ Exec: &devfilev1.ExecCommand{ - HotReloadCapable: false, + HotReloadCapable: util.GetBoolPtr(false), }, }, }, @@ -362,7 +363,7 @@ func TestGetCommands(t *testing.T) { Id: "somecommand2", CommandUnion: devfilev1.CommandUnion{ Exec: &devfilev1.ExecCommand{ - HotReloadCapable: false, + HotReloadCapable: util.GetBoolPtr(false), }, }, }, diff --git a/pkg/devfile/adapters/kubernetes/utils/utils_test.go b/pkg/devfile/adapters/kubernetes/utils/utils_test.go index 4f0897b529d..7c737833ba1 100644 --- a/pkg/devfile/adapters/kubernetes/utils/utils_test.go +++ b/pkg/devfile/adapters/kubernetes/utils/utils_test.go @@ -7,6 +7,7 @@ import ( "github.com/devfile/library/pkg/devfile/parser/data" "github.com/openshift/odo/pkg/storage" + "github.com/openshift/odo/pkg/util" devfilev1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" devfileParser "github.com/devfile/library/pkg/devfile/parser" @@ -181,11 +182,11 @@ func TestUpdateContainersWithSupervisord(t *testing.T) { emptyString := "" defaultCommand := []string{"tail"} execRunGroup := devfilev1.CommandGroup{ - IsDefault: true, + IsDefault: util.GetBoolPtr(true), Kind: devfilev1.RunCommandGroupKind, } execDebugGroup := devfilev1.CommandGroup{ - IsDefault: true, + IsDefault: util.GetBoolPtr(true), Kind: devfilev1.DebugCommandGroupKind, } defaultArgs := []string{"-f", "/dev/null"} @@ -574,7 +575,7 @@ func TestUpdateContainersWithSupervisord(t *testing.T) { LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ - IsDefault: true, + IsDefault: util.GetBoolPtr(true), Kind: devfilev1.BuildCommandGroupKind, }, }, diff --git a/pkg/devfile/convert/convert.go b/pkg/devfile/convert/convert.go index 7266e3f68b5..8f949123588 100644 --- a/pkg/devfile/convert/convert.go +++ b/pkg/devfile/convert/convert.go @@ -12,6 +12,7 @@ import ( "github.com/openshift/odo/pkg/devfile/adapters/common" "github.com/openshift/odo/pkg/envinfo" "github.com/openshift/odo/pkg/occlient" + "github.com/openshift/odo/pkg/util" "github.com/pkg/errors" "k8s.io/klog" @@ -194,7 +195,7 @@ func setDevfileCommandsForS2I(d data.DevfileData) { BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ Kind: devfilev1.BuildCommandGroupKind, - IsDefault: true, + IsDefault: util.GetBoolPtr(true), }, }, }, @@ -212,7 +213,7 @@ func setDevfileCommandsForS2I(d data.DevfileData) { BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ Kind: devfilev1.RunCommandGroupKind, - IsDefault: true, + IsDefault: util.GetBoolPtr(true), }, }, }, @@ -230,7 +231,7 @@ func setDevfileCommandsForS2I(d data.DevfileData) { BaseCommand: devfilev1.BaseCommand{ Group: &devfilev1.CommandGroup{ Kind: devfilev1.DebugCommandGroupKind, - IsDefault: true, + IsDefault: util.GetBoolPtr(true), }, }, }, @@ -401,7 +402,7 @@ func setDevfileComponentsForS2I(d data.DevfileData, s2iImage string, localConfig endpoint := devfilev1.Endpoint{ Name: url.Name, TargetPort: url.Port, - Secure: url.Secure, + Secure: &url.Secure, } endpoints = append(endpoints, endpoint) @@ -441,7 +442,7 @@ func setDevfileComponentsForS2I(d data.DevfileData, s2iImage string, localConfig endpoint := devfilev1.Endpoint{ Name: fmt.Sprintf("%s-%d", protocol, intPort), TargetPort: intPort, - Secure: false, + Secure: util.GetBoolPtr(false), } endpoints = append(endpoints, endpoint) diff --git a/pkg/devfile/validate/commands_test.go b/pkg/devfile/validate/commands_test.go index e79f8de649b..d0f19e53fbd 100644 --- a/pkg/devfile/validate/commands_test.go +++ b/pkg/devfile/validate/commands_test.go @@ -4,6 +4,7 @@ import ( "testing" devfilev1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" + "github.com/openshift/odo/pkg/util" ) var buildGroup = devfilev1.BuildCommandGroupKind @@ -34,7 +35,7 @@ func TestValidateCommand(t *testing.T) { Composite: &devfilev1.CompositeCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: true}, + Group: &devfilev1.CommandGroup{Kind: buildGroup, IsDefault: util.GetBoolPtr(true)}, }, }, }, @@ -50,7 +51,7 @@ func TestValidateCommand(t *testing.T) { Composite: &devfilev1.CompositeCommand{ LabeledCommand: devfilev1.LabeledCommand{ BaseCommand: devfilev1.BaseCommand{ - Group: &devfilev1.CommandGroup{Kind: runGroup, IsDefault: true}, + Group: &devfilev1.CommandGroup{Kind: runGroup, IsDefault: util.GetBoolPtr(true)}, }, }, }, diff --git a/pkg/envinfo/envinfo_test.go b/pkg/envinfo/envinfo_test.go index 6fc6f2ceeaf..a7a2ff15dc6 100644 --- a/pkg/envinfo/envinfo_test.go +++ b/pkg/envinfo/envinfo_test.go @@ -15,6 +15,7 @@ import ( devfileCtx "github.com/devfile/library/pkg/devfile/parser/context" "github.com/devfile/library/pkg/devfile/parser/data/v2/common" "github.com/openshift/odo/pkg/localConfigProvider" + "github.com/openshift/odo/pkg/util" devfileFileSystem "github.com/devfile/library/pkg/testingutil/filesystem" "github.com/openshift/odo/pkg/testingutil/filesystem" @@ -394,7 +395,7 @@ func TestAddEndpointInDevfile(t *testing.T) { endpoint: devfilev1.Endpoint{ Name: urlName, TargetPort: 8080, - Secure: false, + Secure: util.GetBoolPtr(false), }, container: "testcontainer1", devObj: parser.DevfileObj{ @@ -444,7 +445,7 @@ func TestAddEndpointInDevfile(t *testing.T) { { Name: urlName, TargetPort: 8080, - Secure: false, + Secure: util.GetBoolPtr(false), }, }, }, @@ -457,7 +458,7 @@ func TestAddEndpointInDevfile(t *testing.T) { endpoint: devfilev1.Endpoint{ Name: urlName, TargetPort: 8080, - Secure: false, + Secure: util.GetBoolPtr(false), }, container: "testcontainer1", devObj: parser.DevfileObj{ @@ -497,7 +498,7 @@ func TestAddEndpointInDevfile(t *testing.T) { { Name: urlName, TargetPort: 8080, - Secure: false, + Secure: util.GetBoolPtr(false), }, }, }, @@ -510,7 +511,7 @@ func TestAddEndpointInDevfile(t *testing.T) { endpoint: devfilev1.Endpoint{ Name: urlName, TargetPort: 8080, - Secure: false, + Secure: util.GetBoolPtr(false), }, container: "testcontainer1", devObj: parser.DevfileObj{ @@ -539,7 +540,7 @@ func TestAddEndpointInDevfile(t *testing.T) { { Name: urlName2, TargetPort: 9090, - Secure: true, + Secure: util.GetBoolPtr(true), Path: "/testpath", Exposure: devfilev1.InternalEndpointExposure, Protocol: devfilev1.HTTPSEndpointProtocol, @@ -567,7 +568,7 @@ func TestAddEndpointInDevfile(t *testing.T) { { Name: urlName, TargetPort: 8080, - Secure: false, + Secure: util.GetBoolPtr(false), }, }, }, @@ -581,7 +582,7 @@ func TestAddEndpointInDevfile(t *testing.T) { { Name: urlName2, TargetPort: 9090, - Secure: true, + Secure: util.GetBoolPtr(true), Path: "/testpath", Exposure: devfilev1.InternalEndpointExposure, Protocol: devfilev1.HTTPSEndpointProtocol, @@ -649,7 +650,7 @@ func TestRemoveEndpointInDevfile(t *testing.T) { { Name: urlName, TargetPort: 8080, - Secure: false, + Secure: util.GetBoolPtr(false), }, }, }, @@ -704,7 +705,7 @@ func TestRemoveEndpointInDevfile(t *testing.T) { { Name: urlName, TargetPort: 8080, - Secure: false, + Secure: util.GetBoolPtr(false), }, }, }, @@ -754,7 +755,7 @@ func TestRemoveEndpointInDevfile(t *testing.T) { { Name: urlName, TargetPort: 8080, - Secure: false, + Secure: util.GetBoolPtr(false), }, }, }, @@ -768,7 +769,7 @@ func TestRemoveEndpointInDevfile(t *testing.T) { { Name: urlName2, TargetPort: 9090, - Secure: true, + Secure: util.GetBoolPtr(true), Path: "/testpath", Exposure: devfilev1.InternalEndpointExposure, Protocol: devfilev1.HTTPSEndpointProtocol, @@ -804,7 +805,7 @@ func TestRemoveEndpointInDevfile(t *testing.T) { { Name: urlName2, TargetPort: 9090, - Secure: true, + Secure: util.GetBoolPtr(true), Path: "/testpath", Exposure: devfilev1.InternalEndpointExposure, Protocol: devfilev1.HTTPSEndpointProtocol, @@ -838,7 +839,7 @@ func TestRemoveEndpointInDevfile(t *testing.T) { { Name: urlName, TargetPort: 8080, - Secure: false, + Secure: util.GetBoolPtr(false), }, }, }, @@ -863,7 +864,7 @@ func TestRemoveEndpointInDevfile(t *testing.T) { { Name: urlName, TargetPort: 8080, - Secure: false, + Secure: util.GetBoolPtr(false), }, }, }, diff --git a/pkg/envinfo/url.go b/pkg/envinfo/url.go index acd8acc7949..2645dd42004 100644 --- a/pkg/envinfo/url.go +++ b/pkg/envinfo/url.go @@ -284,7 +284,7 @@ func (esi *EnvSpecificInfo) CreateURL(url localConfigProvider.LocalURL) error { newEndpointEntry := devfilev1.Endpoint{ Name: url.Name, Path: url.Path, - Secure: url.Secure, + Secure: util.GetBoolPtr(url.Secure), Exposure: devfilev1.PublicEndpointExposure, TargetPort: url.Port, Protocol: devfilev1.EndpointProtocol(strings.ToLower(url.Protocol)), @@ -341,7 +341,7 @@ func (ei *EnvInfo) ListURLs() ([]localConfigProvider.LocalURL, error) { } secure := false - if localEndpoint.Secure || localEndpoint.Protocol == "https" || localEndpoint.Protocol == "wss" { + if util.SafeGetBool(localEndpoint.Secure) || localEndpoint.Protocol == "https" || localEndpoint.Protocol == "wss" { secure = true } @@ -461,12 +461,12 @@ func updateEndpointInDevfile(devObj parser.DevfileObj, url localConfigProvider.L } // prevent write unless required - if endpoint.Exposure != devfilev1.PublicEndpointExposure || url.Secure != endpoint.Secure || + if endpoint.Exposure != devfilev1.PublicEndpointExposure || url.Secure != util.SafeGetBool(endpoint.Secure) || url.Path != endpoint.Path || url.Protocol != string(endpoint.Protocol) { endpoint = devfilev1.Endpoint{ Name: url.Name, Path: url.Path, - Secure: url.Secure, + Secure: &url.Secure, Exposure: devfilev1.PublicEndpointExposure, TargetPort: url.Port, Protocol: devfilev1.EndpointProtocol(strings.ToLower(url.Protocol)), diff --git a/pkg/envinfo/url_test.go b/pkg/envinfo/url_test.go index 03020d45791..4f2830f104e 100644 --- a/pkg/envinfo/url_test.go +++ b/pkg/envinfo/url_test.go @@ -1,10 +1,11 @@ package envinfo import ( - "github.com/devfile/library/pkg/devfile/parser/data" "reflect" "testing" + "github.com/devfile/library/pkg/devfile/parser/data" + v1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" "github.com/devfile/library/pkg/devfile/parser" devfileCtx "github.com/devfile/library/pkg/devfile/parser/context" @@ -13,6 +14,7 @@ import ( "github.com/kylelemons/godebug/pretty" "github.com/openshift/odo/pkg/localConfigProvider" odoTestingUtil "github.com/openshift/odo/pkg/testingutil" + "github.com/openshift/odo/pkg/util" ) func TestEnvInfo_CompleteURL(t *testing.T) { @@ -1066,6 +1068,7 @@ func Test_updateEndpointInDevfile(t *testing.T) { TargetPort: 3030, Protocol: v1.WSSEndpointProtocol, Exposure: v1.PublicEndpointExposure, + Secure: util.GetBoolPtr(false), }, wantErr: false, }, @@ -1083,6 +1086,7 @@ func Test_updateEndpointInDevfile(t *testing.T) { Name: "port-3030", TargetPort: 3030, Exposure: v1.PublicEndpointExposure, + Secure: util.GetBoolPtr(false), }, wantErr: false, }, @@ -1102,6 +1106,7 @@ func Test_updateEndpointInDevfile(t *testing.T) { TargetPort: 3000, Path: "/user", Exposure: v1.PublicEndpointExposure, + Secure: util.GetBoolPtr(false), }, wantErr: false, }, @@ -1119,7 +1124,7 @@ func Test_updateEndpointInDevfile(t *testing.T) { wantEndpoint: v1.Endpoint{ Name: "port-3030", TargetPort: 3000, - Secure: true, + Secure: util.GetBoolPtr(true), Exposure: v1.PublicEndpointExposure, }, wantErr: false, diff --git a/pkg/testingutil/devfile.go b/pkg/testingutil/devfile.go index b700a00f565..125552e9bcb 100644 --- a/pkg/testingutil/devfile.go +++ b/pkg/testingutil/devfile.go @@ -6,6 +6,7 @@ import ( devfileCtx "github.com/devfile/library/pkg/devfile/parser/context" "github.com/devfile/library/pkg/devfile/parser/data" devfilefs "github.com/devfile/library/pkg/testingutil/filesystem" + "github.com/openshift/odo/pkg/util" ) // GetFakeContainerComponent returns a fake container component for testing @@ -56,7 +57,7 @@ func GetFakeExecRunCommands() []v1.Command { BaseCommand: v1.BaseCommand{ Group: &v1.CommandGroup{ Kind: v1.RunCommandGroupKind, - IsDefault: true, + IsDefault: util.GetBoolPtr(true), }, }, }, @@ -251,7 +252,7 @@ func DevfileObjWithSecureEndpoints(fs devfilefs.Filesystem) parser.DevfileObj { { Name: "port-8080", TargetPort: 8080, - Secure: true, + Secure: util.GetBoolPtr(true), }, }, }, diff --git a/pkg/url/status_test.go b/pkg/url/status_test.go index a6c5cb26321..5a39162ebfc 100644 --- a/pkg/url/status_test.go +++ b/pkg/url/status_test.go @@ -1,10 +1,11 @@ package url import ( - "github.com/openshift/odo/pkg/unions" "reflect" "testing" + "github.com/openshift/odo/pkg/unions" + "github.com/golang/mock/gomock" routev1 "github.com/openshift/api/route/v1" "github.com/openshift/odo/pkg/kclient" diff --git a/pkg/util/util.go b/pkg/util/util.go index bf4cc484d42..48c1b98565c 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -1595,3 +1595,16 @@ func GetGitOriginPath(path string) string { } return "" } + +// BoolPtr returns pointer to passed boolean +func GetBoolPtr(b bool) *bool { + return &b +} + +// SafeGetBool returns the value of the bool pointer, or false if the pointer is nil +func SafeGetBool(b *bool) bool { + if b == nil { + return false + } + return *b +} diff --git a/pkg/util/util_test.go b/pkg/util/util_test.go index 23a15ddeb3a..69724e5f3b9 100644 --- a/pkg/util/util_test.go +++ b/pkg/util/util_test.go @@ -2786,3 +2786,35 @@ func TestNamespaceKubernetesObjectWithTrim(t *testing.T) { }) } } + +func TestSafeGetBool(t *testing.T) { + + tests := []struct { + name string + arg *bool + want bool + }{ + { + name: "case 1: nil pointer", + arg: nil, + want: false, + }, + { + name: "case 2: true", + arg: GetBoolPtr(true), + want: true, + }, + { + name: "case 3: false", + arg: GetBoolPtr(false), + want: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := SafeGetBool(tt.arg); got != tt.want { + t.Errorf("SafeGetBool() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/tests/integration/devfile/cmd_devfile_test_test.go b/tests/integration/devfile/cmd_devfile_test_test.go index bc8fabca0db..edbabe4e8f5 100644 --- a/tests/integration/devfile/cmd_devfile_test_test.go +++ b/tests/integration/devfile/cmd_devfile_test_test.go @@ -59,7 +59,7 @@ var _ = Describe("odo devfile test command tests", func() { helper.Cmd("odo", "create", "nodejs", "--context", commonVar.Context, cmpName).ShouldPass() helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context) helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-with-testgroup.yaml"), filepath.Join(commonVar.Context, "devfile.yaml")) - helper.ReplaceString(filepath.Join(commonVar.Context, "devfile.yaml"), "isDefault: true", "") + helper.ReplaceString(filepath.Join(commonVar.Context, "devfile.yaml"), "IsDefault: util.GetBoolPtr(true)", "") output := helper.Cmd("odo", "push", "--context", commonVar.Context).ShouldFail().Err() Expect(output).To(ContainSubstring("command group test error - there should be exactly one default command, currently there is no default command")) output = helper.Cmd("odo", "test", "--context", commonVar.Context).ShouldFail().Err() From 2f38c168d9dda60b604bfc4e5c3173817048299b Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Fri, 8 Oct 2021 15:14:11 +0200 Subject: [PATCH 4/4] fix tests: new error messages --- tests/integration/devfile/cmd_devfile_test_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/devfile/cmd_devfile_test_test.go b/tests/integration/devfile/cmd_devfile_test_test.go index edbabe4e8f5..f507c880688 100644 --- a/tests/integration/devfile/cmd_devfile_test_test.go +++ b/tests/integration/devfile/cmd_devfile_test_test.go @@ -59,11 +59,11 @@ var _ = Describe("odo devfile test command tests", func() { helper.Cmd("odo", "create", "nodejs", "--context", commonVar.Context, cmpName).ShouldPass() helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context) helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-with-testgroup.yaml"), filepath.Join(commonVar.Context, "devfile.yaml")) - helper.ReplaceString(filepath.Join(commonVar.Context, "devfile.yaml"), "IsDefault: util.GetBoolPtr(true)", "") + helper.ReplaceString(filepath.Join(commonVar.Context, "devfile.yaml"), "isDefault: true", "") output := helper.Cmd("odo", "push", "--context", commonVar.Context).ShouldFail().Err() - Expect(output).To(ContainSubstring("command group test error - there should be exactly one default command, currently there is no default command")) + Expect(output).To(ContainSubstring("command group test warning - there should be exactly one default command, currently there is no default command")) output = helper.Cmd("odo", "test", "--context", commonVar.Context).ShouldFail().Err() - Expect(output).To(ContainSubstring("command group test error - there should be exactly one default command, currently there is no default command")) + Expect(output).To(ContainSubstring("command group test warning - there should be exactly one default command, currently there is no default command")) }) It("should show error if devfile has multiple default test command", func() { @@ -71,9 +71,9 @@ var _ = Describe("odo devfile test command tests", func() { helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context) helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-with-multiple-defaults.yaml"), filepath.Join(commonVar.Context, "devfile.yaml")) output := helper.Cmd("odo", "push", "--build-command", "firstbuild", "--run-command", "secondrun", "--context", commonVar.Context).ShouldFail().Err() - Expect(output).To(ContainSubstring("command group test error - there should be exactly one default command, currently there is more than one default command")) + Expect(output).To(ContainSubstring("command group test error - there should be exactly one default command, currently there are multiple default commands")) output = helper.Cmd("odo", "test", "--context", commonVar.Context).ShouldFail().Err() - Expect(output).To(ContainSubstring("command group test error - there should be exactly one default command, currently there is more than one default command")) + Expect(output).To(ContainSubstring("command group test error - there should be exactly one default command, currently there are multiple default commands")) }) It("should error out on devfile flag", func() {