Skip to content

Commit

Permalink
Fix copying description also during upgrade
Browse files Browse the repository at this point in the history
This will add copying the description also
while upgrading from v1alpha1 to v1beta1
for pipeline, task and clustertask

Related to tektoncd/cli#819

(cherry picked from commit 5d39a72)
  • Loading branch information
piyush-garg authored and nikhil-thomas committed Apr 6, 2020
1 parent b71c928 commit 7de159c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/apis/pipeline/v1alpha1/pipeline_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (source *PipelineSpec) ConvertUp(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 {
Expand Down Expand Up @@ -86,6 +87,7 @@ func (sink *PipelineSpec) ConvertDown(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 {
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/pipeline/v1alpha1/pipeline_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func TestPipelineConversion(t *testing.T) {
Generation: 1,
},
Spec: PipelineSpec{
Description: "test",
Resources: []PipelineDeclaredResource{{
Name: "resource1",
Type: resource.PipelineResourceTypeGit,
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/pipeline/v1alpha1/task_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func (source *TaskSpec) ConvertUp(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
Expand Down Expand Up @@ -120,5 +121,6 @@ func (sink *TaskSpec) ConvertDown(ctx context.Context, source *v1beta1.TaskSpec)
sink.Results = source.Results
sink.Params = source.Params
sink.Resources = source.Resources
sink.Description = source.Description
return nil
}
1 change: 1 addition & 0 deletions pkg/apis/pipeline/v1alpha1/task_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func TestTaskConversion(t *testing.T) {
},
Spec: TaskSpec{
TaskSpec: v1beta1.TaskSpec{
Description: "test",
Steps: []v1beta1.Step{{Container: corev1.Container{
Image: "foo",
}}},
Expand Down

0 comments on commit 7de159c

Please sign in to comment.