Skip to content

Commit

Permalink
pull in latest release
Browse files Browse the repository at this point in the history
Signed-off-by: Stephanie <[email protected]>
  • Loading branch information
yangcao77 committed Sep 21, 2023
1 parent d8f84fe commit a19abf7
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion cdq-analysis/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/redhat-appstudio/application-service/cdq-analysis
go 1.19

require (
github.com/devfile/alizer v1.1.1-1.18b
github.com/devfile/alizer v1.1.6-0.20230921110335-93b0fab2bfe0
github.com/devfile/api/v2 v2.2.1-alpha.0.20230413012049-a6c32fca0dbd
github.com/devfile/library/v2 v2.2.1-0.20230821212346-99a3776c0b1e
github.com/devfile/registry-support/index/generator v0.0.0-20221018203505-df96d34d4273
Expand Down
4 changes: 2 additions & 2 deletions cdq-analysis/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0=
github.com/devfile/alizer v1.1.1-1.18b h1:2mBYBBT+JHziuzB/SJ8A0uomnaJPe55D+6xE69TZPY8=
github.com/devfile/alizer v1.1.1-1.18b/go.mod h1:TgiLIIbOjrchs2DYD/L9369g4BLz3e0Offm2gIr154c=
github.com/devfile/alizer v1.1.6-0.20230921110335-93b0fab2bfe0 h1:mBKJiQGeqw0BL8f1E1HNM18xX4KPSYwQ4DbFD+5NWZ0=
github.com/devfile/alizer v1.1.6-0.20230921110335-93b0fab2bfe0/go.mod h1:bbmpezGJe/lSqoYcTZSHTJMQaBYapOF/OsVWsqsEcBA=
github.com/devfile/api/v2 v2.0.0-20211021164004-dabee4e633ed/go.mod h1:d99eTN6QxgzihOOFyOZA+VpUyD4Q1pYRYHZ/ci9J96Q=
github.com/devfile/api/v2 v2.0.0-20220117162434-6e6e6a8bc14c/go.mod h1:d99eTN6QxgzihOOFyOZA+VpUyD4Q1pYRYHZ/ci9J96Q=
github.com/devfile/api/v2 v2.2.0/go.mod h1:dN7xFrOVG+iPqn4UKGibXLd5oVsdE8XyK9OEb5JL3aI=
Expand Down
8 changes: 4 additions & 4 deletions cdq-analysis/pkg/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
)

type Alizer interface {
SelectDevFileFromTypes(path string, devFileTypes []model.DevFileType) (model.DevFileType, error)
SelectDevFileFromTypes(path string, devFileTypes []model.DevfileType) (model.DevfileType, error)
DetectComponents(path string) ([]model.Component, error)
}

Expand Down Expand Up @@ -310,10 +310,10 @@ func (a AlizerClient) Analyze(path string) ([]model.Language, error) {
}

// SelectDevFileFromTypes is a wrapper call to Alizer's SelectDevFileFromTypes()
func (a AlizerClient) SelectDevFileFromTypes(path string, devFileTypes []model.DevFileType) (model.DevFileType, error) {
func (a AlizerClient) SelectDevFileFromTypes(path string, devFileTypes []model.DevfileType) (model.DevfileType, error) {
index, err := recognizer.SelectDevFileFromTypes(path, devFileTypes)
if err != nil {
return model.DevFileType{}, err
return model.DevfileType{}, err
}
return devFileTypes[index], err
}
Expand Down Expand Up @@ -357,7 +357,7 @@ func AnalyzeAndDetectDevfile(a Alizer, path, devfileRegistryURL string) ([]byte,
// No need to check for err, if a path does not have a detected devfile, ignore err
// if a dir can be a component but we get an unrelated err, err out
return nil, "", "", nil, err
} else if !reflect.DeepEqual(detectedType, model.DevFileType{}) {
} else if !reflect.DeepEqual(detectedType, model.DevfileType{}) {
// Note: Do not use the Devfile registry endpoint devfileRegistry/devfiles/detectedType.Name
// until the Devfile registry support uploads the Devfile Kubernetes component relative uri file
// as an artifact and made accessible via devfile/library or devfile/registry-support
Expand Down
16 changes: 8 additions & 8 deletions cdq-analysis/pkg/detect_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,27 +232,27 @@ func (a MockAlizerClient) DetectComponents(path string) ([]model.Component, erro
}

// SelectDevFileFromTypes is a wrapper call to Alizer's SelectDevFileFromTypes()
func (a MockAlizerClient) SelectDevFileFromTypes(path string, devFileTypes []model.DevFileType) (model.DevFileType, error) {
func (a MockAlizerClient) SelectDevFileFromTypes(path string, devFileTypes []model.DevfileType) (model.DevfileType, error) {
if strings.Contains(path, "/errorSelectDevFileFromTypes") {
return model.DevFileType{}, fmt.Errorf("dummy SelectDevFileFromTypes err")
return model.DevfileType{}, fmt.Errorf("dummy SelectDevFileFromTypes err")
} else if strings.Contains(path, "/error/devfileendpoint") {
return model.DevFileType{
return model.DevfileType{
Name: "fake",
}, nil
} else if strings.Contains(path, "java-springboot-basic") || strings.Contains(path, "springboot") || strings.Contains(path, "spring-boot-root-component") {
return model.DevFileType{
return model.DevfileType{
Name: "java-springboot-basic",
}, nil
} else if strings.Contains(path, "devfile-sample-nodejs-basic") {
return model.DevFileType{
return model.DevfileType{
Name: "nodejs-basic",
}, nil
} else if strings.Contains(path, "python-basic") || strings.Contains(path, "python-src-none") || strings.Contains(path, "python-src-docker") {
return model.DevFileType{
return model.DevfileType{
Name: "python-basic",
}, nil
} else if strings.Contains(path, "nodejs-no-dockerfile") || strings.Contains(path, "dockerfile-node-sample") {
return model.DevFileType{
return model.DevfileType{
Name: "nodejs-basic",
Language: "JavaScript",
ProjectType: "Node.js",
Expand All @@ -264,5 +264,5 @@ func (a MockAlizerClient) SelectDevFileFromTypes(path string, devFileTypes []mod
}, nil
}

return model.DevFileType{}, nil
return model.DevfileType{}, nil
}
10 changes: 5 additions & 5 deletions cdq-analysis/pkg/detect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ func TestSelectDevfileFromTypes(t *testing.T) {
name string
clonePath string
repo string
devfileTypes []model.DevFileType
devfileTypes []model.DevfileType
wantErr bool
wantDevfileType model.DevFileType
wantDevfileType model.DevfileType
}{
{
name: "Successfully detect a devfile from the registry",
clonePath: "/tmp/test-selected-devfile",
repo: "https://github.com/maysunfaisal/devfile-sample-java-springboot-basic-1",
devfileTypes: []model.DevFileType{
devfileTypes: []model.DevfileType{
{
Name: "nodejs-basic", Language: "JavaScript", ProjectType: "Node.js", Tags: []string{"Node.js", "Express"},
},
Expand All @@ -167,15 +167,15 @@ func TestSelectDevfileFromTypes(t *testing.T) {
},
},
wantErr: false,
wantDevfileType: model.DevFileType{
wantDevfileType: model.DevfileType{
Name: "java-springboot-basic", Language: "Java", ProjectType: "springboot", Tags: []string{"Java", "Spring"},
},
},
{
name: "Unable to detect a devfile from the registry",
clonePath: "/tmp/test-no-devfiles-selected",
repo: "https://github.com/maysunfaisal/devfile-sample-java-springboot-basic-1",
devfileTypes: []model.DevFileType{
devfileTypes: []model.DevfileType{
{
Name: "python-basic", Language: "Python", ProjectType: "Python", Tags: []string{"Python", "Pip", "Flask"},
},
Expand Down
6 changes: 3 additions & 3 deletions cdq-analysis/pkg/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ func IsExist(path string) (bool, error) {
}

// getAlizerDevfileTypes gets the Alizer devfile types for a specified registry
func getAlizerDevfileTypes(registryURL string) ([]model.DevFileType, error) {
types := []model.DevFileType{}
func getAlizerDevfileTypes(registryURL string) ([]model.DevfileType, error) {
types := []model.DevfileType{}
registryIndex, err := registryLibrary.GetRegistryIndex(registryURL, registryLibrary.RegistryOptions{
Telemetry: registryLibrary.TelemetryData{},
}, schema.SampleDevfileType)
Expand All @@ -183,7 +183,7 @@ func getAlizerDevfileTypes(registryURL string) ([]model.DevFileType, error) {
}

for _, index := range registryIndex {
types = append(types, model.DevFileType{
types = append(types, model.DevfileType{
Name: index.Name,
Language: index.Language,
ProjectType: index.ProjectType,
Expand Down
4 changes: 2 additions & 2 deletions cdq-analysis/pkg/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,13 @@ func TestGetAlizerDevfileTypes(t *testing.T) {
tests := []struct {
name string
url string
wantTypes []model.DevFileType
wantTypes []model.DevfileType
wantErr bool
}{
{
name: "Get the Sample Devfile Types",
url: "http://" + serverIP,
wantTypes: []model.DevFileType{
wantTypes: []model.DevfileType{
{
Name: "sampleindex1",
ProjectType: "project1",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ require (
github.com/containerd/containerd v1.6.20 // indirect
github.com/containerd/typeurl v1.0.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/devfile/alizer v1.1.1-1.18b // indirect
github.com/devfile/alizer v1.1.6-0.20230921110335-93b0fab2bfe0 // indirect
github.com/devfile/registry-support/index/generator v0.0.0-20221018203505-df96d34d4273 // indirect
github.com/devfile/registry-support/registry-library v0.0.0-20221018213054-47b3ffaeadba // indirect
github.com/distribution/distribution/v3 v3.0.0-20211118083504-a29a3c99a684 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0=
github.com/devfile/alizer v1.1.1-1.18b h1:2mBYBBT+JHziuzB/SJ8A0uomnaJPe55D+6xE69TZPY8=
github.com/devfile/alizer v1.1.1-1.18b/go.mod h1:TgiLIIbOjrchs2DYD/L9369g4BLz3e0Offm2gIr154c=
github.com/devfile/alizer v1.1.6-0.20230921110335-93b0fab2bfe0 h1:mBKJiQGeqw0BL8f1E1HNM18xX4KPSYwQ4DbFD+5NWZ0=
github.com/devfile/alizer v1.1.6-0.20230921110335-93b0fab2bfe0/go.mod h1:bbmpezGJe/lSqoYcTZSHTJMQaBYapOF/OsVWsqsEcBA=
github.com/devfile/api/v2 v2.0.0-20211021164004-dabee4e633ed/go.mod h1:d99eTN6QxgzihOOFyOZA+VpUyD4Q1pYRYHZ/ci9J96Q=
github.com/devfile/api/v2 v2.0.0-20220117162434-6e6e6a8bc14c/go.mod h1:d99eTN6QxgzihOOFyOZA+VpUyD4Q1pYRYHZ/ci9J96Q=
github.com/devfile/api/v2 v2.2.0/go.mod h1:dN7xFrOVG+iPqn4UKGibXLd5oVsdE8XyK9OEb5JL3aI=
Expand Down

0 comments on commit a19abf7

Please sign in to comment.