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

Revert removal of template.Name field and handle Deprecation of template.Name field #912

Merged
merged 2 commits into from
Jan 19, 2021

Conversation

savitaashture
Copy link
Contributor

@savitaashture savitaashture commented Jan 19, 2021

Issue: slack discussion
RootCause: https://tektoncd.slack.com/archives/CL3T51NRF/p1611039325020300?thread_ts=1610982177.013500&cid=CL3T51NRF

Changes

Reverted back changes done as part of this PR and handled Deprecation for template.Name field
Will remove template.Name field may be in the next release v0.12.0

We may need to do patch release to handle this issue

Signed-off-by: Savita Ashture sashture@redhat.com

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.

Release Notes

Deprecate template.Name in favor of template.Ref

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jan 19, 2021
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 19, 2021
@savitaashture
Copy link
Contributor Author

/cc @dibyom @khrm @MarcelMue

Spec *TriggerTemplateSpec `json:"spec,omitempty"`
// Deprecated: Use Ref instead
// To be removed in a later release #911
DeprecatedName string `json:"name,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Not blocking just wondering:
Why does the omitempty fix the problem described in slack?

Copy link
Contributor

Choose a reason for hiding this comment

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

Because omitempty ensures that when this struct is store, it stores nothing related to DeprecatedName field but Ref using defaults. Previously, default wasn't working properly because it stored "".

Copy link
Member

Choose a reason for hiding this comment

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

What I mean is: We have removed the name field completely already, creating a new CR should therefore not have the field anymore. So even if it was stored with "" we should fix anything going wrong in that case.

Readding the field here kind of implies that users first need to upgrade to this specific version before updating to the next minor.

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 we can recommend the user to directly upgrade to v0.11.0 from v0.10.2

Copy link
Member

Choose a reason for hiding this comment

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

So then it would make sense to put this change into v0.10.3 instead of v0.11.1, right?

Copy link
Member

Choose a reason for hiding this comment

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

yeah doing a 0.10.3 is also an option. Though that would mean users would first have to move to v0.10.3 and then to v0.11.0/v0.11.1

@tekton-robot tekton-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 19, 2021
@@ -30,6 +30,7 @@ func (el *EventListener) SetDefaults(ctx context.Context) {
for i := range el.Spec.Triggers {
triggerSpecBindingArray(el.Spec.Triggers[i].Bindings).
defaultBindings()
templateNameToRef(el.Spec.Triggers[i].Template)
Copy link
Contributor

Choose a reason for hiding this comment

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

Call this function only if there's Template isn't nil. I think that's why test is failing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes its failing because of that

Updating

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 19, 2021
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: khrm

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

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_defaults.go 100.0% 95.8% -4.2
pkg/apis/triggers/v1alpha1/trigger_validation.go 94.0% 94.4% 0.3

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/trigger_validation.go 94.0% 94.4% 0.3

@dibyom
Copy link
Member

dibyom commented Jan 19, 2021

Summarizing the issue here:

We had logic in triggers_default.go to change template.Name to template.Ref. But because the Name field did not have a omitempty tag, the resource still contained a Name: "" field. This makes it impossible to upgrade running trigger resources from v0.10.2 to v0.11.0

(another candidate for #619)

@dibyom
Copy link
Member

dibyom commented Jan 19, 2021

EasyCLA Expected — Waiting for status to be reported

🙄

@dibyom
Copy link
Member

dibyom commented Jan 19, 2021

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 19, 2021
@MarcelMue
Copy link
Member

Fine with me - I think it's the easiest way forward for users.

/lgtm

@dibyom
Copy link
Member

dibyom commented Jan 19, 2021

Gonna try to close/re-open this PR for trigger the CLA again

@dibyom dibyom closed this Jan 19, 2021
@dibyom dibyom reopened this Jan 19, 2021
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/trigger_validation.go 94.0% 94.4% 0.3

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 19, 2021
@savitaashture
Copy link
Contributor Author

Gonna try to close/re-open this PR for trigger the CLA again

I have done force push

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/trigger_validation.go 94.0% 94.4% 0.3

@dibyom
Copy link
Member

dibyom commented Jan 19, 2021

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 19, 2021
@tekton-robot tekton-robot merged commit 530737b into tektoncd:release-v0.11.x Jan 19, 2021
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. 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.

None yet

5 participants