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

Default Resolver is not set for Finally Tasks #6449

Closed
jerop opened this issue Mar 28, 2023 · 1 comment · Fixed by #6481
Closed

Default Resolver is not set for Finally Tasks #6449

jerop opened this issue Mar 28, 2023 · 1 comment · Fixed by #6481
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@jerop
Copy link
Member

jerop commented Mar 28, 2023

Expected Behavior

Default Resolver is set for Finally Tasks

Actual Behavior

Default Resolver is not set for Finally Tasks

Additional Info

Was looking into the SetDefaults function and realized that support for default Resolver is not implemented for Finally Tasks:

func (ps *PipelineSpec) SetDefaults(ctx context.Context) {
cfg := config.FromContextOrDefaults(ctx)
for i := range ps.Params {
ps.Params[i].SetDefaults(ctx)
}
for _, pt := range ps.Tasks {
if pt.TaskRef != nil {
if pt.TaskRef.Kind == "" {
pt.TaskRef.Kind = NamespacedTaskKind
}
if pt.TaskRef.Name == "" && pt.TaskRef.Resolver == "" {
pt.TaskRef.Resolver = ResolverName(cfg.Defaults.DefaultResolverType)
}
}
if pt.TaskSpec != nil {
pt.TaskSpec.SetDefaults(ctx)
}
}
for _, ft := range ps.Finally {
ctx := ctx // Ensure local scoping per Task
if ft.TaskRef != nil {
if ft.TaskRef.Kind == "" {
ft.TaskRef.Kind = NamespacedTaskKind
}
}
if ft.TaskSpec != nil {
ft.TaskSpec.SetDefaults(ctx)
}
}
}

Related PR: #6317

cc @QuanZhang-William

@jerop jerop added the kind/bug Categorizes issue or PR as related to a bug. label Mar 28, 2023
@QuanZhang-William
Copy link
Member

Ahh... Good catch and thank you @jerop!

/assign

QuanZhang-William added a commit to QuanZhang-William/pipeline that referenced this issue Mar 31, 2023
Fixes tektoncd#6449. Prior to this commit, the default resolver is only applied to PipelineTasks but not finally PipelineTasks.
This commit applies the default resolver to the finally PipelineTasks in the same way as normal PipelineTasks.
This commit also refactors the common code to a PipelineTask SetDefaults function.

/kind bug

[tektoncd#6449]: tektoncd#6449
QuanZhang-William added a commit to QuanZhang-William/pipeline that referenced this issue Mar 31, 2023
Fixes tektoncd#6449. Prior to this commit, the default resolver is only applied to PipelineTasks but not finally PipelineTasks.
This commit applies the default resolver to the finally PipelineTasks in the same way as normal PipelineTasks.
This commit also refactors the common code to a PipelineTask SetDefaults function.

/kind bug

[tektoncd#6449]: tektoncd#6449
tekton-robot pushed a commit that referenced this issue Apr 6, 2023
Fixes #6449. Prior to this commit, the default resolver is only applied to PipelineTasks but not finally PipelineTasks.
This commit applies the default resolver to the finally PipelineTasks in the same way as normal PipelineTasks.
This commit also refactors the common code to a PipelineTask SetDefaults function.

/kind bug

[#6449]: #6449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants