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

string results that can be parsed as json should not fail #5814

Merged
merged 1 commit into from
Dec 20, 2022

Conversation

Yongxuanzhang
Copy link
Member

@Yongxuanzhang Yongxuanzhang commented Nov 30, 2022

Changes

This commit fixes #5803. In tep75&76 we introduced object results. The object results is inferred from the emitted message, and if the message is of json format, then the result type could be object or array. We later validate the type with the type we defined in taskspec. So if the taskpec type is string it will fail validation. Based on the discussions in #5803, if the type in taskpec is string, we should keep the results as is and don't convert it to object or array.

/kind bug

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

Task can emit string type results that can be parsed as json.  

@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. 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 Nov 30, 2022
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 30, 2022
@Yongxuanzhang
Copy link
Member Author

/test tekton-pipeline-unit-tests

@Yongxuanzhang Yongxuanzhang marked this pull request as ready for review November 30, 2022 17:59
@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 Nov 30, 2022
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.

/meow

@tekton-robot
Copy link
Collaborator

@vdemeester: cat image

In response to this:

/meow

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 30, 2022
@Yongxuanzhang
Copy link
Member Author

/retest

@chitrangpatel
Copy link
Contributor

/approve

@Yongxuanzhang
Copy link
Member Author

@chuangw6 sorry I forgot to cc you. please take a look

Copy link
Member

@chuangw6 chuangw6 left a comment

Choose a reason for hiding this comment

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

Thanks @Yongxuanzhang !!

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.

Thank you for this.
A small nit but nothing blocking.
Would you mind updating the release notes to include what changes as opposed to what should be.
/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: afrittoli, chitrangpatel, 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 the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 14, 2022
@zhouhaibing089
Copy link
Contributor

Thanks for fixing this. This is a blocker for us to upgrade to the latest release.

I wonder whether it makes sense to add notes to the released version (since the validation was added) with additional description like Known Issues.

Task can't emit string type results that can be parsed as json 

@Yongxuanzhang
Copy link
Member Author

Yongxuanzhang commented Dec 20, 2022

Thanks for fixing this. This is a blocker for us to upgrade to the latest release.

I wonder whether it makes sense to add notes to the released version (since the validation was added) with additional description like Known Issues.

Task can't emit string type results that can be parsed as json 

Sure. @zhouhaibing089 What did you mean by adding notes to the released version?

@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 20, 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/pod/status.go 90.3% 90.4% 0.0

@zhouhaibing089
Copy link
Contributor

zhouhaibing089 commented Dec 20, 2022

@Yongxuanzhang: We tried to upgrade to v0.40.2 (the last version which still has support to v1alpha1), and this issue occured (we have enable-api-fields: alpha by the way). It is probably helpful to add a section "Known Issues" to v0.40.2 / v0.41.0 / v0.42.0 for better visibility. This is just a naive suggestion, by the way.

@Yongxuanzhang
Copy link
Member Author

Yongxuanzhang commented Dec 20, 2022

@Yongxuanzhang: We tried to upgrade to v0.40.2 (the last version which still has support to v1alpha1), and this issue occured (we have enable-api-fields: alpha by the way). It is probably helpful to add a section "Known Issues" to v0.40.2 / v0.41.0 / v0.42.0 for better visibility. This is just a naive suggestion, by the way.

Thanks! This is a great suggestion. But I'm not sure if there's such a section. How about adding it to the issue as well?

@Yongxuanzhang
Copy link
Member Author

@jerop Can we merge this into v0.43 btw? Thanks!

This commit fixes tektoncd#5803. In tep75&76 we introduced object results. The
object results is inferred from the emitted message, and if the message
is of json format, then the result type could be object or array. We
later validate the type with the type we defined in taskspec. So
if the taskpec type is string it will fail validation. Based on the
discussions in tektoncd#5803, if the type in taskpec is string, we should keep
the results as is and don't convert it to object or array.
@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/pod/status.go 90.3% 90.4% 0.0

@Yongxuanzhang Yongxuanzhang changed the title Taskresult type should be string if the type from taskspec is string string results that can be parsed as json should not fail Dec 20, 2022
@abayer
Copy link
Contributor

abayer commented Dec 20, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 20, 2022
@tekton-robot tekton-robot merged commit e36ef4b into tektoncd:main Dec 20, 2022
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. 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.

result value type is not same as defined
9 participants