From 85f10085a513187a78e79f811ac37c55a1c37537 Mon Sep 17 00:00:00 2001 From: Piyush Garg Date: Thu, 19 Mar 2020 12:28:44 +0530 Subject: [PATCH] Fix copying description also during upgrade This will add copying the description also while upgrading from v1alpha1 to v1beta1 for pipeline, task and clustertask Related to https://github.com/tektoncd/cli/issues/819 --- pkg/apis/pipeline/v1alpha1/pipeline_conversion.go | 2 ++ pkg/apis/pipeline/v1alpha1/task_conversion.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/pkg/apis/pipeline/v1alpha1/pipeline_conversion.go b/pkg/apis/pipeline/v1alpha1/pipeline_conversion.go index b54edbf5944..26173c4c9e8 100644 --- a/pkg/apis/pipeline/v1alpha1/pipeline_conversion.go +++ b/pkg/apis/pipeline/v1alpha1/pipeline_conversion.go @@ -42,6 +42,7 @@ func (source *PipelineSpec) ConvertTo(ctx context.Context, sink *v1beta1.Pipelin sink.Resources = source.Resources sink.Params = source.Params sink.Workspaces = source.Workspaces + sink.Description = source.Description if len(source.Tasks) > 0 { sink.Tasks = make([]v1beta1.PipelineTask, len(source.Tasks)) for i := range source.Tasks { @@ -86,6 +87,7 @@ func (sink *PipelineSpec) ConvertFrom(ctx context.Context, source v1beta1.Pipeli sink.Resources = source.Resources sink.Params = source.Params sink.Workspaces = source.Workspaces + sink.Description = source.Description if len(source.Tasks) > 0 { sink.Tasks = make([]PipelineTask, len(source.Tasks)) for i := range source.Tasks { diff --git a/pkg/apis/pipeline/v1alpha1/task_conversion.go b/pkg/apis/pipeline/v1alpha1/task_conversion.go index 771fd8d6ac1..b4e350a7107 100644 --- a/pkg/apis/pipeline/v1alpha1/task_conversion.go +++ b/pkg/apis/pipeline/v1alpha1/task_conversion.go @@ -47,6 +47,7 @@ func (source *TaskSpec) ConvertTo(ctx context.Context, sink *v1beta1.TaskSpec) e sink.Results = source.Results sink.Resources = source.Resources sink.Params = source.Params + sink.Description = source.Description if source.Inputs != nil { if len(source.Inputs.Params) > 0 && len(source.Params) > 0 { // This shouldn't happen as it shouldn't pass validation @@ -120,5 +121,6 @@ func (sink *TaskSpec) ConvertFrom(ctx context.Context, source *v1beta1.TaskSpec) sink.Results = source.Results sink.Params = source.Params sink.Resources = source.Resources + sink.Description = source.Description return nil }