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: the label is set to the wrong pipeline name #7051

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

0xff-dev
Copy link
Contributor

@0xff-dev 0xff-dev commented Aug 14, 2023

Changes

when PipelineRun uses ClusterResolver to parse the Pipeline, the name of the Pipeline set in the label is wrong.

/kind bug

apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  annotations:
    tekton.dev/displayName: component-rbac-gen
    tekton.dev/platforms: linux/amd64
    tekton.dev/tags: component-rbac-gen
  creationTimestamp: "2023-08-14T02:52:12Z"
  generation: 1
  labels:
    description: A_PipelineRun
    tekton.dev/pipeline: component-rbac-gen-run
  name: component-rbac-gen-run
  namespace: kube-system
  resourceVersion: "2534051"
  uid: fe33bcc4-f28d-4171-93f9-87cc73ff8510
spec:
  pipelineRef:
    params:
    - name: kind
      value: pipeline
    - name: name
      value: component-rbac-gen
    - name: namespace
      value: default
    resolver: cluster

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
  • 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

set the correct pipeline name in the pipelinerun's label.

@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label Aug 14, 2023
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 14, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: 0xff-dev / name: smoky (91b7499)

@tekton-robot
Copy link
Collaborator

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 /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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 14, 2023
@tekton-robot tekton-robot requested review from imjasonh and jerop August 14, 2023 05:26
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 92.4% 91.9% -0.4

@0xff-dev
Copy link
Contributor Author

0xff-dev commented Aug 14, 2023

/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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@khrm khrm Aug 14, 2023

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?

Copy link
Contributor Author

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?

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need this. cc @lbernick @abayer

Copy link
Member

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.

Copy link
Contributor

@khrm khrm left a 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?

Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

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

/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 Aug 14, 2023
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 92.4% 91.9% -0.4

@tekton-robot tekton-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 15, 2023
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 92.4% 91.7% -0.7

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 92.4% 91.7% -0.7

@0xff-dev
Copy link
Contributor Author

friendly ping @khrm .
Do I need to make any other changes?

@khrm
Copy link
Contributor

khrm commented Aug 21, 2023

I don't think so.
/kind bug

@tekton-robot tekton-robot added the kind/documentation Categorizes issue or PR as related to documentation. label Aug 21, 2023
@jerop jerop added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Sep 20, 2023
Copy link
Member

@jerop jerop left a 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 🙏🏾

@jerop
Copy link
Member

jerop commented Sep 20, 2023

/assign

@jerop jerop removed their assignment Nov 9, 2023
@afrittoli
Copy link
Member

@0xff-dev thank you for your PR. Are you still interested in pursuing this? As @jerop mentioned, we would need unit tests to be added.

@0xff-dev
Copy link
Contributor Author

@0xff-dev thank you for your PR. Are you still interested in pursuing this? As @jerop mentioned, we would need unit tests to be added.

I'm very sorry, I really didn't have time to work on it before, I've been working on it for the last couple days. Very sorry for not pushing for PR in time.

@afrittoli
Copy link
Member

@0xff-dev thank you for your PR. Are you still interested in pursuing this? As @jerop mentioned, we would need unit tests to be added.

I'm very sorry, I really didn't have time to work on it before, I've been working on it for the last couple days. Very sorry for not pushing for PR in time.

@0xff-dev no need to be sorry, I didn't mean to put pressure 🙏
I'm just going through all open PRs to check which are active and which are not. Thank you again for your contribution!

@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 3, 2024
@0xff-dev
Copy link
Contributor Author

0xff-dev commented Mar 3, 2024

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.

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 91.8% 91.9% 0.1

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 91.8% 91.9% 0.1

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.

/approve

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 27, 2024
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]>
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 91.8% 91.9% 0.1

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 91.8% 91.9% 0.1

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.

We may want a release note for this 🙏🏼

@tekton-robot
Copy link
Collaborator

[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:
  • OWNERS [afrittoli,vdemeester]

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 release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesnt merit a release note. labels Jul 2, 2024
@0xff-dev
Copy link
Contributor Author

0xff-dev commented Jul 2, 2024

We may want a release note for this 🙏🏼

Done. Thanks for review.

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 Jul 3, 2024
@tekton-robot tekton-robot merged commit ba7cb10 into tektoncd:main Jul 3, 2024
14 checks passed
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/documentation Categorizes issue or PR as related to documentation. 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.

7 participants