diff --git a/pkg/devfile/parser/parse_test.go b/pkg/devfile/parser/parse_test.go index 9ddb9c3e..f80aaa4e 100644 --- a/pkg/devfile/parser/parse_test.go +++ b/pkg/devfile/parser/parse_test.go @@ -3988,7 +3988,7 @@ func Test_parseFromRegistry(t *testing.T) { ImportReferenceUnion: v1.ImportReferenceUnion{ Id: registryId, }, - Version: "2.1.0", + Version: "2.1.1", RegistryUrl: stagingRegistry, }, }, diff --git a/pkg/devfile/parser/utils.go b/pkg/devfile/parser/utils.go index 6cba73c8..d65ce6ff 100644 --- a/pkg/devfile/parser/utils.go +++ b/pkg/devfile/parser/utils.go @@ -20,17 +20,18 @@ import ( "reflect" devfilev1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" + "github.com/devfile/library/v2/pkg/devfile/parser/data" "github.com/devfile/library/v2/pkg/devfile/parser/data/v2/common" ) // GetDeployComponents gets the default deploy command associated components -func GetDeployComponents(devfileObj DevfileObj) (map[string]string, error) { +func GetDeployComponents(devfileData data.DevfileData) (map[string]string, error) { deployCommandFilter := common.DevfileOptions{ CommandOptions: common.CommandOptions{ CommandGroupKind: devfilev1.DeployCommandGroupKind, }, } - deployCommands, err := devfileObj.Data.GetCommands(deployCommandFilter) + deployCommands, err := devfileData.GetCommands(deployCommandFilter) if err != nil { return nil, err } @@ -57,7 +58,7 @@ func GetDeployComponents(devfileObj DevfileObj) (map[string]string, error) { CommandType: devfilev1.ApplyCommandType, }, } - applyCommands, err := devfileObj.Data.GetCommands(applyCommandFilter) + applyCommands, err := devfileData.GetCommands(applyCommandFilter) if err != nil { return nil, err } @@ -77,14 +78,14 @@ func GetDeployComponents(devfileObj DevfileObj) (map[string]string, error) { } // GetImageBuildComponent gets the image build component from the deploy associated components -func GetImageBuildComponent(devfileObj DevfileObj, deployAssociatedComponents map[string]string) (devfilev1.Component, error) { +func GetImageBuildComponent(devfileData data.DevfileData, deployAssociatedComponents map[string]string) (devfilev1.Component, error) { imageComponentFilter := common.DevfileOptions{ ComponentOptions: common.ComponentOptions{ ComponentType: devfilev1.ImageComponentType, }, } - imageComponents, err := devfileObj.Data.GetComponents(imageComponentFilter) + imageComponents, err := devfileData.GetComponents(imageComponentFilter) if err != nil { return devfilev1.Component{}, err } diff --git a/pkg/devfile/parser/utils_test.go b/pkg/devfile/parser/utils_test.go index 5afd01d8..56c7ea58 100644 --- a/pkg/devfile/parser/utils_test.go +++ b/pkg/devfile/parser/utils_test.go @@ -196,7 +196,7 @@ func TestGetDeployComponents(t *testing.T) { Data: mockDevfileData, } - componentMap, err := GetDeployComponents(devObj) + componentMap, err := GetDeployComponents(devObj.Data) // Unexpected error if (err != nil) != (tt.wantErr != nil) { t.Errorf("TestGetDeployComponents() error: %v, wantErr %v", err, tt.wantErr) @@ -372,7 +372,7 @@ func TestGetImageBuildComponent(t *testing.T) { Data: mockDevfileData, } - component, err := GetImageBuildComponent(devObj, tt.deployAssociatedComponents) + component, err := GetImageBuildComponent(devObj.Data, tt.deployAssociatedComponents) // Unexpected error if (err != nil) != (tt.wantErr != nil) { t.Errorf("TestGetImageBuildComponent() error: %v, wantErr %v", err, tt.wantErr)