diff --git a/docs/website/docs/command-reference/docs-mdx/init/registry_list_output.mdx b/docs/website/docs/command-reference/docs-mdx/init/registry_list_output.mdx index 7767a3ca1a7..1b550e716c6 100644 --- a/docs/website/docs/command-reference/docs-mdx/init/registry_list_output.mdx +++ b/docs/website/docs/command-reference/docs-mdx/init/registry_list_output.mdx @@ -1,6 +1,6 @@ ```console $ odo registry --devfile nodejs-react - NAME REGISTRY DESCRIPTION VERSIONS - nodejs-react StagingRegistry React is a free and open-source front-en... 2.0.2, 2.1.0, 2.2.0 - nodejs-react DefaultDevfileRegistry React is a free and open-source front-en... 2.0.2, 2.1.0, 2.2.0 + NAME REGISTRY DESCRIPTION ARCHITECTURES VERSIONS + nodejs-react StagingRegistry React is a free and open-source front-en... 2.0.2, 2.1.0, 2.2.0 + nodejs-react DefaultDevfileRegistry React is a free and open-source front-en... 2.0.2, 2.1.0, 2.2.0 ``` \ No newline at end of file diff --git a/docs/website/docs/command-reference/json-output.md b/docs/website/docs/command-reference/json-output.md index 29b4fcbe0ae..453f91b746c 100644 --- a/docs/website/docs/command-reference/json-output.md +++ b/docs/website/docs/command-reference/json-output.md @@ -368,56 +368,45 @@ odo registry -o json ```json [ { - "name": "python", - "displayName": "Python", - "description": "Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.", + "name": "java-openliberty", + "displayName": "Open Liberty Maven", + "description": "Java application based on Java 11 and Maven 3.8, using the Open Liberty runtime 22.0.0.1", "registry": { "name": "DefaultDevfileRegistry", "url": "https://registry.devfile.io", "secure": false }, - "language": "Python", + "language": "Java", "tags": [ - "Python", - "Pip", - "Flask" + "Java", + "Maven" ], - "projectType": "Python", - "version": "2.1.0", + "projectType": "Open Liberty", + "version": "0.9.0", "versions": [ { - "version": "2.1.0", + "version": "0.9.0", "isDefault": true, "schemaVersion": "2.1.0", "starterProjects": [ - "flask-example" + "rest" ], "commandGroups": { - "build": true, - "debug": true, - "deploy": false, - "run": true, - "test": false - } - }, - { - "version": "3.0.0", - "isDefault": false, - "schemaVersion": "2.2.0", - "starterProjects": [ - "flask-example" - ], - "commandGroups": { - "build": true, - "debug": true, - "deploy": false, - "run": true, - "test": false + "build": false, + "debug": true, + "deploy": false, + "run": true, + "test": true } } ], "starterProjects": [ - "flask-example" + "rest" + ], + "architectures": [ + "amd64", + "ppc64le", + "s390x" ] }, [...] diff --git a/docs/website/docs/command-reference/registry.md b/docs/website/docs/command-reference/registry.md index 70b543f5032..e8a4fb1df6e 100644 --- a/docs/website/docs/command-reference/registry.md +++ b/docs/website/docs/command-reference/registry.md @@ -16,9 +16,11 @@ These flags let you filter the listed Devfile stacks: * `--devfile ` to list the Devfile stacks with this exact name * `--devfile-registry ` to list the Devfile stack of this registry (this is the `name` used when adding the registry to the preferences with `odo preference add registry `) -* `--filter ` to list the Devfile for which the term is found in the devfile name or description +* `--filter ` to list the Devfile for which the term is found in the devfile name, description or supported architectures -By default, the name, registry, description and versions of the Devfile stacks are displayed on a table. +By default, the name, registry, description, supported architectures, and versions of the Devfile stacks are displayed on a table. + +Note that Devfile stacks with no architectures are supposed to be compatible with **all** architectures. The flags below let you change the content of the output: @@ -48,18 +50,20 @@ odo registry Example ```console -$ odo registry - NAME REGISTRY DESCRIPTION VERSIONS - dotnet50 Staging Stack with .NET 5.0 1.0.3 - dotnet50 DefaultDevfileRegistry Stack with .NET 5.0 1.0.3 - dotnet60 Staging Stack with .NET 6.0 1.0.2 - dotnet60 DefaultDevfileRegistry Stack with .NET 6.0 1.0.2 - dotnetcore31 Staging Stack with .NET Core 3.1 1.0.3 - dotnetcore31 DefaultDevfileRegistry Stack with .NET Core 3.1 1.0.3 - go Staging Go is an open source programming languag... 1.0.2, 2.0.0 - go DefaultDevfileRegistry Go is an open source programming languag... 1.0.2, 2.0.0 - java-maven Staging Upstream Maven and OpenJDK 11 1.2.0 - java-maven DefaultDevfileRegistry Upstream Maven and OpenJDK 11 1.2.0 +$ odo registry + NAME REGISTRY DESCRIPTION ARCHITECTURES VERSIONS + dotnet50 Staging .NET 5.0 application 1.0.3 + dotnet50 DefaultDevfileRegistry .NET 5.0 application 1.0.3 + dotnet60 Staging .NET 6.0 application 1.0.2 + dotnet60 DefaultDevfileRegistry .NET 6.0 application 1.0.2 + dotnetcore31 Staging .NET Core 3.1 application 1.0.3 + dotnetcore31 DefaultDevfileRegistry .NET Core 3.1 application 1.0.3 + go Staging Go is an open source programming languag... 1.0.2, 1.1.0, 2.0.0, 2.1.0 + go DefaultDevfileRegistry Go is an open source programming languag... 1.0.2, 1.1.0, 2.0.0, 2.1.0 + java-maven Staging Java application based on Maven 3.6 and ... 1.2.0 + java-maven DefaultDevfileRegistry Java application based on Maven 3.6 and ... 1.2.0 + java-openliberty Staging Java application based on Java 11 and Ma... amd64, ppc64le, s390x 0.9.0 + java-openliberty DefaultDevfileRegistry Java application based on Java 11 and Ma... amd64, ppc64le, s390x 0.9.0 [...] ``` @@ -76,12 +80,13 @@ odo registry --devfile-registry ```console $ odo registry --devfile-registry Staging - NAME REGISTRY DESCRIPTION VERSIONS - dotnet50 Staging Stack with .NET 5.0 1.0.3 - dotnet60 Staging Stack with .NET 6.0 1.0.2 - dotnetcore31 Staging Stack with .NET Core 3.1 1.0.3 - go Staging Go is an open source programming languag... 1.0.2, 2.0.0 - java-maven Staging Upstream Maven and OpenJDK 11 1.2.0 + NAME REGISTRY DESCRIPTION ARCHITECTURES VERSIONS + dotnet50 Staging .NET 5.0 application 1.0.3 + dotnet60 Staging .NET 6.0 application 1.0.2 + dotnetcore31 Staging .NET Core 3.1 application 1.0.3 + go Staging Go is an open source programming languag... 1.0.2, 1.1.0, 2.0.0, 2.1.0 + java-maven Staging Java application based on Maven 3.6 and ... 1.2.0 + java-openliberty Staging Java application based on Java 11 and Ma... amd64, ppc64le, s390x 0.9.0 [...] ``` @@ -119,24 +124,28 @@ odo registry --devfile --devfile-registry --details Example ```console -$ odo registry --devfile java-maven --devfile-registry Staging --details -Name: java-maven -Display Name: Maven Java +$ odo registry list --devfile-registry Staging --devfile java-openliberty --details +Name: java-openliberty +Display Name: Open Liberty Maven Registry: Staging Registry URL: https://registry.stage.devfile.io -Version: 1.2.0 -Description: Upstream Maven and OpenJDK 11 +Version: 0.9.0 +Description: Java application based on Java 11 and Maven 3.8, using the Open Liberty runtime 22.0.0.1 Tags: Java, Maven -Project Type: Maven +Project Type: Open Liberty Language: Java Starter Projects: - - springbootproject + - rest Supported odo Features: - Dev: Y - Deploy: N - Debug: Y +Architectures: + - amd64 + - ppc64le + - s390x Versions: - - 1.2.0 + - 0.9.0 ``` diff --git a/docs/website/docs/user-guides/quickstart/quickstart.md b/docs/website/docs/user-guides/quickstart/quickstart.md index 0114101d223..15a0373e2a5 100644 --- a/docs/website/docs/user-guides/quickstart/quickstart.md +++ b/docs/website/docs/user-guides/quickstart/quickstart.md @@ -17,32 +17,33 @@ A full list of example applications can be viewed with the `odo registry` comman Example ```shell -$ odo registry - NAME REGISTRY DESCRIPTION VERSIONS - dotnet50 DefaultDevfileRegistry Stack with .NET 5.0 1.0.3 - dotnet60 DefaultDevfileRegistry Stack with .NET 6.0 1.0.2 - dotnetcore31 DefaultDevfileRegistry Stack with .NET Core 3.1 1.0.3 - go DefaultDevfileRegistry Go is an open source programming languag... 1.0.2, 2.0.0 - java-maven DefaultDevfileRegistry Upstream Maven and OpenJDK 11 1.2.0 - java-openliberty DefaultDevfileRegistry Java application Maven-built stack using... 0.9.0 - java-openliberty-gradle DefaultDevfileRegistry Java application Gradle-built stack usin... 0.4.0 - java-quarkus DefaultDevfileRegistry Quarkus with Java 1.3.0 - java-springboot DefaultDevfileRegistry Spring Boot using Java 1.2.0, 2.0.0 - java-vertx DefaultDevfileRegistry Upstream Vert.x using Java 1.2.0 - java-websphereliberty DefaultDevfileRegistry Java application Maven-built stack using... 0.9.0 - java-websphereliberty-gradle DefaultDevfileRegistry Java application Gradle-built stack usin... 0.4.0 - java-wildfly DefaultDevfileRegistry Upstream WildFly 1.1.0 - java-wildfly-bootable-jar DefaultDevfileRegistry Java stack with WildFly in bootable Jar ... 1.1.0 - nodejs DefaultDevfileRegistry Stack with Node.js 16 2.1.1 - nodejs-angular DefaultDevfileRegistry Angular is a development platform, built... 2.0.2 - nodejs-nextjs DefaultDevfileRegistry Next.js gives you the best developer exp... 1.0.3 - nodejs-nuxtjs DefaultDevfileRegistry Nuxt is the backbone of your Vue.js proj... 1.0.3 - nodejs-react DefaultDevfileRegistry React is a free and open-source front-en... 2.0.2 - nodejs-svelte DefaultDevfileRegistry Svelte is a radical new approach to buil... 1.0.3 - nodejs-vue DefaultDevfileRegistry Vue is a JavaScript framework for buildi... 1.0.2 - php-laravel DefaultDevfileRegistry Laravel is an open-source PHP framework,... 1.0.1 - python DefaultDevfileRegistry Python is an interpreted, object-oriente... 2.1.0, 3.0.0 - python-django DefaultDevfileRegistry Django is a high-level Python web framew... 2.1.0 +$ odo registry + NAME REGISTRY DESCRIPTION ARCHITECTURES VERSIONS + dotnet50 DefaultDevfileRegistry .NET 5.0 application 1.0.3 + dotnet60 DefaultDevfileRegistry .NET 6.0 application 1.0.2 + dotnetcore31 DefaultDevfileRegistry .NET Core 3.1 application 1.0.3 + go DefaultDevfileRegistry Go is an open source programming languag... 1.0.2, 1.1.0, 2.0.0, 2.1.0 + java-maven DefaultDevfileRegistry Java application based on Maven 3.6 and ... 1.2.0 + java-openliberty DefaultDevfileRegistry Java application based on Java 11 and Ma... amd64, ppc64le, s390x 0.9.0 + java-openliberty-gradle DefaultDevfileRegistry Java application based on Java 11, Gradl... amd64, ppc64le, s390x 0.4.0 + java-quarkus DefaultDevfileRegistry Java application using Quarkus and OpenJ... 1.3.0 + java-springboot DefaultDevfileRegistry Spring Boot using Java 1.2.0, 2.0.0 + java-vertx DefaultDevfileRegistry Java application using Vert.x and OpenJD... 1.2.0 + java-websphereliberty DefaultDevfileRegistry Java application based Java 11 and Maven... amd64, ppc64le, s390x 0.9.0 + java-websphereliberty-gradle DefaultDevfileRegistry Java application based on Java 11 and Gr... amd64, ppc64le, s390x 0.4.0 + java-wildfly DefaultDevfileRegistry Java application based on Java 11, using... 1.1.0 + java-wildfly-bootable-jar DefaultDevfileRegistry Java application using WildFly in bootab... 1.1.0 + nodejs DefaultDevfileRegistry Node.js application 2.1.1, 2.2.0 + nodejs-angular DefaultDevfileRegistry Angular is a development platform, built... 2.0.2, 2.1.0, 2.2.0 + nodejs-nextjs DefaultDevfileRegistry Next.js gives you the best developer exp... 1.0.3, 1.1.0, 1.2.0 + nodejs-nuxtjs DefaultDevfileRegistry Nuxt is the backbone of your Vue.js proj... 1.0.3, 1.1.0, 1.2.0 + nodejs-react DefaultDevfileRegistry React is a free and open-source front-en... 2.0.2, 2.1.0, 2.2.0 + nodejs-svelte DefaultDevfileRegistry Svelte is a radical new approach to buil... 1.0.3, 1.1.0, 1.2.0 + nodejs-vue DefaultDevfileRegistry Vue is a JavaScript framework for buildi... 1.0.2, 1.1.0, 1.2.0 + php-laravel DefaultDevfileRegistry Laravel is an open-source PHP framework,... 1.0.1, 2.0.0 + python DefaultDevfileRegistry Python is an interpreted, object-oriente... 2.1.0, 3.0.0 + python-django DefaultDevfileRegistry Django is a high-level Python web framew... 2.1.0 + udi DefaultDevfileRegistry Universal Developer Image provides vario... 1.0.0 ``` diff --git a/pkg/api/registry.go b/pkg/api/registry.go index 8d22b4dda4b..677231b9abd 100644 --- a/pkg/api/registry.go +++ b/pkg/api/registry.go @@ -1,7 +1,7 @@ package api import ( - schema "github.com/devfile/registry-support/index/generator/schema" + "github.com/devfile/registry-support/index/generator/schema" ) // Registry is the main struct of devfile registry @@ -33,6 +33,7 @@ type DevfileStack struct { // Deprecated. Use Versions.StarterProjects instead. DefaultStarterProjects []string `json:"starterProjects"` DevfileData *DevfileData `json:"devfileData,omitempty"` + Architectures []string `json:"architectures,omitempty"` } type DevfileStackVersion struct { diff --git a/pkg/odo/cli/registry/registry.go b/pkg/odo/cli/registry/registry.go index 1743d29abee..8f37cb6d6da 100644 --- a/pkg/odo/cli/registry/registry.go +++ b/pkg/odo/cli/registry/registry.go @@ -32,6 +32,9 @@ var Example = ` # Get all devfile components # Filter by name and devfile registry %[1]s --filter nodejs --devfile-registry DefaultDevfileRegistry +# Filter by architecture +%[1]s --filter amd64 + # Show more details from a specific devfile %[1]s --details --devfile nodejs @@ -117,7 +120,7 @@ func NewCmdRegistry(name, fullName string, testClientset clientset.Clientset) *c clientset.Add(listCmd, clientset.REGISTRY) // Flags - listCmd.Flags().StringVar(&o.filterFlag, "filter", "", "Filter based on the name or description of the component") + listCmd.Flags().StringVar(&o.filterFlag, "filter", "", "Filter based on the name or description or supported architecture of the component") listCmd.Flags().StringVar(&o.devfileFlag, "devfile", "", "Only the specific Devfile component") listCmd.Flags().StringVar(&o.registryFlag, "devfile-registry", "", "Only show components from the specific Devfile registry") listCmd.Flags().BoolVar(&o.detailsFlag, "details", false, "Show details of a Devfile, to be used only with --devfile") @@ -158,7 +161,7 @@ func (o *ListOptions) printDevfileList(DevfileList []api.DevfileStack) { }) t.SetOutputMirror(log.GetStdout()) - t.AppendHeader(table.Row{"NAME", "REGISTRY", "DESCRIPTION", "VERSIONS"}) + t.AppendHeader(table.Row{"NAME", "REGISTRY", "DESCRIPTION", "ARCHITECTURES", "VERSIONS"}) for _, devfileComponent := range DevfileList { // Mark the name as yellow in the index so it's easier to see. @@ -195,6 +198,14 @@ func (o *ListOptions) printDevfileList(DevfileList []api.DevfileStack) { return } + var archs string + if len(devfileComponent.Architectures) != 0 { + archs = fmt.Sprintf(`%s: + - %s`, + log.Sbold("Architectures"), + strings.Join(devfileComponent.Architectures, "\n - ")+"\n") + } + // Output the details of the component fmt.Printf(`%s: %s %s: %s @@ -211,9 +222,9 @@ func (o *ListOptions) printDevfileList(DevfileList []api.DevfileStack) { - Dev: %s - Deploy: %s - Debug: %s -%s: +%s%s: - %s -%s`, +`, log.Sbold("Name"), name, log.Sbold("Display Name"), devfileComponent.DisplayName, log.Sbold("Registry"), devfileComponent.Registry.Name, @@ -229,15 +240,17 @@ func (o *ListOptions) printDevfileList(DevfileList []api.DevfileStack) { boolToYesNo(defaultVersionDetails.CommandGroups[schema.RunCommandGroupKind]), boolToYesNo(defaultVersionDetails.CommandGroups[schema.DeployCommandGroupKind]), boolToYesNo(defaultVersionDetails.CommandGroups[schema.DebugCommandGroupKind]), + archs, log.Sbold("Versions"), strings.Join(vList, "\n - "), - "\n") + ) } else { // Create a simplified row only showing the name, registry and description and versions t.AppendRow(table.Row{ name, devfileComponent.Registry.Name, util.TruncateString(devfileComponent.Description, 40, "..."), + strings.Join(devfileComponent.Architectures, ", "), strings.Join(vList, ", "), }) } diff --git a/pkg/registry/registry.go b/pkg/registry/registry.go index 4194a41a883..e385ce80367 100644 --- a/pkg/registry/registry.go +++ b/pkg/registry/registry.go @@ -12,6 +12,7 @@ import ( "github.com/blang/semver" devfilev1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2" + apidevfile "github.com/devfile/api/v2/pkg/devfile" dfutil "github.com/devfile/library/v2/pkg/util" indexSchema "github.com/devfile/registry-support/index/generator/schema" "github.com/devfile/registry-support/registry-library/library" @@ -288,7 +289,25 @@ func (o RegistryClient) ListDevfileStacks(ctx context.Context, registryName, dev devfile.Registry.Priority = priorityNumber if filterFlag != "" { - if !strings.Contains(devfile.Name, filterFlag) && !strings.Contains(devfile.Description, filterFlag) { + archs := append(make([]string, 0, len(devfile.Architectures)), devfile.Architectures...) + if len(archs) == 0 { + // Devfiles with no architectures are compatible with all architectures. + archs = append(archs, + string(apidevfile.AMD64), + string(apidevfile.ARM64), + string(apidevfile.PPC64LE), + string(apidevfile.S390X), + ) + } + containsArch := func(s string) bool { + for _, arch := range archs { + if strings.Contains(arch, s) { + return true + } + } + return false + } + if !strings.Contains(devfile.Name, filterFlag) && !strings.Contains(devfile.Description, filterFlag) && !containsArch(filterFlag) { continue } } @@ -366,6 +385,7 @@ func createRegistryDevfiles(registry api.Registry, devfileIndex []indexSchema.Sc ProjectType: devfileIndexEntry.ProjectType, DefaultStarterProjects: devfileIndexEntry.StarterProjects, DefaultVersion: devfileIndexEntry.Version, + Architectures: devfileIndexEntry.Architectures, } for _, v := range devfileIndexEntry.Versions { if v.Default { diff --git a/pkg/registry/registry_test.go b/pkg/registry/registry_test.go index a2524739089..6c276b41c69 100644 --- a/pkg/registry/registry_test.go +++ b/pkg/registry/registry_test.go @@ -208,6 +208,11 @@ func TestListDevfileStacks(t *testing.T) { "Python", "pip" ], + "architectures": [ + "amd64", + "ppc64le", + "s390x" + ], "language": "python", "icon": "/images/foobar.svg", "globalMemoryLimit": "2686Mi", @@ -264,8 +269,9 @@ func TestListDevfileStacks(t *testing.T) { Name: registryName, URL: server.URL, }, - Language: "python", - Tags: []string{"Python", "pip"}, + Language: "python", + Tags: []string{"Python", "pip"}, + Architectures: []string{"amd64", "ppc64le", "s390x"}, }, }, }, @@ -318,8 +324,64 @@ func TestListDevfileStacks(t *testing.T) { Name: registryName, URL: server.URL, }, - Language: "python", - Tags: []string{"Python", "pip"}, + Language: "python", + Tags: []string{"Python", "pip"}, + Architectures: []string{"amd64", "ppc64le", "s390x"}, + }, + }, + }, + }, + { + name: "Case 3.2: Test getting a devfile using a filter from the architectures", + registryName: "TestRegistry", + filter: "s390", + want: DevfileStackList{ + DevfileRegistries: []api.Registry{ + { + Name: "TestRegistry", + URL: server.URL, + Secure: false, + }, + }, + Items: []api.DevfileStack{ + // Devfiles with no architectures are supposed to be compatible with all architectures, + // so s390 will match an existing valid architecture (s390x). + { + Name: "nodejs", + DisplayName: "NodeJS Angular Web Application", + Description: "Stack for developing NodeJS Angular Web Application", + Registry: api.Registry{ + Name: registryName, + URL: server.URL, + }, + Language: "nodejs", + Tags: []string{"NodeJS", "Angular", "Alpine"}, + }, + { + Name: "python", + DisplayName: "Python", + Description: "Python Stack with Python 3.7", + Registry: api.Registry{ + Name: registryName, + URL: server.URL, + }, + Language: "python", + Tags: []string{"Python", "pip"}, + Architectures: []string{"amd64", "ppc64le", "s390x"}, + }, + }, + }, + }, + { + name: "Case 3.3: Test getting a devfile using a filter not matching name, description or architectures", + registryName: "TestRegistry", + filter: "some-random-string", + want: DevfileStackList{ + DevfileRegistries: []api.Registry{ + { + Name: "TestRegistry", + URL: server.URL, + Secure: false, }, }, }, @@ -378,63 +440,132 @@ func TestGetRegistryDevfiles(t *testing.T) { "links": { "self": "/devfiles/angular/devfile.yaml" } + }, + { + "name": "python", + "displayName": "Python Application", + "description": "Stack for developing a Python Web Application", + "version": "2.3.4", + "tags": ["Python"], + "language": "python", + "architectures": [ + "amd64", + "ppc64le" + ], + "links": { + "self": "/devfiles/python/devfile.yaml" + } } ] ` v2IndexResponse = ` [ { - "name": "go", - "displayName": "Go Runtime", - "description": "Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.", - "type": "stack", - "tags": [ - "Go" - ], - "icon": "https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg", - "projectType": "Go", - "language": "Go", - "provider": "Red Hat", - "versions": [ - { - "version": "2.0.0", - "schemaVersion": "2.2.0", - "description": "Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.", - "tags": [ - "Go" - ], - "icon": "https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg", - "links": { - "self": "devfile-catalog/go:2.0.0" - }, - "resources": [ - "devfile.yaml" - ], - "starterProjects": [ - "go-starter" - ] - }, - { - "version": "1.0.2", - "schemaVersion": "2.1.0", - "default": true, - "description": "Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.", - "tags": [ - "Go" - ], - "icon": "https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg", - "links": { - "self": "devfile-catalog/go:1.0.2" - }, - "resources": [ - "devfile.yaml" - ], - "starterProjects": [ - "go-starter" - ] - } - ] - } + "name": "go", + "displayName": "Go Runtime", + "description": "Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.", + "type": "stack", + "tags": [ + "Go" + ], + "icon": "https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg", + "projectType": "Go", + "language": "Go", + "provider": "Red Hat", + "versions": [ + { + "version": "2.0.0", + "schemaVersion": "2.2.0", + "description": "Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.", + "tags": [ + "Go" + ], + "icon": "https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg", + "links": { + "self": "devfile-catalog/go:2.0.0" + }, + "resources": [ + "devfile.yaml" + ], + "starterProjects": [ + "go-starter" + ] + }, + { + "version": "1.0.2", + "schemaVersion": "2.1.0", + "default": true, + "description": "Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.", + "tags": [ + "Go" + ], + "icon": "https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg", + "links": { + "self": "devfile-catalog/go:1.0.2" + }, + "resources": [ + "devfile.yaml" + ], + "starterProjects": [ + "go-starter" + ] + } + ] + }, + { + "name": "python", + "displayName": "Python Application", + "description": "Python Stack", + "type": "stack", + "tags": [ + "Python" + ], + "architectures": [ + "amd64", + "ppc64le" + ], + "projectType": "Python", + "language": "Python", + "versions": [ + { + "version": "2.3.4", + "schemaVersion": "2.2.0", + "description": "Python stack.", + "tags": [ + "Python" + ], + "icon": "https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/python.svg", + "links": { + "self": "devfile-catalog/python:2.0.0" + }, + "resources": [ + "devfile.yaml" + ], + "starterProjects": [ + "python-starter" + ] + }, + { + "version": "1.2.3", + "schemaVersion": "2.1.0", + "default": true, + "description": "Python stack.", + "tags": [ + "Python" + ], + "icon": "https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/python.svg", + "links": { + "self": "devfile-catalog/python:2.0.0" + }, + "resources": [ + "devfile.yaml" + ], + "starterProjects": [ + "python-starter" + ] + } + ] + } ] ` ) @@ -520,6 +651,16 @@ func TestGetRegistryDevfiles(t *testing.T) { Tags: []string{"NodeJS", "Angular", "Alpine"}, DefaultVersion: "1.2.3", }, + { + Name: "python", + DisplayName: "Python Application", + Description: "Stack for developing a Python Web Application", + Registry: api.Registry{Name: registryName, URL: registryUrl}, + Language: "python", + Tags: []string{"Python"}, + Architectures: []string{"amd64", "ppc64le"}, + DefaultVersion: "2.3.4", + }, } }, }, @@ -555,6 +696,22 @@ func TestGetRegistryDevfiles(t *testing.T) { {Version: "2.0.0", IsDefault: false, SchemaVersion: "2.2.0", StarterProjects: []string{"go-starter"}}, }, }, + { + Name: "python", + DisplayName: "Python Application", + Description: "Python Stack", + Registry: api.Registry{Name: registryName, URL: registryUrl}, + Language: "Python", + ProjectType: "Python", + Tags: []string{"Python"}, + DefaultVersion: "1.2.3", + DefaultStarterProjects: []string{"python-starter"}, + Versions: []api.DevfileStackVersion{ + {Version: "1.2.3", IsDefault: true, SchemaVersion: "2.1.0", StarterProjects: []string{"python-starter"}}, + {Version: "2.3.4", IsDefault: false, SchemaVersion: "2.2.0", StarterProjects: []string{"python-starter"}}, + }, + Architectures: []string{"amd64", "ppc64le"}, + }, } }, }, @@ -597,6 +754,22 @@ func TestGetRegistryDevfiles(t *testing.T) { {Version: "2.0.0", IsDefault: false, SchemaVersion: "2.2.0", StarterProjects: []string{"go-starter"}}, }, }, + { + Name: "python", + DisplayName: "Python Application", + Description: "Python Stack", + Registry: api.Registry{Name: registryName, URL: registryUrl}, + Language: "Python", + ProjectType: "Python", + Tags: []string{"Python"}, + Architectures: []string{"amd64", "ppc64le"}, + DefaultVersion: "1.2.3", + DefaultStarterProjects: []string{"python-starter"}, + Versions: []api.DevfileStackVersion{ + {Version: "1.2.3", IsDefault: true, SchemaVersion: "2.1.0", StarterProjects: []string{"python-starter"}}, + {Version: "2.3.4", IsDefault: false, SchemaVersion: "2.2.0", StarterProjects: []string{"python-starter"}}, + }, + }, } }, }, diff --git a/tests/integration/cmd_devfile_registry_test.go b/tests/integration/cmd_devfile_registry_test.go index 3b30711e141..94ce0c2f746 100644 --- a/tests/integration/cmd_devfile_registry_test.go +++ b/tests/integration/cmd_devfile_registry_test.go @@ -79,6 +79,9 @@ var _ = Describe("odo devfile registry command tests", func() { Expect(output).Should(ContainSubstring(h + ":")) } }) + By("not displaying Architectures", func() { + Expect(output).ShouldNot(ContainSubstring("Architectures:")) + }) By("checking values", func() { helper.MatchAllInOutput(output, []string{"nodejs-starter", "JavaScript", "Node.js Runtime", "Dev: Y"}) }) @@ -94,6 +97,7 @@ var _ = Describe("odo devfile registry command tests", func() { helper.JsonPathContentContain(stdout, "0.description", "Node") helper.JsonPathContentContain(stdout, "0.language", "JavaScript") helper.JsonPathContentContain(stdout, "0.projectType", "Node.js") + helper.JsonPathDoesNotExist(stdout, "0.architectures") helper.JsonPathContentContain(stdout, "0.devfileData.devfile.metadata.name", "nodejs") helper.JsonPathContentContain(stdout, "0.devfileData.supportedOdoFeatures.dev", "true") helper.JsonPathContentContain(stdout, "0.versions.0.commandGroups.run", "true") @@ -113,15 +117,15 @@ var _ = Describe("odo devfile registry command tests", func() { }) }) - It("Should list python specifically", func() { - args := []string{"registry", "--devfile", "python", "--devfile-registry", "DefaultDevfileRegistry"} + It("Should list java-openliberty specifically", func() { + args := []string{"registry", "--devfile", "java-openliberty", "--devfile-registry", "DefaultDevfileRegistry"} By("using human readable output", func() { output := helper.Cmd("odo", args...).ShouldPass().Out() By("checking table header", func() { - helper.MatchAllInOutput(output, []string{"NAME", "REGISTRY", "DESCRIPTION", "VERSIONS"}) + helper.MatchAllInOutput(output, []string{"NAME", "REGISTRY", "DESCRIPTION", "ARCHITECTURES", "VERSIONS"}) }) By("checking table row", func() { - helper.MatchAllInOutput(output, []string{"python"}) + helper.MatchAllInOutput(output, []string{"java-openliberty"}) }) }) By("using JSON output", func() { @@ -130,16 +134,21 @@ var _ = Describe("odo devfile registry command tests", func() { stdout, stderr := res.Out(), res.Err() Expect(stderr).To(BeEmpty()) Expect(helper.IsJSON(stdout)).To(BeTrue()) - helper.JsonPathContentIs(stdout, "0.name", "python") - helper.JsonPathContentContain(stdout, "0.displayName", "Python") - helper.JsonPathContentContain(stdout, "0.description", "Python is an interpreted") - helper.JsonPathContentContain(stdout, "0.language", "Python") - helper.JsonPathContentContain(stdout, "0.projectType", "Python") + helper.JsonPathContentIs(stdout, "0.name", "java-openliberty") + helper.JsonPathContentContain(stdout, "0.displayName", "Open Liberty Maven") + helper.JsonPathContentContain(stdout, "0.description", "using the Open Liberty runtime") + helper.JsonPathContentContain(stdout, "0.language", "Java") + helper.JsonPathContentContain(stdout, "0.projectType", "Open Liberty") helper.JsonPathContentContain(stdout, "0.devfileData", "") + By("checking architectures", func() { + architectures := gjson.Get(stdout, "0.architectures").Array() + Expect(architectures).ShouldNot(BeEmpty()) + }) + defaultVersion := gjson.Get(stdout, "0.version").String() By("returning backward-compatible information linked to the default stack version", func() { - helper.JsonPathContentContain(stdout, "0.starterProjects.0", "flask-example") + helper.JsonPathContentContain(stdout, "0.starterProjects.0", "rest") Expect(defaultVersion).ShouldNot(BeEmpty()) }) By("returning a non-empty list of versions", func() {