From aa1efca97d7faf18818e518bcf6799943347d00c Mon Sep 17 00:00:00 2001 From: sk593 Date: Mon, 11 Sep 2023 15:57:47 -0700 Subject: [PATCH] address comments --- .../controller/createorupdateresource.go | 13 +++++++--- .../backend/controller/deleteresource.go | 6 ++--- pkg/portableresources/types.go | 15 +++-------- pkg/recipes/configloader/environment.go | 8 +++--- pkg/recipes/driver/bicep.go | 16 ++++++------ pkg/recipes/driver/terraform.go | 8 +++--- pkg/recipes/error.go | 6 ++--- pkg/recipes/error_test.go | 8 +++--- pkg/recipes/terraform/execute.go | 4 +-- pkg/recipes/util/deploymentStatus.go | 25 +++++++++++++++++++ pkg/rp/util/registry.go | 6 ++--- 11 files changed, 68 insertions(+), 47 deletions(-) create mode 100644 pkg/recipes/util/deploymentStatus.go diff --git a/pkg/portableresources/backend/controller/createorupdateresource.go b/pkg/portableresources/backend/controller/createorupdateresource.go index 1d2796285e..ace7167b3d 100644 --- a/pkg/portableresources/backend/controller/createorupdateresource.go +++ b/pkg/portableresources/backend/controller/createorupdateresource.go @@ -21,12 +21,12 @@ import ( "errors" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" - "github.com/radius-project/radius/pkg/portableresources" "github.com/radius-project/radius/pkg/portableresources/datamodel" "github.com/radius-project/radius/pkg/portableresources/processors" "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/recipes/configloader" "github.com/radius-project/radius/pkg/recipes/engine" + "github.com/radius-project/radius/pkg/recipes/util" rpv1 "github.com/radius-project/radius/pkg/rp/v1" "github.com/radius-project/radius/pkg/ucp/store" ) @@ -82,7 +82,7 @@ func (c *CreateOrUpdateResource[P, T]) Run(ctx context.Context, req *ctrl.Reques if err != nil { if recipeError, ok := err.(*recipes.RecipeError); ok { // Set the deployment status to the recipe error code. - recipeDataModel.Recipe().DeploymentStatus = portableresources.RecipeDeploymentStatus(recipeError.DeploymentStatus) + recipeDataModel.Recipe().DeploymentStatus = util.RecipeDeploymentStatus(recipeError.DeploymentStatus) update := &store.Object{ Metadata: store.Metadata{ ID: req.ResourceID, @@ -111,7 +111,9 @@ func (c *CreateOrUpdateResource[P, T]) Run(ctx context.Context, req *ctrl.Reques return ctrl.Result{}, err } - recipeDataModel.Recipe().DeploymentStatus = portableresources.Success + if recipeDataModel.Recipe() != nil { + recipeDataModel.Recipe().DeploymentStatus = util.Success + } update := &store.Object{ Metadata: store.Metadata{ ID: req.ResourceID, @@ -136,7 +138,10 @@ func (c *CreateOrUpdateResource[P, T]) copyOutputResources(data P) []string { func (c *CreateOrUpdateResource[P, T]) executeRecipeIfNeeded(ctx context.Context, data P, prevState []string) (*recipes.RecipeOutput, error) { // 'any' is required here to convert to an interface type, only then can we use a type assertion. - recipeDataModel := any(data).(datamodel.RecipeDataModel) + recipeDataModel, supportsRecipes := any(data).(datamodel.RecipeDataModel) + if !supportsRecipes { + return nil, nil + } input := recipeDataModel.Recipe() if input == nil { diff --git a/pkg/portableresources/backend/controller/deleteresource.go b/pkg/portableresources/backend/controller/deleteresource.go index 14d0221b55..c5990b53c5 100644 --- a/pkg/portableresources/backend/controller/deleteresource.go +++ b/pkg/portableresources/backend/controller/deleteresource.go @@ -21,12 +21,12 @@ import ( v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" ctrl "github.com/radius-project/radius/pkg/armrpc/asyncoperation/controller" - "github.com/radius-project/radius/pkg/portableresources" "github.com/radius-project/radius/pkg/portableresources/datamodel" "github.com/radius-project/radius/pkg/portableresources/processors" "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/recipes/configloader" "github.com/radius-project/radius/pkg/recipes/engine" + "github.com/radius-project/radius/pkg/recipes/util" rpv1 "github.com/radius-project/radius/pkg/rp/v1" "github.com/radius-project/radius/pkg/ucp/resources" ) @@ -74,11 +74,11 @@ func (c *DeleteResource[P, T]) Run(ctx context.Context, request *ctrl.Request) ( return ctrl.Result{}, err } - recipeDataModel := any(data).(datamodel.RecipeDataModel) + recipeDataModel, supportsRecipes := any(data).(datamodel.RecipeDataModel) // If we have a setup error (error before recipe and output resources are executed, we skip engine/driver deletion. // If we have an execution error, we call engine/driver deletion. - if recipeDataModel.Recipe() != nil && recipeDataModel.Recipe().DeploymentStatus != portableresources.RecipeSetupError { + if supportsRecipes && recipeDataModel.Recipe() != nil && recipeDataModel.Recipe().DeploymentStatus != util.RecipeSetupError { recipeData := recipes.ResourceMetadata{ Name: recipeDataModel.Recipe().Name, EnvironmentID: data.ResourceMetadata().Environment, diff --git a/pkg/portableresources/types.go b/pkg/portableresources/types.go index 14b9a339dc..d65495b760 100644 --- a/pkg/portableresources/types.go +++ b/pkg/portableresources/types.go @@ -18,6 +18,8 @@ package portableresources import ( "strings" + + "github.com/radius-project/radius/pkg/recipes/util" ) const ( @@ -81,7 +83,7 @@ type ResourceRecipe struct { // Parameters are key/value parameters to pass into the recipe at deployment Parameters map[string]any `json:"parameters,omitempty"` // Deployment status of the recipe - DeploymentStatus RecipeDeploymentStatus `json:"recipeStatus,omitempty"` + DeploymentStatus util.RecipeDeploymentStatus `json:"recipeStatus,omitempty"` } // ResourceReference represents a reference to a resource that was deployed by the user @@ -128,17 +130,6 @@ type Kubernetes struct { EnvironmentNamespace string `json:"environmentNamespace"` } -type RecipeDeploymentStatus string - -const ( - // ExecutionError represents a failure status during recipe execution. - ExecutionError RecipeDeploymentStatus = "executionError" - // RecipeSetupError represents a failure that happens before a recipe or output resources are deployed. - RecipeSetupError RecipeDeploymentStatus = "setupError" - // Success represents a successful recipe execution. - Success RecipeDeploymentStatus = "success" -) - // IsValidPortableResourceType checks if the provided resource type is a valid portable resource type. // Returns true if the resource type is valid, false otherwise. func IsValidPortableResourceType(resourceType string) bool { diff --git a/pkg/recipes/configloader/environment.go b/pkg/recipes/configloader/environment.go index 0b842680a0..1f9654ef70 100644 --- a/pkg/recipes/configloader/environment.go +++ b/pkg/recipes/configloader/environment.go @@ -24,8 +24,8 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/radius-project/radius/pkg/corerp/api/v20220315privatepreview" "github.com/radius-project/radius/pkg/corerp/datamodel" - "github.com/radius-project/radius/pkg/portableresources" "github.com/radius-project/radius/pkg/recipes" + recipes_util "github.com/radius-project/radius/pkg/recipes/util" "github.com/radius-project/radius/pkg/rp/kube" "github.com/radius-project/radius/pkg/rp/util" "github.com/radius-project/radius/pkg/to" @@ -126,19 +126,19 @@ func (e *environmentLoader) LoadRecipe(ctx context.Context, recipe *recipes.Reso func getRecipeDefinition(environment *v20220315privatepreview.EnvironmentResource, recipe *recipes.ResourceMetadata) (*recipes.EnvironmentDefinition, error) { if environment.Properties.Recipes == nil { msg := &recipes.ErrRecipeNotFound{Name: recipe.Name, Environment: recipe.EnvironmentID} - return nil, recipes.NewRecipeError(recipes.RecipeNotFoundFailure, msg.Error(), portableresources.RecipeSetupError, recipes.GetRecipeErrorDetails(msg)) + return nil, recipes.NewRecipeError(recipes.RecipeNotFoundFailure, msg.Error(), recipes_util.RecipeSetupError, recipes.GetRecipeErrorDetails(msg)) } resource, err := resources.ParseResource(recipe.ResourceID) if err != nil { msg := fmt.Errorf("failed to parse resourceID: %q %w", recipe.ResourceID, err) - return nil, recipes.NewRecipeError(recipes.RecipeValidationFailed, err.Error(), portableresources.RecipeSetupError, recipes.GetRecipeErrorDetails(msg)) + return nil, recipes.NewRecipeError(recipes.RecipeValidationFailed, err.Error(), recipes_util.RecipeSetupError, recipes.GetRecipeErrorDetails(msg)) } recipeName := recipe.Name found, ok := environment.Properties.Recipes[resource.Type()][recipeName] if !ok { msg := &recipes.ErrRecipeNotFound{Name: recipe.Name, Environment: recipe.EnvironmentID} - return nil, recipes.NewRecipeError(recipes.RecipeNotFoundFailure, msg.Error(), portableresources.RecipeSetupError, recipes.GetRecipeErrorDetails(msg)) + return nil, recipes.NewRecipeError(recipes.RecipeNotFoundFailure, msg.Error(), recipes_util.RecipeSetupError, recipes.GetRecipeErrorDetails(msg)) } definition := &recipes.EnvironmentDefinition{ diff --git a/pkg/recipes/driver/bicep.go b/pkg/recipes/driver/bicep.go index a327b54442..82c4c91594 100644 --- a/pkg/recipes/driver/bicep.go +++ b/pkg/recipes/driver/bicep.go @@ -28,11 +28,11 @@ import ( deployments "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/go-logr/logr" "github.com/radius-project/radius/pkg/metrics" - "github.com/radius-project/radius/pkg/portableresources" "github.com/radius-project/radius/pkg/portableresources/datamodel" "github.com/radius-project/radius/pkg/portableresources/processors" "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/recipes/recipecontext" + recipes_util "github.com/radius-project/radius/pkg/recipes/util" "github.com/radius-project/radius/pkg/rp/util" rpv1 "github.com/radius-project/radius/pkg/rp/v1" clients "github.com/radius-project/radius/pkg/sdk/clients" @@ -80,7 +80,7 @@ func (d *bicepDriver) Execute(ctx context.Context, opts ExecuteOptions) (*recipe if err != nil { metrics.DefaultRecipeEngineMetrics.RecordRecipeDownloadDuration(ctx, downloadStartTime, metrics.NewRecipeAttributes(metrics.RecipeEngineOperationDownloadRecipe, opts.Recipe.Name, &opts.Definition, recipes.RecipeDownloadFailed)) - return nil, recipes.NewRecipeError(recipes.RecipeDownloadFailed, err.Error(), portableresources.RecipeSetupError, recipes.GetRecipeErrorDetails(err)) + return nil, recipes.NewRecipeError(recipes.RecipeDownloadFailed, err.Error(), recipes_util.RecipeSetupError, recipes.GetRecipeErrorDetails(err)) } metrics.DefaultRecipeEngineMetrics.RecordRecipeDownloadDuration(ctx, downloadStartTime, metrics.NewRecipeAttributes(metrics.RecipeEngineOperationDownloadRecipe, opts.Recipe.Name, &opts.Definition, metrics.SuccessfulOperationState)) @@ -88,7 +88,7 @@ func (d *bicepDriver) Execute(ctx context.Context, opts ExecuteOptions) (*recipe // create the context object to be passed to the recipe deployment recipeContext, err := recipecontext.New(&opts.Recipe, &opts.Configuration) if err != nil { - return nil, recipes.NewRecipeError(recipes.RecipeDeploymentFailed, err.Error(), portableresources.RecipeSetupError, recipes.GetRecipeErrorDetails(err)) + return nil, recipes.NewRecipeError(recipes.RecipeDeploymentFailed, err.Error(), recipes_util.RecipeSetupError, recipes.GetRecipeErrorDetails(err)) } // get the parameters after resolving the conflict between developer and operator parameters @@ -99,7 +99,7 @@ func (d *bicepDriver) Execute(ctx context.Context, opts ExecuteOptions) (*recipe deploymentName := deploymentPrefix + strconv.FormatInt(time.Now().UnixNano(), 10) deploymentID, err := createDeploymentID(recipeContext.Resource.ID, deploymentName) if err != nil { - return nil, recipes.NewRecipeError(recipes.RecipeDeploymentFailed, err.Error(), portableresources.RecipeSetupError, recipes.GetRecipeErrorDetails(err)) + return nil, recipes.NewRecipeError(recipes.RecipeDeploymentFailed, err.Error(), recipes_util.RecipeSetupError, recipes.GetRecipeErrorDetails(err)) } // Provider config will specify the Azure and AWS scopes (if provided). @@ -127,17 +127,17 @@ func (d *bicepDriver) Execute(ctx context.Context, opts ExecuteOptions) (*recipe clients.DeploymentsClientAPIVersion, ) if err != nil { - return nil, recipes.NewRecipeError(recipes.RecipeDeploymentFailed, err.Error(), portableresources.ExecutionError, recipes.GetRecipeErrorDetails(err)) + return nil, recipes.NewRecipeError(recipes.RecipeDeploymentFailed, err.Error(), recipes_util.ExecutionError, recipes.GetRecipeErrorDetails(err)) } resp, err := poller.PollUntilDone(ctx, &runtime.PollUntilDoneOptions{Frequency: pollFrequency}) if err != nil { - return nil, recipes.NewRecipeError(recipes.RecipeDeploymentFailed, err.Error(), portableresources.ExecutionError, recipes.GetRecipeErrorDetails(err)) + return nil, recipes.NewRecipeError(recipes.RecipeDeploymentFailed, err.Error(), recipes_util.ExecutionError, recipes.GetRecipeErrorDetails(err)) } recipeResponse, err := d.prepareRecipeResponse(resp.Properties.Outputs, resp.Properties.OutputResources) if err != nil { - return nil, recipes.NewRecipeError(recipes.InvalidRecipeOutputs, fmt.Sprintf("failed to read the recipe output %q: %s", recipes.ResultPropertyName, err.Error()), portableresources.ExecutionError, recipes.GetRecipeErrorDetails(err)) + return nil, recipes.NewRecipeError(recipes.InvalidRecipeOutputs, fmt.Sprintf("failed to read the recipe output %q: %s", recipes.ResultPropertyName, err.Error()), recipes_util.ExecutionError, recipes.GetRecipeErrorDetails(err)) } // When a Radius portable resource consuming a recipe is redeployed, Garbage collection of the recipe resources that aren't included @@ -149,7 +149,7 @@ func (d *bicepDriver) Execute(ctx context.Context, opts ExecuteOptions) (*recipe // Deleting obsolete output resources. err = d.deleteGCOutputResources(ctx, diff) if err != nil { - return nil, recipes.NewRecipeError(recipes.RecipeGarbageCollectionFailed, err.Error(), portableresources.ExecutionError, nil) + return nil, recipes.NewRecipeError(recipes.RecipeGarbageCollectionFailed, err.Error(), recipes_util.ExecutionError, nil) } return recipeResponse, nil diff --git a/pkg/recipes/driver/terraform.go b/pkg/recipes/driver/terraform.go index 6d6a9ba0d0..39e7ded72f 100644 --- a/pkg/recipes/driver/terraform.go +++ b/pkg/recipes/driver/terraform.go @@ -25,10 +25,10 @@ import ( "github.com/google/uuid" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" - "github.com/radius-project/radius/pkg/portableresources" "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/recipes/terraform" + recipes_util "github.com/radius-project/radius/pkg/recipes/util" "github.com/radius-project/radius/pkg/sdk" ucp_provider "github.com/radius-project/radius/pkg/ucp/secret/provider" "github.com/radius-project/radius/pkg/ucp/ucplog" @@ -70,7 +70,7 @@ func (d *terraformDriver) Execute(ctx context.Context, opts ExecuteOptions) (*re requestDirPath, err := d.createExecutionDirectory(ctx, opts.Recipe, opts.Definition) if err != nil { - return nil, recipes.NewRecipeError(recipes.RecipeDeploymentFailed, err.Error(), portableresources.RecipeSetupError, recipes.GetRecipeErrorDetails(err)) + return nil, recipes.NewRecipeError(recipes.RecipeDeploymentFailed, err.Error(), recipes_util.RecipeSetupError, recipes.GetRecipeErrorDetails(err)) } defer func() { if err := os.RemoveAll(requestDirPath); err != nil { @@ -85,12 +85,12 @@ func (d *terraformDriver) Execute(ctx context.Context, opts ExecuteOptions) (*re EnvRecipe: &opts.Definition, }) if err != nil { - return nil, recipes.NewRecipeError(recipes.RecipeDeploymentFailed, err.Error(), portableresources.ExecutionError, recipes.GetRecipeErrorDetails(err)) + return nil, recipes.NewRecipeError(recipes.RecipeDeploymentFailed, err.Error(), recipes_util.ExecutionError, recipes.GetRecipeErrorDetails(err)) } recipeOutputs, err := d.prepareRecipeResponse(tfState) if err != nil { - return nil, recipes.NewRecipeError(recipes.InvalidRecipeOutputs, fmt.Sprintf("failed to read the recipe output %q: %s", recipes.ResultPropertyName, err.Error()), portableresources.ExecutionError, recipes.GetRecipeErrorDetails(err)) + return nil, recipes.NewRecipeError(recipes.InvalidRecipeOutputs, fmt.Sprintf("failed to read the recipe output %q: %s", recipes.ResultPropertyName, err.Error()), recipes_util.ExecutionError, recipes.GetRecipeErrorDetails(err)) } return recipeOutputs, nil diff --git a/pkg/recipes/error.go b/pkg/recipes/error.go index 8a82efabdf..be7bb5b759 100644 --- a/pkg/recipes/error.go +++ b/pkg/recipes/error.go @@ -17,12 +17,12 @@ import ( "fmt" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" - "github.com/radius-project/radius/pkg/portableresources" + "github.com/radius-project/radius/pkg/recipes/util" ) type RecipeError struct { ErrorDetails v1.ErrorDetails - DeploymentStatus portableresources.RecipeDeploymentStatus + DeploymentStatus util.RecipeDeploymentStatus } // Error returns an error string describing the error code and message. @@ -36,7 +36,7 @@ func (e *RecipeError) Is(target error) bool { } // NewRecipeError creates a new RecipeError error with a given code, message and error details. -func NewRecipeError(code string, message string, deploymentStatus portableresources.RecipeDeploymentStatus, details ...*v1.ErrorDetails) *RecipeError { +func NewRecipeError(code string, message string, deploymentStatus util.RecipeDeploymentStatus, details ...*v1.ErrorDetails) *RecipeError { err := new(RecipeError) err.ErrorDetails.Message = message err.ErrorDetails.Code = code diff --git a/pkg/recipes/error_test.go b/pkg/recipes/error_test.go index 6626ab5b75..ff1d1ee392 100644 --- a/pkg/recipes/error_test.go +++ b/pkg/recipes/error_test.go @@ -21,7 +21,7 @@ import ( "testing" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" - "github.com/radius-project/radius/pkg/portableresources" + "github.com/radius-project/radius/pkg/recipes/util" "github.com/stretchr/testify/require" ) @@ -52,7 +52,7 @@ func TestNewRecipeError(t *testing.T) { }, }, }, - portableresources.RecipeSetupError, + util.RecipeSetupError, }, }, { @@ -65,7 +65,7 @@ func TestNewRecipeError(t *testing.T) { Code: RecipeDeploymentFailed, Message: "test-recipe-deployment-failed-message", }, - portableresources.ExecutionError, + util.ExecutionError, }, }, } @@ -93,7 +93,7 @@ func TestGetRecipeErrorDetails(t *testing.T) { Code: RecipeDeploymentFailed, Message: "test-recipe-deployment-failed-message", }, - portableresources.RecipeSetupError, + util.RecipeSetupError, }, expErrorDetails: &v1.ErrorDetails{ Code: RecipeDeploymentFailed, diff --git a/pkg/recipes/terraform/execute.go b/pkg/recipes/terraform/execute.go index ee0fdfb382..3679da9178 100644 --- a/pkg/recipes/terraform/execute.go +++ b/pkg/recipes/terraform/execute.go @@ -28,12 +28,12 @@ import ( install "github.com/hashicorp/hc-install" tfjson "github.com/hashicorp/terraform-json" "github.com/radius-project/radius/pkg/metrics" - "github.com/radius-project/radius/pkg/portableresources" "github.com/radius-project/radius/pkg/recipes" "github.com/radius-project/radius/pkg/recipes/recipecontext" "github.com/radius-project/radius/pkg/recipes/terraform/config" "github.com/radius-project/radius/pkg/recipes/terraform/config/backends" "github.com/radius-project/radius/pkg/recipes/terraform/config/providers" + "github.com/radius-project/radius/pkg/recipes/util" "github.com/radius-project/radius/pkg/sdk" ucp_provider "github.com/radius-project/radius/pkg/ucp/secret/provider" "github.com/radius-project/radius/pkg/ucp/ucplog" @@ -294,7 +294,7 @@ func downloadAndInspect(ctx context.Context, workingDir string, execPath string, metrics.DefaultRecipeEngineMetrics.RecordRecipeDownloadDuration(ctx, downloadStartTime, metrics.NewRecipeAttributes(metrics.RecipeEngineOperationDownloadRecipe, options.EnvRecipe.Name, options.EnvRecipe, recipes.RecipeDownloadFailed)) - return nil, recipes.NewRecipeError(recipes.RecipeDownloadFailed, err.Error(), portableresources.RecipeSetupError, recipes.GetRecipeErrorDetails(err)) + return nil, recipes.NewRecipeError(recipes.RecipeDownloadFailed, err.Error(), util.RecipeSetupError, recipes.GetRecipeErrorDetails(err)) } metrics.DefaultRecipeEngineMetrics.RecordRecipeDownloadDuration(ctx, downloadStartTime, metrics.NewRecipeAttributes(metrics.RecipeEngineOperationDownloadRecipe, options.EnvRecipe.Name, diff --git a/pkg/recipes/util/deploymentStatus.go b/pkg/recipes/util/deploymentStatus.go new file mode 100644 index 0000000000..57091eb92e --- /dev/null +++ b/pkg/recipes/util/deploymentStatus.go @@ -0,0 +1,25 @@ +/* +Copyright 2023 The Radius Authors. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package util + +type RecipeDeploymentStatus string + +const ( + // ExecutionError represents a failure status during recipe execution. + ExecutionError RecipeDeploymentStatus = "executionError" + // RecipeSetupError represents a failure that happens before a recipe or output resources are deployed. + RecipeSetupError RecipeDeploymentStatus = "setupError" + // Success represents a successful recipe execution. + Success RecipeDeploymentStatus = "success" +) diff --git a/pkg/rp/util/registry.go b/pkg/rp/util/registry.go index 0b1caed39e..3679c391d6 100644 --- a/pkg/rp/util/registry.go +++ b/pkg/rp/util/registry.go @@ -23,8 +23,8 @@ import ( dockerParser "github.com/novln/docker-parser" v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" - "github.com/radius-project/radius/pkg/portableresources" "github.com/radius-project/radius/pkg/recipes" + recipes_util "github.com/radius-project/radius/pkg/recipes/util" "oras.land/oras-go/v2/content" "oras.land/oras-go/v2/registry/remote" ) @@ -47,12 +47,12 @@ func ReadFromRegistry(ctx context.Context, path string, data *map[string]any) er digest, err := getDigestFromManifest(ctx, repo, tag) if err != nil { - return recipes.NewRecipeError(recipes.RecipeLanguageFailure, fmt.Sprintf("failed to fetch repository from the path %q: %s", path, err.Error()), portableresources.RecipeSetupError, nil) + return recipes.NewRecipeError(recipes.RecipeLanguageFailure, fmt.Sprintf("failed to fetch repository from the path %q: %s", path, err.Error()), recipes_util.RecipeSetupError, nil) } bytes, err := getBytes(ctx, repo, digest) if err != nil { - return recipes.NewRecipeError(recipes.RecipeLanguageFailure, fmt.Sprintf("failed to fetch repository from the path %q: %s", path, err.Error()), portableresources.RecipeSetupError, nil) + return recipes.NewRecipeError(recipes.RecipeLanguageFailure, fmt.Sprintf("failed to fetch repository from the path %q: %s", path, err.Error()), recipes_util.RecipeSetupError, nil) } err = json.Unmarshal(bytes, data)