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

don't return validation error when taskrun failed/skipped #6395

Merged
merged 1 commit into from
May 18, 2023

Conversation

Yongxuanzhang
Copy link
Member

@Yongxuanzhang Yongxuanzhang commented Mar 20, 2023

Changes

This commit aims to fix #6383, #6139 and supports #3749. This commits skip the validation if the taskrun is not successful (e.g. failed or skipped) and omit the pipelinerun coresponding result. This way the skipped taskrun won't get validation error for pipelinerun. And the pipelinerun error won't be overwritten by the validation error.

/kind bug

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com

Submitter Checklist

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

  • Has Docs included if any changes are user facing
  • 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)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

If taskrun fails and task results not emitted, pipelinerun fails because of taskrun fails rather than results validation error.

@tekton-robot
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. kind/bug Categorizes issue or PR as related to a bug. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Mar 20, 2023
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 20, 2023
@Yongxuanzhang
Copy link
Member Author

/test all

@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/resources/apply.go 98.1% 96.7% -1.4

@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/resources/apply.go 98.1% 96.7% -1.4

@Yongxuanzhang Yongxuanzhang force-pushed the 6383-fix branch 2 times, most recently from 2ad0e55 to 455e0e0 Compare March 20, 2023 19:11
@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 Mar 20, 2023
@Yongxuanzhang Yongxuanzhang marked this pull request as ready for review March 20, 2023 19:14
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 20, 2023
@tekton-robot
Copy link
Collaborator

The following Tekton test failed:

Test name Commit Details Required Rerun command
pull-tekton-pipeline-go-coverage-df 455e0e0 link true /test pull-tekton-pipeline-go-coverage-df

@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/resources/apply.go 98.1% 98.1% 0.0

@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/resources/apply.go 98.1% 98.1% 0.0

@Yongxuanzhang
Copy link
Member Author

/retest

@Yongxuanzhang
Copy link
Member Author

Hi @pritidesai, @vdemeester , could you help me take a look at this PR and see if it could be a fix for those issues? Comments and suggestions are welcome!

@vdemeester
Copy link
Member

@Yongxuanzhang @pritidesai does it make sense to cherry-pick this for 0.41 and 0.44 (LTS), 0.45 and 0.46 ? (as this is a behavior something that changed)

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.

I would love to have one more yaml for regression test, but other than this, LGTM I think

Comment on lines 3923 to 3932
}, {
description: "unsuccessful-taskrun-no-returned-result",
results: []v1beta1.PipelineResult{{
Name: "foo",
Value: *v1beta1.NewStructuredValues("$(tasks.pt1.results.foo)"),
}},
taskResults: map[string][]v1beta1.TaskRunResult{},
expectedResults: nil,
expectedError: fmt.Errorf("invalid pipelineresults [foo], the referred results don't exist"),
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we "update" that Test, the expected Error should, however change (not invalid result, but something else) ? But maybe this is not at the same level.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't remember why I removed this test, could be a mistake

Copy link
Member Author

Choose a reason for hiding this comment

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

added this back

@Yongxuanzhang
Copy link
Member Author

We better have an e2e test for this pr

@vdemeester
Copy link
Member

@Yongxuanzhang Any update on this ?

@jerop jerop added this to the Pipelines v0.47 milestone Apr 12, 2023
@QuanZhang-William
Copy link
Member

/assign

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 2, 2023
@Yongxuanzhang
Copy link
Member Author

Hi @pritidesai, wonder if you have availability/interested to review this PR ? Thanks!

@pritidesai
Copy link
Member

/assign @pritidesai

taskstatus: map[string]string{resources.PipelineTaskStatusPrefix + "pt1" + resources.PipelineTaskStatusSuffix: v1beta1.TaskRunReasonFailed.String()},
expectedResults: nil,
}, {
description: "unsuccessful-taskrun-with-results",
Copy link
Member

Choose a reason for hiding this comment

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

thank you for adding this test case which will be add more value and affirmation to #6510

@pritidesai
Copy link
Member

@Yongxuanzhang Sorry for the delay 🙏

Thanks a bunch for adding an example and also e2e test, it was very helpful in reviewing this PR.

/lgtm

once this is merged, let's cherry pick this into 0.41, 0.44, and 0.47, thanks!

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label May 18, 2023
@pritidesai pritidesai added the needs-cherry-pick Indicates a PR needs to be cherry-pick to a release branch label May 18, 2023
@tekton-robot tekton-robot merged commit e61deda into tektoncd:main May 18, 2023
@pritidesai
Copy link
Member

/cherry-pick release-v0.41.x

@pritidesai
Copy link
Member

/cherry-pick release-v0.44.x

@pritidesai
Copy link
Member

/cherry-pick release-v0.47.x

@tekton-robot
Copy link
Collaborator

@pritidesai: #6395 failed to apply on top of branch "release-v0.41.x":

Applying: don't return validation error when taskrun failed/skipped
Using index info to reconstruct a base tree...
M	pkg/reconciler/pipelinerun/pipelinerun.go
M	pkg/reconciler/pipelinerun/resources/apply.go
M	pkg/reconciler/pipelinerun/resources/apply_test.go
M	test/pipelinerun_test.go
Falling back to patching base and 3-way merge...
Auto-merging test/pipelinerun_test.go
Auto-merging pkg/reconciler/pipelinerun/resources/apply_test.go
CONFLICT (content): Merge conflict in pkg/reconciler/pipelinerun/resources/apply_test.go
Auto-merging pkg/reconciler/pipelinerun/resources/apply.go
CONFLICT (content): Merge conflict in pkg/reconciler/pipelinerun/resources/apply.go
Auto-merging pkg/reconciler/pipelinerun/pipelinerun.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 don't return validation error when taskrun failed/skipped
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-v0.41.x

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
Copy link
Collaborator

@pritidesai: #6395 failed to apply on top of branch "release-v0.44.x":

Applying: don't return validation error when taskrun failed/skipped
Using index info to reconstruct a base tree...
M	pkg/reconciler/pipelinerun/pipelinerun.go
M	pkg/reconciler/pipelinerun/resources/apply.go
M	pkg/reconciler/pipelinerun/resources/apply_test.go
M	test/pipelinerun_test.go
Falling back to patching base and 3-way merge...
Auto-merging test/pipelinerun_test.go
Auto-merging pkg/reconciler/pipelinerun/resources/apply_test.go
CONFLICT (content): Merge conflict in pkg/reconciler/pipelinerun/resources/apply_test.go
Auto-merging pkg/reconciler/pipelinerun/resources/apply.go
Auto-merging pkg/reconciler/pipelinerun/pipelinerun.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 don't return validation error when taskrun failed/skipped
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-v0.44.x

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
Copy link
Collaborator

@pritidesai: new pull request created: #6688

In response to this:

/cherry-pick release-v0.47.x

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.

Yongxuanzhang added a commit to Yongxuanzhang/pipeline that referenced this pull request Nov 23, 2023
This commit closes tektoncd#6139, in previous fix PR:
tektoncd#6395, only dagTasks statuses
are considered and final tasks are missing. This PR fixes this.

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
Yongxuanzhang added a commit to Yongxuanzhang/pipeline that referenced this pull request Dec 6, 2023
This commit closes tektoncd#6139, in previous fix PR:
tektoncd#6395, only dagTasks statuses
are considered and final tasks are missing. This PR fixes this.

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
tekton-robot pushed a commit that referenced this pull request Dec 8, 2023
This commit closes #6139, in previous fix PR:
#6395, only dagTasks statuses
are considered and final tasks are missing. This PR fixes this.

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
tekton-robot pushed a commit to tekton-robot/pipeline that referenced this pull request Dec 13, 2023
This commit closes tektoncd#6139, in previous fix PR:
tektoncd#6395, only dagTasks statuses
are considered and final tasks are missing. This PR fixes this.

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
tekton-robot pushed a commit to tekton-robot/pipeline that referenced this pull request Dec 13, 2023
This commit closes tektoncd#6139, in previous fix PR:
tektoncd#6395, only dagTasks statuses
are considered and final tasks are missing. This PR fixes this.

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
tekton-robot pushed a commit that referenced this pull request Dec 13, 2023
This commit closes #6139, in previous fix PR:
#6395, only dagTasks statuses
are considered and final tasks are missing. This PR fixes this.

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
tekton-robot pushed a commit that referenced this pull request Dec 13, 2023
This commit closes #6139, in previous fix PR:
#6395, only dagTasks statuses
are considered and final tasks are missing. This PR fixes this.

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
vdemeester pushed a commit to vdemeester/tektoncd-pipeline that referenced this pull request Dec 13, 2023
This commit closes tektoncd#6139, in previous fix PR:
tektoncd#6395, only dagTasks statuses
are considered and final tasks are missing. This PR fixes this.

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
(cherry picked from commit 7c040de)
vdemeester pushed a commit to vdemeester/tektoncd-pipeline that referenced this pull request Dec 13, 2023
This commit closes tektoncd#6139, in previous fix PR:
tektoncd#6395, only dagTasks statuses
are considered and final tasks are missing. This PR fixes this.

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
(cherry picked from commit 7c040de)
Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
tekton-robot pushed a commit to tekton-robot/pipeline that referenced this pull request Dec 20, 2023
This commit closes tektoncd#6139, in previous fix PR:
tektoncd#6395, only dagTasks statuses
are considered and final tasks are missing. This PR fixes this.

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
tekton-robot pushed a commit that referenced this pull request Dec 20, 2023
This commit closes #6139, in previous fix PR:
#6395, only dagTasks statuses
are considered and final tasks are missing. This PR fixes this.

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
tekton-robot pushed a commit that referenced this pull request Jan 3, 2024
This commit closes #6139, in previous fix PR:
#6395, only dagTasks statuses
are considered and final tasks are missing. This PR fixes this.

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
(cherry picked from commit 7c040de)
Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
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. needs-cherry-pick Indicates a PR needs to be cherry-pick to a release branch release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pipelineruns with failed task with result fails on PipelineValidationFailed reason, hiding the failure
7 participants