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 json annotations in WhenExpressions #3389

Merged
merged 1 commit into from
Oct 21, 2020

Conversation

jerop
Copy link
Member

@jerop jerop commented Oct 14, 2020

Changes

When a pipeline with when expressions is created in v0.16.* then it is run in a pipelinerun in v0.17.0 or v0.17.1, a pipeline validation error about missing fields would be thrown -- as reported in #3382

That happened because json annotations were added to when expressions type in v0.17.0 so that the fields would have lowercase, such as in the code completion in tekton intellij plugin as described in redhat-developer/intellij-tekton#223

Without the json annotations, the fields were stored with first letters capitalized, that is Input, Operator and Values. With the json annotations, the fields were expected to be lowercase, that is input, operator and values, causing the missing fields error in pipeline validation

As such, users would have to reapply pipelines definitions created in previous versions to make them work in v0.17.0 or v0.17.1 -- to remove this requirement, we need to support both the uppercase and lowercase first letters for the annotations

Split up the when expressions example to separate pipelinerun and pipeline to make it easier to test a pipeline created in v0.16.3 and run with these changes:

Fixes #3382

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

Release Notes

pipelines with when expressions created in v0.16.3 can be run

/kind cleanup
/cc @pritidesai @bobcatfish

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 14, 2020
Copy link
Member

@pritidesai pritidesai left a comment

Choose a reason for hiding this comment

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

thanks @jerop

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 14, 2020
@pritidesai pritidesai added the needs-cherry-pick Indicates a PR needs to be cherry-pick to a release branch label Oct 14, 2020
@pritidesai
Copy link
Member

/cc @vdemeester

@jerop
Copy link
Member Author

jerop commented Oct 15, 2020

/test pull-tekton-pipeline-go-coverage

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.

So I wonder if we should "just" revert (and cherry-pick real quick to do a 0.17.2) or if we should go for a cleaner fix.

The cleaner fix would be to have Input (DeprecatedInput field in go) and input (Input field in go) and have some code to convert the Input into input.

I am ok with both, either we get that fix for "conversion" fix in 0.17.2, or in 0.18.0 (with a revert)

@bobcatfish
Copy link
Collaborator

@vdemeester I'm torn too and am actually really interested if you have a preference.

I like that the revert will "correct" the situation to some extent without the risk of us rushing in more extensive changes (also side note i suggested this to @jerop ) - but if anyone has used when expressions with 0.17.0 or 0.17.1, i think this will be a backwards incompatible change for them. i'm not certain, but i think going from storing the fields with lowercase (0.17.0 or 0.17.1) back to uppercase (this change) would be backwards incompatible? since probably less ppl are in this situation than the other, i think it's worth it?

I agree with you re. the cleaner fix, i think that's definitely the way to go, I guess it's a question of whether it's worth an interim release that "corrects" the backwards incompatible change in the meantime 🤔 🤔 🤔

@dlorenc
Copy link
Contributor

dlorenc commented Oct 19, 2020

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 19, 2020
@jerop
Copy link
Member Author

jerop commented Oct 19, 2020

/hold (pushing the cleaner fix shortly)

@vdemeester
Copy link
Member

/hold

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 19, 2020
@vdemeester vdemeester added this to the Pipelines v0.17 milestone Oct 19, 2020
@jerop jerop force-pushed the revert-3291-json-annotation branch from b01c381 to 84734ee Compare October 19, 2020 14:40
@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 19, 2020
@jerop jerop changed the title Revert "Add missing json annotations" Fix json annotations in WhenExpressions Oct 19, 2020
@jerop
Copy link
Member Author

jerop commented Oct 19, 2020

split up the when expressions example to separate pipelinerun and pipeline to make it easier to test pipeline created in v0.16.3 and run with these changes:

@jerop jerop force-pushed the revert-3291-json-annotation branch from 84734ee to 4033ab8 Compare October 19, 2020 17:34
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pritidesai, sbwsg

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

@jerop jerop force-pushed the revert-3291-json-annotation branch from 4033ab8 to 570cc86 Compare October 19, 2020 18:17
@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/when_validation.go 100.0% 91.9% -8.1
pkg/reconciler/pipelinerun/resources/resultrefresolution.go 91.9% 92.6% 0.7

When a pipeline with when expressions is created in v0.16.* then it is
run in a pipelinerun in v0.17.0 or v0.17.1, a pipeline validation error
about missing fields would be thrown -- as reported in tektoncd#3382

That happened because json annotations were added to when expressions
type in v0.17.0 so that the fields would have lowercase, such as in the
code completion in tekton intellij plugin as described in
redhat-developer/intellij-tekton#223

Without the json annotations, the fields were stored with first letters
capitalized, that is Input, Operator and Values. With the json
annotations, the fields were expected to be lowercase, that is input,
operator and values, causing the missing fields error in pipeline
validation

As such, users would have to reapply pipelines definitions created in
previous versions to make them work in v0.17.0 or v0.17.1 -- to remove
this requirement, we need to support both the uppercase and lowercase
first letters for the annotations

Fixes tektoncd#3382
@jerop jerop force-pushed the revert-3291-json-annotation branch from 570cc86 to 4f35ed1 Compare October 19, 2020 18:30
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 19, 2020
@jerop
Copy link
Member Author

jerop commented Oct 19, 2020

/retest

@jerop
Copy link
Member Author

jerop commented Oct 19, 2020

/test pull-tekton-pipeline-go-coverage

@pritidesai
Copy link
Member

@bobcatfish @vdemeester folks have started migrating their pipelines to use when expressions with 0.16, migrating to 0.17 without this fix would break them. Thanks @jerop for implementing the cleaner fix.

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 Oct 21, 2020
@vdemeester
Copy link
Member

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 21, 2020
@tekton-robot tekton-robot merged commit 4edcbc1 into tektoncd:master Oct 21, 2020
@vdemeester vdemeester removed the needs-cherry-pick Indicates a PR needs to be cherry-pick to a release branch label Oct 21, 2020
jerop added a commit to jerop/pipeline that referenced this pull request Nov 30, 2020
We fixed the json annotations and deprecated the PascalCase fields in
tektoncd#3389 -- this change includes
these deprecations in the table for tracking
tekton-robot pushed a commit that referenced this pull request Nov 30, 2020
We fixed the json annotations and deprecated the PascalCase fields in
#3389 -- this change includes
these deprecations in the table for tracking
jerop added a commit to jerop/pipeline that referenced this pull request May 7, 2021
The fields in `WhenExpressions` were missing json annotations in
tektoncd#3135 so they were
PascalCase - relased in v0.16

The json annotations were added and supported both PascalCase and
lowercase fields for backwards compatibility in
tektoncd#3291 and
tektoncd#3389 - released in v0.17

The PascalCase fields were deprecated in v0.17, with an earliest date of
removal of Jan 07 2021 - https://github.com/tektoncd/pipeline/blob/v0.23.0/docs/deprecations.md

This change removes the deprecated PascalCase fields in `WhenExpressions`
jerop added a commit to jerop/pipeline that referenced this pull request May 7, 2021
This change removes the deprecated PascalCase fields in `WhenExpressions`

The fields in `WhenExpressions` were missing json annotations in
tektoncd#3135 so they were
PascalCase - released in v0.16

The json annotations were added and supported both PascalCase and
lowercase fields for backwards compatibility in
tektoncd#3291 and
tektoncd#3389 - released in v0.17

The PascalCase fields were deprecated in v0.17, with an earliest date of
removal of Jan 07 2021 - https://github.com/tektoncd/pipeline/blob/v0.23.0/docs/deprecations.md
jerop added a commit to jerop/pipeline that referenced this pull request May 10, 2021
This change removes the deprecated PascalCase fields in `WhenExpressions`

The fields in `WhenExpressions` were missing json annotations in
tektoncd#3135 so they were
PascalCase - released in v0.16

The json annotations were added and supported both PascalCase and
lowercase fields for backwards compatibility in
tektoncd#3291 and
tektoncd#3389 - released in v0.17

The PascalCase fields were deprecated in v0.17, with an earliest date of
removal of Jan 07 2021 - https://github.com/tektoncd/pipeline/blob/v0.23.0/docs/deprecations.md
jerop added a commit to jerop/pipeline that referenced this pull request May 11, 2021
This change removes the deprecated PascalCase fields in `WhenExpressions`

The fields in `WhenExpressions` were missing json annotations in
tektoncd#3135 so they were
PascalCase - released in v0.16

The json annotations were added and supported both PascalCase and
lowercase fields for backwards compatibility in
tektoncd#3291 and
tektoncd#3389 - released in v0.17

The PascalCase fields were deprecated in v0.17, with an earliest date of
removal of Jan 07 2021 - https://github.com/tektoncd/pipeline/blob/v0.23.0/docs/deprecations.md
jerop added a commit to jerop/pipeline that referenced this pull request May 11, 2021
This change removes the deprecated PascalCase fields in `WhenExpressions`

The fields in `WhenExpressions` were missing json annotations in
tektoncd#3135 so they were
PascalCase - released in v0.16

The json annotations were added and supported both PascalCase and
lowercase fields for backwards compatibility in
tektoncd#3291 and
tektoncd#3389 - released in v0.17

The PascalCase fields were deprecated in v0.17, with an earliest date of
removal of Jan 07 2021 - https://github.com/tektoncd/pipeline/blob/v0.23.0/docs/deprecations.md
tekton-robot pushed a commit that referenced this pull request May 11, 2021
This change removes the deprecated PascalCase fields in `WhenExpressions`

The fields in `WhenExpressions` were missing json annotations in
#3135 so they were
PascalCase - released in v0.16

The json annotations were added and supported both PascalCase and
lowercase fields for backwards compatibility in
#3291 and
#3389 - released in v0.17

The PascalCase fields were deprecated in v0.17, with an earliest date of
removal of Jan 07 2021 - https://github.com/tektoncd/pipeline/blob/v0.23.0/docs/deprecations.md
afrittoli pushed a commit to afrittoli/pipeline that referenced this pull request Jun 9, 2021
This change removes the deprecated PascalCase fields in `WhenExpressions`

The fields in `WhenExpressions` were missing json annotations in
tektoncd#3135 so they were
PascalCase - released in v0.16

The json annotations were added and supported both PascalCase and
lowercase fields for backwards compatibility in
tektoncd#3291 and
tektoncd#3389 - released in v0.17

The PascalCase fields were deprecated in v0.17, with an earliest date of
removal of Jan 07 2021 - https://github.com/tektoncd/pipeline/blob/v0.23.0/docs/deprecations.md
tekton-robot pushed a commit that referenced this pull request Jun 9, 2021
This change removes the deprecated PascalCase fields in `WhenExpressions`

The fields in `WhenExpressions` were missing json annotations in
#3135 so they were
PascalCase - released in v0.16

The json annotations were added and supported both PascalCase and
lowercase fields for backwards compatibility in
#3291 and
#3389 - released in v0.17

The PascalCase fields were deprecated in v0.17, with an earliest date of
removal of Jan 07 2021 - https://github.com/tektoncd/pipeline/blob/v0.23.0/docs/deprecations.md
@jerop jerop deleted the revert-3291-json-annotation branch June 11, 2022 01:43
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. 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.

v0.17.0 Pipeline can't be Run; it has an invalid spec: missing field(s): tasks[1].when[0]
6 participants