From b622d7e0435b963a5c9ea4b5ec40dfd46b0bb86f Mon Sep 17 00:00:00 2001 From: Piyush Garg Date: Thu, 1 Feb 2024 23:33:02 +0530 Subject: [PATCH] Move chains cmd to v1 This will move chains cmd to use v1 struct as chains has moved to v1 --- pkg/chain/chain.go | 4 ++-- pkg/cmd/chain/payload.go | 8 ++++---- pkg/cmd/chain/signature.go | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/chain/chain.go b/pkg/chain/chain.go index 3c51429122..f5a1c2433e 100644 --- a/pkg/chain/chain.go +++ b/pkg/chain/chain.go @@ -24,7 +24,7 @@ import ( "github.com/tektoncd/chains/pkg/chains/storage" "github.com/tektoncd/chains/pkg/config" "github.com/tektoncd/cli/pkg/cli" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1" "go.uber.org/zap" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -38,7 +38,7 @@ func ConfigMapToContext(cs *cli.Clients, namespace string) (context.Context, err return config.ToContext(context.Background(), cfg), nil } -func GetTaskRunBackends(cs *cli.Clients, namespace string, tr *v1beta1.TaskRun) (map[string]storage.Backend, config.StorageOpts, error) { +func GetTaskRunBackends(cs *cli.Clients, namespace string, tr *v1.TaskRun) (map[string]storage.Backend, config.StorageOpts, error) { // Prepare the logger. encoderCfg := zapcore.EncoderConfig{ MessageKey: "msg", diff --git a/pkg/cmd/chain/payload.go b/pkg/cmd/chain/payload.go index fc8ca52b12..3d430f3983 100644 --- a/pkg/cmd/chain/payload.go +++ b/pkg/cmd/chain/payload.go @@ -24,7 +24,7 @@ import ( "github.com/tektoncd/cli/pkg/actions" "github.com/tektoncd/cli/pkg/chain" "github.com/tektoncd/cli/pkg/cli" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -60,7 +60,7 @@ func payloadCommand(p cli.Params) *cobra.Command { } // Retrieve the taskrun. - var taskrun *v1beta1.TaskRun + var taskrun *v1.TaskRun if err = actions.GetV1(taskrunGroupResource, cs, taskName, p.Namespace(), metav1.GetOptions{}, &taskrun); err != nil { return fmt.Errorf("failed to get TaskRun %s: %v", taskName, err) } @@ -73,7 +73,7 @@ func payloadCommand(p cli.Params) *cobra.Command { return c } -func printPayloads(cs *cli.Clients, namespace string, tr *v1beta1.TaskRun, skipVerify bool) error { +func printPayloads(cs *cli.Clients, namespace string, tr *v1.TaskRun, skipVerify bool) error { // Get the storage backend. backends, opts, err := chain.GetTaskRunBackends(cs, namespace, tr) if err != nil { @@ -93,7 +93,7 @@ func printPayloads(cs *cli.Clients, namespace string, tr *v1beta1.TaskRun, skipV } // Fetch the payload. - trObj := objects.NewTaskRunObject(tr) + trObj := objects.NewTaskRunObjectV1(tr) payloads, err := backend.RetrievePayloads(context.Background(), trObj, opts) if err != nil { return fmt.Errorf("error retrieving the payloads: %s", err) diff --git a/pkg/cmd/chain/signature.go b/pkg/cmd/chain/signature.go index 111e2860f3..2012971d28 100644 --- a/pkg/cmd/chain/signature.go +++ b/pkg/cmd/chain/signature.go @@ -23,7 +23,7 @@ import ( "github.com/tektoncd/cli/pkg/actions" "github.com/tektoncd/cli/pkg/chain" "github.com/tektoncd/cli/pkg/cli" - "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -50,7 +50,7 @@ func signatureCommand(p cli.Params) *cobra.Command { return fmt.Errorf("failed to create tekton client") } - var taskrun *v1beta1.TaskRun + var taskrun *v1.TaskRun if err = actions.GetV1(taskrunGroupResource, cs, taskName, p.Namespace(), metav1.GetOptions{}, &taskrun); err != nil { return fmt.Errorf("failed to get TaskRun %s: %v", taskName, err) } @@ -62,7 +62,7 @@ func signatureCommand(p cli.Params) *cobra.Command { return c } -func printSignatures(cs *cli.Clients, namespace string, tr *v1beta1.TaskRun) error { +func printSignatures(cs *cli.Clients, namespace string, tr *v1.TaskRun) error { // Get the storage backend. backends, opts, err := chain.GetTaskRunBackends(cs, namespace, tr) if err != nil { @@ -77,7 +77,7 @@ func printSignatures(cs *cli.Clients, namespace string, tr *v1beta1.TaskRun) err } // Fetch the signature. - trObj := objects.NewTaskRunObject(tr) + trObj := objects.NewTaskRunObjectV1(tr) signatures, err := backend.RetrieveSignatures(context.Background(), trObj, opts) if err != nil { return fmt.Errorf("error retrieving the signatures: %s", err)