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: refine error resean with invalid pipelinename in taskrunspecs #6957

Merged
merged 1 commit into from Aug 16, 2023

Conversation

cugykw
Copy link
Contributor

@cugykw cugykw commented Jul 21, 2023

Changes

This PR tries to modify the scene where the pipelineRun containing an invalid pipeline name in taskRunSpecs displays an error mismatch.

fix: #6956

/kind bug

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

When the taskRunSpecs of the pipelineRun contains an invalid pipeline task name, the cause of the `InvalidTaskRunSpecs` error is displayed.

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

Hi @cugykw. 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/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 21, 2023
@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% 92.1% 0.3

@dibyom
Copy link
Member

dibyom commented Jul 21, 2023

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

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 Jul 21, 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 91.8% 92.1% 0.3

@cugykw
Copy link
Contributor Author

cugykw commented Jul 27, 2023

/cc @vdemeester

@@ -83,8 +83,9 @@ const (
// ReasonInvalidWorkspaceBinding indicates that a Pipeline expects a workspace but a
// PipelineRun has provided an invalid binding.
ReasonInvalidWorkspaceBinding = "InvalidWorkspaceBindings"
// ReasonInvalidServiceAccountMapping indicates that PipelineRun.Spec.TaskRunSpecs[].TaskServiceAccountName is defined with a wrong taskName
ReasonInvalidServiceAccountMapping = "InvalidServiceAccountMappings"
Copy link
Member

Choose a reason for hiding this comment

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

🤔 Couldn't this happen still ?
I understand that we were sending this error wrongly (as it could have bee n something different that invalid service account mapping, but.. could/would we have cases where issuing this error is still valid ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, i kept this reason.

Copy link
Member

Choose a reason for hiding this comment

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

I think this reason related function is removed, and deprecated? I don't see a reason to keep it.
#3028

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is indeed not used here. This commit will be deleted first, and if it is used again later, it will be added?

@cugykw cugykw force-pushed the refine-taskrunspec-err-reason branch from 5362f58 to 4caef5f Compare August 10, 2023 12:10
@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% 92.7% 0.3

@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% 92.7% 0.3

@@ -83,8 +83,9 @@ const (
// ReasonInvalidWorkspaceBinding indicates that a Pipeline expects a workspace but a
// PipelineRun has provided an invalid binding.
ReasonInvalidWorkspaceBinding = "InvalidWorkspaceBindings"
// ReasonInvalidServiceAccountMapping indicates that PipelineRun.Spec.TaskRunSpecs[].TaskServiceAccountName is defined with a wrong taskName
ReasonInvalidServiceAccountMapping = "InvalidServiceAccountMappings"
Copy link
Member

Choose a reason for hiding this comment

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

I think this reason related function is removed, and deprecated? I don't see a reason to keep it.
#3028

// ReasonInvalidTaskRunSpec indicates that PipelineRun.Spec.TaskRunSpecs[].PipelineTaskName is defined with
// a not exist taskName in pipelineSpec.
ReasonInvalidTaskRunSpec = "InvalidTaskRunSpecs"
Copy link
Member

Choose a reason for hiding this comment

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

InvalidTaskRunSpecs seems a bit vague here, we are actually validating the pipeline task name from taskrunspec is defined in pipeline tasks. I'm not sure, I won't disagree if we keep this naming..

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 ValidateTaskRunSpecs function currently only validates the name, but there may be other validations in the future? InvalidTaskRunSpecs indicates a large error type, combined with the message field to indicate a specific error?

@cugykw cugykw force-pushed the refine-taskrunspec-err-reason branch from 4caef5f to a685221 Compare August 16, 2023 01:38
@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% 92.7% 0.3

@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% 92.7% 0.3

@Yongxuanzhang
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 16, 2023
@tekton-robot tekton-robot merged commit 7884311 into tektoncd:main Aug 16, 2023
12 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/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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When there is an invalid pipelinetask name in taskRunSpecs, the cause of the error does not match.
5 participants