Skip to content

Commit

Permalink
Use SchemeGroupVersion for tekton objects in cluster resolver
Browse files Browse the repository at this point in the history
Prior, the cluster resolver sets the APIVersion of the retrieved tekton object
to be a fixed string "tekton.dev/v1beta1".

Now, we changed this to `v1beta1.SchemeGroupVersion.String()` for easier
transition to v1 once v1 is released.

Signed-off-by: Chuang Wang <[email protected]>
  • Loading branch information
chuangw6 committed Nov 1, 2022
1 parent 867fe2d commit c2f54e5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/resolution/resolver/cluster/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func (r *Resolver) Resolve(ctx context.Context, origParams []pipelinev1beta1.Par
}

var data []byte
groupVersion := pipelinev1beta1.SchemeGroupVersion.String()

switch params[KindParam] {
case "task":
Expand All @@ -110,7 +111,7 @@ func (r *Resolver) Resolve(ctx context.Context, origParams []pipelinev1beta1.Par
return nil, err
}
task.Kind = "Task"
task.APIVersion = "tekton.dev/v1beta1"
task.APIVersion = groupVersion
data, err = yaml.Marshal(task)
if err != nil {
logger.Infof("failed to marshal task %s from namespace %s: %v", params[NameParam], params[NamespaceParam], err)
Expand All @@ -123,7 +124,7 @@ func (r *Resolver) Resolve(ctx context.Context, origParams []pipelinev1beta1.Par
return nil, err
}
pipeline.Kind = "Pipeline"
pipeline.APIVersion = "tekton.dev/v1beta1"
pipeline.APIVersion = groupVersion
data, err = yaml.Marshal(pipeline)
if err != nil {
logger.Infof("failed to marshal pipeline %s from namespace %s: %v", params[NameParam], params[NamespaceParam], err)
Expand Down

0 comments on commit c2f54e5

Please sign in to comment.