Skip to content

Commit

Permalink
Move chains cmd to v1
Browse files Browse the repository at this point in the history
This will move chains cmd to use v1 struct
as chains has moved to v1
  • Loading branch information
piyush-garg authored and tekton-robot committed Feb 2, 2024
1 parent 18999d4 commit b622d7e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pkg/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/chain/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
}
Expand All @@ -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 {
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/chain/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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)
}
Expand All @@ -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 {
Expand All @@ -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)
Expand Down

0 comments on commit b622d7e

Please sign in to comment.