Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export required Conversions for Reconciling the Deprecated CustomRun #6496

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -61,7 +61,8 @@ func (p Param) convertTo(ctx context.Context, sink *v1.Param) {
sink.Value = newValue
}

func (p *Param) convertFrom(ctx context.Context, source v1.Param) {
// ConvertFrom v1 Param is exported for reconciling the deprecated v1beta1 CustomRun
func (p *Param) ConvertFrom(ctx context.Context, source v1.Param) {
p.Name = source.Name
newValue := ParamValue{}
newValue.convertFrom(ctx, source.Value)
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/pipeline/v1beta1/pipeline_conversion.go
Original file line number Diff line number Diff line change
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 All @@ -211,7 +211,7 @@ func (pt *PipelineTask) convertFrom(ctx context.Context, source v1.PipelineTask)
pt.Params = nil
for _, p := range source.Params {
new := Param{}
new.convertFrom(ctx, p)
new.ConvertFrom(ctx, p)
pt.Params = append(pt.Params, new)
}
pt.Matrix = nil
Expand Down Expand Up @@ -278,15 +278,15 @@ func (m *Matrix) convertTo(ctx context.Context, sink *v1.Matrix) {
func (m *Matrix) convertFrom(ctx context.Context, source v1.Matrix) {
for _, param := range source.Params {
new := Param{}
new.convertFrom(ctx, param)
new.ConvertFrom(ctx, param)
m.Params = append(m.Params, new)
}

for i, include := range source.Include {
m.Include = append(m.Include, IncludeParams{Name: include.Name})
for _, p := range include.Params {
new := Param{}
new.convertFrom(ctx, p)
new.ConvertFrom(ctx, p)
m.Include[i].Params = append(m.Include[i].Params, new)
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/pipeline/v1beta1/pipelinerun_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (prs *PipelineRunSpec) ConvertFrom(ctx context.Context, source *v1.Pipeline
prs.Params = nil
for _, p := range source.Params {
new := Param{}
new.convertFrom(ctx, p)
new.ConvertFrom(ctx, p)
prs.Params = append(prs.Params, new)
}
prs.ServiceAccountName = source.TaskRunTemplate.ServiceAccountName
Expand All @@ -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/resolver_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (rr *ResolverRef) convertFrom(ctx context.Context, source v1.ResolverRef) {
rr.Params = nil
for _, r := range source.Params {
new := Param{}
new.convertFrom(ctx, r)
new.ConvertFrom(ctx, r)
rr.Params = append(rr.Params, new)
}
}
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 TaskRef is exported for reconciling the deprecated v1beta1 CustomRun
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v1beta1 customrun is not deprecated

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
6 changes: 3 additions & 3 deletions pkg/apis/pipeline/v1beta1/taskrun_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ func (trs *TaskRunSpec) ConvertFrom(ctx context.Context, source *v1.TaskRunSpec)
trs.Params = nil
for _, p := range source.Params {
new := Param{}
new.convertFrom(ctx, p)
new.ConvertFrom(ctx, p)
trs.Params = append(trs.Params, new)
}
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 CustomRun
func (w *WorkspaceBinding) ConvertFrom(ctx context.Context, source v1.WorkspaceBinding) {
w.Name = source.Name
w.SubPath = source.SubPath
w.VolumeClaimTemplate = source.VolumeClaimTemplate
Expand Down