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

fix: do not set default kind when taskRef resolver is present #7763

Merged

Conversation

l-qing
Copy link
Contributor

@l-qing l-qing commented Mar 17, 2024

fix #7762

Do not set default kind when taskRef resolver is present, keep the original configuration of the user.

Changes

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

fix: do not set default kind when taskRef resolver is present

/kind bug

@tekton-robot tekton-robot added kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Mar 17, 2024
@tekton-robot
Copy link
Collaborator

Hi @l-qing. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 17, 2024
@l-qing
Copy link
Contributor Author

l-qing commented Mar 17, 2024

/test check-pr-has-kind-label

@tekton-robot
Copy link
Collaborator

@l-qing: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test check-pr-has-kind-label

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 18, 2024
@vdemeester
Copy link
Member

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 18, 2024
@l-qing l-qing force-pushed the fix/taskRef-resolver-default-kind branch from a069789 to b66a781 Compare March 18, 2024 13:55
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Mar 18, 2024
@l-qing l-qing force-pushed the fix/taskRef-resolver-default-kind branch 4 times, most recently from b9406b2 to e79988d Compare March 20, 2024 04:26
pipeline: 1h
pipelineRef:
kind: Pipeline
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The pipelineRef does not have a kind field.

// PipelineRef can be used to refer to a specific instance of a Pipeline.
type PipelineRef struct {
// Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names
Name string `json:"name,omitempty"`
// API version of the referent
// +optional
APIVersion string `json:"apiVersion,omitempty"`
// Bundle url reference to a Tekton Bundle.
//
// Deprecated: Please use ResolverRef with the bundles resolver instead.
// +optional
Bundle string `json:"bundle,omitempty"`
// ResolverRef allows referencing a Pipeline in a remote location
// like a git repo. This field is only supported when the alpha
// feature gate is enabled.
// +optional
ResolverRef `json:",omitempty"`
}

// PipelineRef can be used to refer to a specific instance of a Pipeline.
type PipelineRef struct {
// Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names
Name string `json:"name,omitempty"`
// API version of the referent
// +optional
APIVersion string `json:"apiVersion,omitempty"`
// ResolverRef allows referencing a Pipeline in a remote location
// like a git repo. This field is only supported when the alpha
// feature gate is enabled.
// +optional
ResolverRef `json:",omitempty"`
}

@@ -49,6 +49,7 @@ func (tr *TaskRef) ConvertFrom(ctx context.Context, source v1.TaskRef) {
// default and it will be in beta before the stored version of CRD getting swapped to v1.
func (tr TaskRef) convertBundleToResolver(sink *v1.TaskRef) {
if tr.Bundle != "" {
sink.Kind = ""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove the original "kind" attribute to stay consistent with the behavior elsewhere: once a resolver is used, "kind" is no longer necessary.

@l-qing
Copy link
Contributor Author

l-qing commented Mar 20, 2024

Hi, @vdemeester.
I've resolved the e2e failure issue; please review it when you have time, thank you!

@l-qing l-qing force-pushed the fix/taskRef-resolver-default-kind branch from e79988d to dc16345 Compare March 21, 2024 15:57
@l-qing l-qing force-pushed the fix/taskRef-resolver-default-kind branch 2 times, most recently from 4242960 to 797cbd1 Compare April 9, 2024 06:25
@l-qing l-qing force-pushed the fix/taskRef-resolver-default-kind branch from 797cbd1 to da73725 Compare April 13, 2024 07:36
@l-qing l-qing force-pushed the fix/taskRef-resolver-default-kind branch from da73725 to a2b9247 Compare April 23, 2024 15:06
fix tektoncd#7762

Do not set default kind when taskRef resolver is present,
keep the original configuration of the user.
@l-qing l-qing force-pushed the fix/taskRef-resolver-default-kind branch from a2b9247 to fc03715 Compare April 24, 2024 15:29
Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

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

Looks good, thank you!
/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: afrittoli

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 25, 2024
Comment on lines +56 to 59
if pt.TaskRef.Kind == "" && pt.TaskRef.Resolver == "" {
pt.TaskRef.Kind = NamespacedTaskKind
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This will continue to work even after TEP-0154 is done

@afrittoli afrittoli added this to the Pipelines v0.59 milestone Apr 25, 2024
@chitrangpatel
Copy link
Contributor

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 25, 2024
@tekton-robot tekton-robot merged commit 91bbee5 into tektoncd:main Apr 25, 2024
13 checks passed
@l-qing l-qing deleted the fix/taskRef-resolver-default-kind branch April 25, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected Default ‘kind’ in taskRef When Using Resolver in Tekton Pipelines
5 participants