mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Go: Bump github.com/devfile/alizer from 1.0.1 to 1.2.1 (#7126)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Armel Soro <asoro@redhat.com>
This commit is contained in:
@@ -30,13 +30,13 @@ func NewAlizerClient(registryClient registry.Client) *Alizer {
|
||||
// DetectFramework uses the alizer library in order to detect the devfile
|
||||
// to use depending on the files in the path
|
||||
func (o *Alizer) DetectFramework(ctx context.Context, path string) (DetectedFramework, error) {
|
||||
types := []model.DevFileType{}
|
||||
types := []model.DevfileType{}
|
||||
components, err := o.registryClient.ListDevfileStacks(ctx, "", "", "", false, false)
|
||||
if err != nil {
|
||||
return DetectedFramework{}, err
|
||||
}
|
||||
for _, component := range components.Items {
|
||||
types = append(types, model.DevFileType{
|
||||
types = append(types, model.DevfileType{
|
||||
Name: component.Name,
|
||||
Language: component.Language,
|
||||
ProjectType: component.ProjectType,
|
||||
@@ -144,7 +144,7 @@ func (o *Alizer) DetectPorts(path string) ([]int, error) {
|
||||
return components[0].Ports, nil
|
||||
}
|
||||
|
||||
func NewDetectionResult(typ model.DevFileType, registry api.Registry, appPorts []int, devfileVersion, name string) *api.DetectionResult {
|
||||
func NewDetectionResult(typ model.DevfileType, registry api.Registry, appPorts []int, devfileVersion, name string) *api.DetectionResult {
|
||||
return &api.DetectionResult{
|
||||
Devfile: typ.Name,
|
||||
DevfileRegistry: registry.Name,
|
||||
|
||||
@@ -4,11 +4,12 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/devfile/alizer/pkg/apis/model"
|
||||
|
||||
"github.com/redhat-developer/odo/pkg/api"
|
||||
)
|
||||
|
||||
type DetectedFramework struct {
|
||||
Type model.DevFileType
|
||||
Type model.DevfileType
|
||||
DefaultVersion string
|
||||
Registry api.Registry
|
||||
Architectures []string
|
||||
|
||||
@@ -95,7 +95,7 @@ func TestAlizerBackend_SelectDevfile(t *testing.T) {
|
||||
alizerClient: func(ctrl *gomock.Controller) alizer.Client {
|
||||
alizerClient := alizer.NewMockClient(ctrl)
|
||||
alizerClient.EXPECT().DetectFramework(gomock.Any(), gomock.Any()).Return(alizer.DetectedFramework{
|
||||
Type: model.DevFileType{
|
||||
Type: model.DevfileType{
|
||||
Name: "a-devfile-name",
|
||||
},
|
||||
DefaultVersion: "1.0.0",
|
||||
@@ -124,7 +124,7 @@ func TestAlizerBackend_SelectDevfile(t *testing.T) {
|
||||
alizerClient: func(ctrl *gomock.Controller) alizer.Client {
|
||||
alizerClient := alizer.NewMockClient(ctrl)
|
||||
alizerClient.EXPECT().DetectFramework(gomock.Any(), gomock.Any()).Return(alizer.DetectedFramework{
|
||||
Type: model.DevFileType{
|
||||
Type: model.DevfileType{
|
||||
Name: "a-devfile-name",
|
||||
},
|
||||
DefaultVersion: "1.0.0",
|
||||
@@ -178,7 +178,7 @@ func TestAlizerBackend_SelectDevfile(t *testing.T) {
|
||||
alizerClient: func(ctrl *gomock.Controller) alizer.Client {
|
||||
alizerClient := alizer.NewMockClient(ctrl)
|
||||
alizerClient.EXPECT().DetectFramework(gomock.Any(), gomock.Any()).Return(alizer.DetectedFramework{
|
||||
Type: model.DevFileType{
|
||||
Type: model.DevfileType{
|
||||
Name: "a-devfile-name",
|
||||
},
|
||||
DefaultVersion: "1.0.0",
|
||||
|
||||
@@ -3,6 +3,7 @@ package alizer
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/redhat-developer/odo/pkg/alizer"
|
||||
"github.com/redhat-developer/odo/pkg/api"
|
||||
@@ -56,7 +57,8 @@ func (o *AlizerOptions) RunForJsonOutput(ctx context.Context) (out interface{},
|
||||
workingDir := odocontext.GetWorkingDirectory(ctx)
|
||||
detected, err := o.clientset.AlizerClient.DetectFramework(ctx, workingDir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
//revive:disable:error-strings This is a top-level error message displayed as is to the end user
|
||||
return nil, fmt.Errorf("No valid devfile found for project in %s: %w", workingDir, err)
|
||||
}
|
||||
appPorts, err := o.clientset.AlizerClient.DetectPorts(workingDir)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user