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

[TEP-0048] Add support for default results #5620

Closed
wants to merge 1 commit into from

Conversation

vinamra28
Copy link
Member

@vinamra28 vinamra28 commented Oct 9, 2022

Changes

Today, a Task can declare a Result but not produce it and it's execution
will still be successful whereas if a subsequent Task in a Pipeline
attempts to use that Result it will fail. This behaviour can be
confusing to the users as the Task which didn't produced the Result
passed and the follow-up Task fails. Moreover, the user of the Task will
loose faith in it as it failed to produce what it's claiming.

This patch introduces the default results, ie, Task author can now add a
default value to the results so that if their Task doesn't produce any
result then the default value can be emitted. Now, with this change, if
the Task author doesn't specifies any default value for the result and
one of the step within that Task also doesn't produces it then
the Task execution in whole will be marked as failed as it failed to
prove it's contract.

For more, please refer TEP-0048

/kind feature

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

Add support for default results so that if a Task doesn't produce then default results can prevent the Task from failing

@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 Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. labels Oct 9, 2022
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign imjasonh after the PR has been reviewed.
You can assign the PR to them by writing /assign @imjasonh in a comment when ready.

The full list of commands accepted by this bot can be found 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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 9, 2022
@vinamra28
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/apis/pipeline/v1beta1/result_conversion.go 100.0% 68.2% -31.8
pkg/reconciler/taskrun/taskrun.go 81.7% 79.5% -2.2

@vinamra28
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/apis/pipeline/v1beta1/result_conversion.go 100.0% 68.2% -31.8
pkg/reconciler/taskrun/taskrun.go 81.7% 79.5% -2.2

@vinamra28
Copy link
Member Author

/test tekton-pipeline-unit-tests

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 11, 2022
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 12, 2022
@vinamra28
Copy link
Member Author

/test pull-tekton-pipeline-alpha-integration-tests

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 19, 2022
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 23, 2022
@vinamra28
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/apis/pipeline/v1beta1/result_conversion.go 100.0% 68.2% -31.8
pkg/reconciler/taskrun/taskrun.go 81.3% 80.8% -0.5
pkg/reconciler/taskrun/validate_resources.go 98.5% 97.8% -0.7

@vinamra28
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/apis/pipeline/v1beta1/result_conversion.go 100.0% 68.2% -31.8
pkg/reconciler/taskrun/taskrun.go 81.3% 80.8% -0.5
pkg/reconciler/taskrun/validate_resources.go 98.5% 97.8% -0.7

@vinamra28 vinamra28 marked this pull request as ready for review October 23, 2022 10:48
@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 Oct 23, 2022
@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/apis/pipeline/v1beta1/result_conversion.go 100.0% 68.2% -31.8
pkg/reconciler/taskrun/taskrun.go 81.3% 81.0% -0.3
pkg/reconciler/taskrun/validate_resources.go 98.5% 98.5% 0.1

@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/apis/pipeline/v1beta1/result_conversion.go 100.0% 68.2% -31.8
pkg/reconciler/taskrun/taskrun.go 81.3% 80.5% -0.7
pkg/reconciler/taskrun/validate_resources.go 98.5% 98.5% 0.1

@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/apis/pipeline/v1beta1/result_conversion.go 100.0% 68.2% -31.8
pkg/reconciler/taskrun/taskrun.go 81.3% 80.5% -0.7
pkg/reconciler/taskrun/validate_resources.go 98.5% 98.5% 0.1

@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/apis/pipeline/v1beta1/result_conversion.go 100.0% 68.2% -31.8
pkg/reconciler/taskrun/taskrun.go 81.3% 80.5% -0.7
pkg/reconciler/taskrun/validate_resources.go 98.5% 98.5% 0.1

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 3, 2022
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 5, 2022
@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/apis/pipeline/v1beta1/result_conversion.go 100.0% 68.2% -31.8
pkg/reconciler/taskrun/taskrun.go 81.4% 80.7% -0.7
pkg/reconciler/taskrun/validate_resources.go 98.5% 98.5% 0.1

@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/apis/pipeline/v1beta1/result_conversion.go 100.0% 92.6% -7.4
pkg/reconciler/taskrun/taskrun.go 81.4% 80.7% -0.7
pkg/reconciler/taskrun/validate_resources.go 98.5% 98.5% 0.1

Today, a Task can declare a Result but not produce it and it's execution
will still be successful whereas if a subsequent Task in a Pipeline
attempts to use that Result it will fail. This behaviour can be
confusing to the users as the Task which didn't produced the Result
passed and the follow-up Task fails. Moreover, the user of the Task will
loose faith in it as it failed to produce what it's claiming.

This patch introduces the default results, ie, Task author can now add a
default value to the results so that if their Task doesn't produce any
result then the default value can be emitted. Now, with this change, if
the Task author doesn't specifies any default value for the result and
one of the step within that Task also doesn't produces it then
the Task execution in whole will be marked as failed as it failed to
prove it's contract.
@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/taskrun/taskrun.go 81.4% 80.7% -0.7
pkg/reconciler/taskrun/validate_resources.go 98.5% 98.5% 0.1

}
r.Default.ObjectVal = defaults
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems to be the same logic as in lines 18:34. May be wrap it into a function and call it here?

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 29, 2022
@tekton-robot
Copy link
Collaborator

@vinamra28: PR needs rebase.

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.

image: bash:latest
script: |
#!/usr/bin/env bash
echo -n "this script won't emit array result"
Copy link
Contributor

Choose a reason for hiding this comment

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

I wanted to highlight the issue #3497 which probably seems to go against this example?

Copy link
Contributor

Choose a reason for hiding this comment

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

The discussion in that issue hasn't come to a conclusion so this might be ok for now. I wonder if your examples could genuinely error out and the steps have an onError --> continue and then have the default result use?

Type: tR.Type,
Value: *tR.Default,
})
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this part needs to be tested. Seems to be missing in the coverage report.

Copy link
Contributor

Choose a reason for hiding this comment

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

ie.the test case needs to triggerif tR.Default != nil {

@jerop
Copy link
Member

jerop commented Feb 2, 2023

@vinamra28 we discussed taking a different approach for default results - closing this pull request as we await the TEP update (feel free to reopen if we end up continuing with this approach, just trying to clean up the repo) 🙏🏾

/close

@tekton-robot
Copy link
Collaborator

@jerop: Closed this PR.

In response to this:

@vinamra28 we discussed taking a different approach for default results - closing this pull request as we await the TEP update (feel free to reopen if we end up continuing with this approach, just trying to clean up the repo) 🙏🏾

/close

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.

@vdemeester
Copy link
Member

@vinamra28 we discussed taking a different approach for default results - closing this pull request as we await the TEP update (feel free to reopen if we end up continuing with this approach, just trying to clean up the repo) 🙏🏾

Who is we and is anyone is working on this ?

@vdemeester vdemeester reopened this Feb 20, 2023
@tekton-robot
Copy link
Collaborator

@vinamra28: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-tekton-pipeline-build-tests 78cb4b1 link true /test pull-tekton-pipeline-build-tests
pull-tekton-pipeline-go-coverage 78cb4b1 link false /test pull-tekton-pipeline-go-coverage
pull-tekton-pipeline-unit-tests 78cb4b1 link true /test tekton-pipeline-unit-tests
pull-tekton-pipeline-integration-tests 78cb4b1 link true /test pull-tekton-pipeline-integration-tests
pull-tekton-pipeline-beta-integration-tests 78cb4b1 link true /test pull-tekton-pipeline-beta-integration-tests
pull-tekton-pipeline-alpha-integration-tests 78cb4b1 link true /test pull-tekton-pipeline-alpha-integration-tests

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@vdemeester vdemeester closed this Feb 20, 2023
@vinamra28
Copy link
Member Author

@vinamra28 we discussed taking a different approach for default results - closing this pull request as we await the TEP update (feel free to reopen if we end up continuing with this approach, just trying to clean up the repo) 🙏🏾

Who is we and is anyone is working on this ?

@vdemeester here we refers to me and @jerop 😅

@vinamra28 vinamra28 deleted the default-results branch February 20, 2023 15:01
@vdemeester
Copy link
Member

@vinamra28 ah ok 🙃 😬 Anything we can do to help there ? (on updating the TEP, …)

@jerop
Copy link
Member

jerop commented Feb 21, 2023

@vinamra28 ah ok 🙃 😬 Anything we can do to help there ? (on updating the TEP, …)

@vdemeester you can help by reviewing this TEP update: tektoncd/community#954 🙏🏾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants