From 112775ee5006adf2b54b3521b4e0c74b9bf7b067 Mon Sep 17 00:00:00 2001 From: Richard Hagen Date: Wed, 13 Dec 2023 15:17:43 +0100 Subject: [PATCH] fix pr comments --- pkg/pipeline/radix-application_config.go | 7 +++-- pkg/pipeline/validation/task_validations.go | 2 +- pkg/utils/test/setup.go | 29 --------------------- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/pkg/pipeline/radix-application_config.go b/pkg/pipeline/radix-application_config.go index 90207e1..1d731ab 100644 --- a/pkg/pipeline/radix-application_config.go +++ b/pkg/pipeline/radix-application_config.go @@ -54,10 +54,9 @@ func (ctx *pipelineContext) createConfigMap(configFileContent string, prepareBui } cm := corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ - Name: env.GetRadixConfigMapName(), - Namespace: env.GetAppNamespace(), - Labels: map[string]string{kube.RadixJobNameLabel: ctx.GetEnv().GetRadixPipelineJobName()}, - OwnerReferences: []metav1.OwnerReference{*ctx.ownerReference}, + Name: env.GetRadixConfigMapName(), + Namespace: env.GetAppNamespace(), + Labels: map[string]string{kube.RadixJobNameLabel: ctx.GetEnv().GetRadixPipelineJobName()}, }, Data: map[string]string{ pipelineDefaults.PipelineConfigMapContent: configFileContent, diff --git a/pkg/pipeline/validation/task_validations.go b/pkg/pipeline/validation/task_validations.go index b7118a5..423d919 100644 --- a/pkg/pipeline/validation/task_validations.go +++ b/pkg/pipeline/validation/task_validations.go @@ -31,7 +31,7 @@ func ValidateTask(task *pipelinev1.Task) error { err := stderrors.Join(errs...) if err != nil { - return errors.WithMessagef(err, "Task %s is invalid", task.GetName()) + return fmt.Errorf("task %s is invalid: %w", task.GetName(), err) } return nil diff --git a/pkg/utils/test/setup.go b/pkg/utils/test/setup.go index 8eb65d4..c631546 100644 --- a/pkg/utils/test/setup.go +++ b/pkg/utils/test/setup.go @@ -1,15 +1,10 @@ package test import ( - "context" - - "github.com/equinor/radix-operator/pkg/apis/radix/v1" - "github.com/equinor/radix-operator/pkg/apis/utils" radixclient "github.com/equinor/radix-operator/pkg/client/clientset/versioned" radixclientfake "github.com/equinor/radix-operator/pkg/client/clientset/versioned/fake" tektonclient "github.com/tektoncd/pipeline/pkg/client/clientset/versioned" tektonclientfake "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/fake" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" kubeclientfake "k8s.io/client-go/kubernetes/fake" ) @@ -20,27 +15,3 @@ func Setup() (kubernetes.Interface, radixclient.Interface, tektonclient.Interfac tknclient := tektonclientfake.NewSimpleClientset() return kubeclient, rxclient, tknclient } - -func (params *TestParams) ApplyRd(radixClient radixclient.Interface) (*v1.RadixDeployment, error) { - rd := utils.ARadixDeployment(). - WithDeploymentName(params.DeploymentName). - WithAppName(params.AppName). - WithEnvironment(params.Environment). - WithComponents(). - WithJobComponents(). - BuildRD() - _, err := radixClient.RadixV1().RadixDeployments(rd.Namespace).Create(context.Background(), rd, metav1.CreateOptions{}) - if err != nil { - return nil, err - } - - return rd, nil -} - -type TestParams struct { - AppName string - Environment string - Namespace string - JobComponentName string - DeploymentName string -}