Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeJu committed Aug 25, 2022
1 parent ff82a78 commit 97c6b5e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
6 changes: 5 additions & 1 deletion pkg/apis/pipeline/v1beta1/taskrun_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func (trs *TaskRunSpec) ConvertTo(ctx context.Context, sink *v1.TaskRunSpec) err
}
}
sink.Status = v1.TaskRunSpecStatus(trs.Status)
sink.StatusMessage = v1.TaskRunSpecStatusMessage(trs.StatusMessage)
sink.Timeout = trs.Timeout
sink.PodTemplate = trs.PodTemplate
sink.Workspaces = nil
Expand Down Expand Up @@ -110,7 +111,7 @@ func (trs *TaskRunSpec) ConvertFrom(ctx context.Context, source *v1.TaskRunSpec)
newDebug.convertFrom(ctx, *source.Debug)
trs.Debug = &newDebug
}
source.Params = nil
trs.Params = nil
for _, p := range source.Params {
new := Param{}
new.convertFrom(ctx, p)
Expand All @@ -120,15 +121,18 @@ func (trs *TaskRunSpec) ConvertFrom(ctx context.Context, source *v1.TaskRunSpec)
if source.TaskRef != nil {
newTaskRef := TaskRef{}
newTaskRef.convertFrom(ctx, *source.TaskRef)
trs.TaskRef = &newTaskRef
}
if source.TaskSpec != nil {
newTaskSpec := TaskSpec{}
err := newTaskSpec.ConvertFrom(ctx, source.TaskSpec)
if err != nil {
return err
}
trs.TaskSpec = &newTaskSpec
}
trs.Status = TaskRunSpecStatus(source.Status)
trs.StatusMessage = TaskRunSpecStatusMessage(source.StatusMessage)
trs.Timeout = source.Timeout
trs.PodTemplate = source.PodTemplate
trs.Workspaces = nil
Expand Down
11 changes: 1 addition & 10 deletions pkg/apis/pipeline/v1beta1/taskrun_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ var (
Image: "foo",
Command: []string{"/mycmd"},
}
simpleTask = &v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: "bar",
},
Spec: v1beta1.TaskSpec{
Steps: []v1beta1.Step{simpleStep},
},
}
)

func TestTaskRunConversionBadType(t *testing.T) {
Expand Down Expand Up @@ -215,7 +206,7 @@ func TestTaskRunConversionFromDeprecated(t *testing.T) {
// TODO(#4546): We're just dropping Resources when converting from
// v1beta1 to v1. Before moving the stored version to v1, we should
// come up with a better strategy
versions := []apis.Convertible{&v1.Task{}}
versions := []apis.Convertible{&v1.TaskRun{}}
tests := []struct {
name string
in *v1beta1.TaskRun
Expand Down

0 comments on commit 97c6b5e

Please sign in to comment.