Skip to content

Commit

Permalink
Export Deprecated CustomTask required Conversions
Browse files Browse the repository at this point in the history
This commit makes the conversions required for reconciling the deprecated
v1beta1 CustomTask exported in the apis.

part of tektoncd#5541
  • Loading branch information
JeromeJu committed Apr 5, 2023
1 parent ecb11fc commit b519267
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion pkg/apis/pipeline/v1beta1/param_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ func (p ParamSpec) convertTo(ctx context.Context, sink *v1.ParamSpec) {
}
}

func (p *ParamSpec) convertFrom(ctx context.Context, source v1.ParamSpec) {
// ConvertFrom v1 ParamSpec is exported for reconciling the deprecated v1beta1 CustomTask
func (p *ParamSpec) ConvertFrom(ctx context.Context, source v1.ParamSpec) {
p.Name = source.Name
if source.Type != "" {
p.Type = ParamType(source.Type)
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/pipeline/v1beta1/pipeline_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (ps *PipelineSpec) ConvertFrom(ctx context.Context, source *v1.PipelineSpec
ps.Params = nil
for _, p := range source.Params {
new := ParamSpec{}
new.convertFrom(ctx, p)
new.ConvertFrom(ctx, p)
ps.Params = append(ps.Params, new)
}
ps.Workspaces = nil
Expand Down Expand Up @@ -189,7 +189,7 @@ func (pt *PipelineTask) convertFrom(ctx context.Context, source v1.PipelineTask)
pt.Description = source.Description
if source.TaskRef != nil {
newTaskRef := TaskRef{}
newTaskRef.convertFrom(ctx, *source.TaskRef)
newTaskRef.ConvertFrom(ctx, *source.TaskRef)
pt.TaskRef = &newTaskRef
}
if source.TaskSpec != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (prs *PipelineRunSpec) ConvertFrom(ctx context.Context, source *v1.Pipeline
prs.Workspaces = nil
for _, w := range source.Workspaces {
new := WorkspaceBinding{}
new.convertFrom(ctx, w)
new.ConvertFrom(ctx, w)
prs.Workspaces = append(prs.Workspaces, new)
}
prs.TaskRunSpecs = nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/pipeline/v1beta1/task_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (ts *TaskSpec) ConvertFrom(ctx context.Context, source *v1.TaskSpec) error
ts.Params = nil
for _, p := range source.Params {
new := ParamSpec{}
new.convertFrom(ctx, p)
new.ConvertFrom(ctx, p)
ts.Params = append(ts.Params, new)
}
ts.DisplayName = source.DisplayName
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/pipeline/v1beta1/taskref_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ func (tr TaskRef) convertTo(ctx context.Context, sink *v1.TaskRef) {
tr.convertBundleToResolver(sink)
}

func (tr *TaskRef) convertFrom(ctx context.Context, source v1.TaskRef) {
// ConvertFrom v1 TaksRef is exported for reconciling the deprecated v1beta1 CustomTask
func (tr *TaskRef) ConvertFrom(ctx context.Context, source v1.TaskRef) {
tr.Name = source.Name
tr.Kind = TaskKind(source.Kind)
tr.APIVersion = source.APIVersion
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/pipeline/v1beta1/taskrun_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (trs *TaskRunSpec) ConvertFrom(ctx context.Context, source *v1.TaskRunSpec)
trs.ServiceAccountName = source.ServiceAccountName
if source.TaskRef != nil {
newTaskRef := TaskRef{}
newTaskRef.convertFrom(ctx, *source.TaskRef)
newTaskRef.ConvertFrom(ctx, *source.TaskRef)
trs.TaskRef = &newTaskRef
}
if source.TaskSpec != nil {
Expand All @@ -165,7 +165,7 @@ func (trs *TaskRunSpec) ConvertFrom(ctx context.Context, source *v1.TaskRunSpec)
trs.Workspaces = nil
for _, w := range source.Workspaces {
new := WorkspaceBinding{}
new.convertFrom(ctx, w)
new.ConvertFrom(ctx, w)
trs.Workspaces = append(trs.Workspaces, new)
}
trs.StepOverrides = nil
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/pipeline/v1beta1/workspace_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ func (w WorkspaceBinding) convertTo(ctx context.Context, sink *v1.WorkspaceBindi
sink.CSI = w.CSI
}

func (w *WorkspaceBinding) convertFrom(ctx context.Context, source v1.WorkspaceBinding) {
// ConvertFrom v1 WorkspaceBinding is exported for reconciling the deprecated v1beta1 CustomTask
func (w *WorkspaceBinding) ConvertFrom(ctx context.Context, source v1.WorkspaceBinding) {
w.Name = source.Name
w.SubPath = source.SubPath
w.VolumeClaimTemplate = source.VolumeClaimTemplate
Expand Down

0 comments on commit b519267

Please sign in to comment.