Skip to content

Commit

Permalink
chore: updated tekton api verison (#2383)
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Vašek <[email protected]>
  • Loading branch information
matejvasek authored Jun 20, 2024
1 parent 6f19506 commit bbdd66b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: tekton.dev/v1beta1
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: func-buildpacks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: tekton.dev/v1beta1
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: func-deploy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: tekton.dev/v1beta1
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: func-s2i
Expand Down
6 changes: 3 additions & 3 deletions pkg/pipelines/tekton/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

"github.com/tektoncd/cli/pkg/cli"
"github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1beta1"
v1 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1"
"knative.dev/func/pkg/k8s"
)

Expand All @@ -14,13 +14,13 @@ const (
)

// NewTektonClient returns TektonV1beta1Client for namespace
func NewTektonClient(namespace string) (*v1beta1.TektonV1beta1Client, error) {
func NewTektonClient(namespace string) (*v1.TektonV1Client, error) {
restConfig, err := k8s.GetClientConfig().ClientConfig()
if err != nil {
return nil, fmt.Errorf("failed to create new tekton client: %w", err)
}

client, err := v1beta1.NewForConfig(restConfig)
client, err := v1.NewForConfig(restConfig)
if err != nil {
return nil, fmt.Errorf("failed to create new tekton client: %v", err)
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/pipelines/tekton/pipelines_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
gitignore "github.com/sabhiram/go-gitignore"
"github.com/tektoncd/cli/pkg/pipelinerun"
"github.com/tektoncd/cli/pkg/taskrun"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
pipelineClient "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1beta1"
v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
pipelineClient "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1"
corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -438,7 +438,7 @@ func (pp *PipelinesProvider) removeClusterResources(ctx context.Context, f fn.Fu

// watchPipelineRunProgress watches the progress of the input PipelineRun
// and prints detailed description of the currently executed Tekton Task.
func (pp *PipelinesProvider) watchPipelineRunProgress(ctx context.Context, pr *v1beta1.PipelineRun, namespace string) error {
func (pp *PipelinesProvider) watchPipelineRunProgress(ctx context.Context, pr *v1.PipelineRun, namespace string) error {
taskProgressMsg := map[string]string{
"fetch-sources": "Fetching git repository with the function source code",
"build": "Building function image on the cluster",
Expand Down Expand Up @@ -492,7 +492,7 @@ out:

// getFailedPipelineRunLog returns log message for a failed PipelineRun,
// returns log from a container where the failing TaskRun is running, if available.
func getFailedPipelineRunLog(ctx context.Context, client *pipelineClient.TektonV1beta1Client, pr *v1beta1.PipelineRun, namespace string) string {
func getFailedPipelineRunLog(ctx context.Context, client *pipelineClient.TektonV1Client, pr *v1.PipelineRun, namespace string) string {
// Reason "Failed" usually means there is a specific failure in some step,
// let's find the failed step and try to get log directly from the container.
// If we are not able to get the container's log, we return the generic message from the PipelineRun.Status.
Expand All @@ -507,7 +507,7 @@ func getFailedPipelineRunLog(ctx context.Context, client *pipelineClient.TektonV
for _, s := range t.Status.Steps {
// let's try to print logs of the first unsuccessful step
if s.Terminated != nil && s.Terminated.ExitCode != 0 {
podLogs, err := k8s.GetPodLogs(ctx, namespace, t.Status.PodName, s.ContainerName)
podLogs, err := k8s.GetPodLogs(ctx, namespace, t.Status.PodName, s.Container)
if err == nil {
return podLogs
}
Expand All @@ -523,13 +523,13 @@ func getFailedPipelineRunLog(ctx context.Context, client *pipelineClient.TektonV
}

// findNewestPipelineRunWithRetry tries to find newest Pipeline Run for the input function
func findNewestPipelineRunWithRetry(ctx context.Context, f fn.Function, namespace string, client *pipelineClient.TektonV1beta1Client) (*v1beta1.PipelineRun, error) {
func findNewestPipelineRunWithRetry(ctx context.Context, f fn.Function, namespace string, client *pipelineClient.TektonV1Client) (*v1.PipelineRun, error) {
l := k8slabels.SelectorFromSet(k8slabels.Set(map[string]string{fnlabels.FunctionNameKey: f.Name}))
listOptions := metav1.ListOptions{
LabelSelector: l.String(),
}

var newestPipelineRun *v1beta1.PipelineRun
var newestPipelineRun *v1.PipelineRun
for attempt := 1; attempt <= 3; attempt++ {
prs, err := client.PipelineRuns(namespace).List(ctx, listOptions)
if err != nil {
Expand Down

0 comments on commit bbdd66b

Please sign in to comment.