From bbdd66b0f3ca241c9c3e6bcfa596a109f38565ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Va=C5=A1ek?= Date: Thu, 20 Jun 2024 20:01:14 +0200 Subject: [PATCH] chore: updated tekton api verison (#2383) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matej VaĊĦek --- .../task/func-buildpacks/0.2/func-buildpacks.yaml | 2 +- .../tekton/task/func-deploy/0.1/func-deploy.yaml | 2 +- .../tekton/task/func-s2i/0.1/func-s2i.yaml | 2 +- pkg/pipelines/tekton/client.go | 6 +++--- pkg/pipelines/tekton/pipelines_provider.go | 14 +++++++------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pkg/pipelines/resources/tekton/task/func-buildpacks/0.2/func-buildpacks.yaml b/pkg/pipelines/resources/tekton/task/func-buildpacks/0.2/func-buildpacks.yaml index df5d1f7ef..817675911 100644 --- a/pkg/pipelines/resources/tekton/task/func-buildpacks/0.2/func-buildpacks.yaml +++ b/pkg/pipelines/resources/tekton/task/func-buildpacks/0.2/func-buildpacks.yaml @@ -1,5 +1,5 @@ --- -apiVersion: tekton.dev/v1beta1 +apiVersion: tekton.dev/v1 kind: Task metadata: name: func-buildpacks diff --git a/pkg/pipelines/resources/tekton/task/func-deploy/0.1/func-deploy.yaml b/pkg/pipelines/resources/tekton/task/func-deploy/0.1/func-deploy.yaml index cf13f7ad0..968af9bb5 100644 --- a/pkg/pipelines/resources/tekton/task/func-deploy/0.1/func-deploy.yaml +++ b/pkg/pipelines/resources/tekton/task/func-deploy/0.1/func-deploy.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1beta1 +apiVersion: tekton.dev/v1 kind: Task metadata: name: func-deploy diff --git a/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml b/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml index 5c30b7566..8fb1cc5ce 100644 --- a/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml +++ b/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1beta1 +apiVersion: tekton.dev/v1 kind: Task metadata: name: func-s2i diff --git a/pkg/pipelines/tekton/client.go b/pkg/pipelines/tekton/client.go index efb9ee649..399ddc35f 100644 --- a/pkg/pipelines/tekton/client.go +++ b/pkg/pipelines/tekton/client.go @@ -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" ) @@ -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) } diff --git a/pkg/pipelines/tekton/pipelines_provider.go b/pkg/pipelines/tekton/pipelines_provider.go index 80d27481f..46b08ed38 100644 --- a/pkg/pipelines/tekton/pipelines_provider.go +++ b/pkg/pipelines/tekton/pipelines_provider.go @@ -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" @@ -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", @@ -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. @@ -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 } @@ -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 {