-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: the label is set to the wrong pipeline name #7051
Conversation
|
Hi @0xff-dev. 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 Once the patch is verified, the new status will be reflected by the 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. |
The following is the coverage report on the affected files.
|
/kind bug |
@@ -1169,7 +1169,13 @@ func propagatePipelineNameLabelToPipelineRun(pr *v1.PipelineRun) error { | |||
case pr.Spec.PipelineSpec != nil: | |||
pr.ObjectMeta.Labels[pipeline.PipelineLabelKey] = pr.Name | |||
case pr.Spec.PipelineRef != nil && pr.Spec.PipelineRef.Resolver != "": | |||
pr.ObjectMeta.Labels[pipeline.PipelineLabelKey] = pr.Name | |||
// https://tekton.dev/docs/pipelines/cluster-resolver/#pipeline-resolution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code caters to every resolver. So removing will mean no value for git-resolver
, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, didn't consider Git's resolver. If it is universal, then this PR should not be necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we even have PipelineLabelKey
for resolvers
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the documentation, resolver is a pod that parses some data according to the configuration. So, I don't know much about adding the PipelineName tag to the resolver.
For other resolvers, is it possible that they are not associated with a pipeline, so is it reasonable to not have this label?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we can determine if the kind field is a pipeline, if not, still use the default name of PipelineRun, otherwise, we can choose the correct name of the pipeline.
spec:
pipelineRef:
params:
- name: kind
value: pipeline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it would seem like depending upon the resolver's param in the pipeline controllers code. So I am fine with not having this also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vdemeester What do you think? Do we need this or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, I agree putting a pipelinerun name to tekton.dev/pipeline
is a bit confusing. Today, this logic happens before remote resolution. I'm thinking if we can propagate this value after resolving the pipeline when using a resolver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a unit test case or test it via an existing test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ok-to-test
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
friendly ping @khrm . |
I don't think so. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0xff-dev thanks for the contribution! please add tests 🙏🏾
/assign |
@0xff-dev no need to be sorry, I didn't mean to put pressure 🙏 |
Hi @afrittoli The test case has been added, but I don't know how to test it locally, so I can only ask you to review the code and then test it through github action. |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
when PipelineRun uses ClusterResolver to parse the Pipeline, the name of the Pipeline set in the label is wrong. Signed-off-by: 0xff-dev <[email protected]>
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want a release note for this 🙏🏼
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: afrittoli, vdemeester 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 |
Done. Thanks for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Changes
when
PipelineRun
usesClusterResolver
to parse thePipeline
, the name of the Pipeline set in the label is wrong./kind bug
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes