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

Bug 1918639: add missing trigger types and update the optional fields #7889

Merged

Conversation

karthikjeeyar
Copy link
Contributor

@karthikjeeyar karthikjeeyar commented Jan 21, 2021

Fixes:
https://issues.redhat.com/browse/ODC-5350

Analysis / Root cause:
Event listeners has an optional triggerRef field which is not compatible in UI code causes the UI to crash

Solution Description:
Add the missing trigger types such as triggerRef and update the checks for optional fields.

Screen shots / Gifs for design review:
Eventlistener page:
image

Test setup:

  1. Create an eventlistener with the yaml
apiVersion: triggers.tekton.dev/v1alpha1
kind: EventListener
metadata:
  name: vote-app
spec:
  serviceAccountName: pipeline
  triggers:
    - triggerRef: vote-app

Unit test cases:

EventListener Details
✓ should render eventlistener details page (25ms)
✓ should not render EventListenerTriggers section if the trigger contains binding ref (4ms)
✓ should not render EventListenerTriggers section if triggers contains triggerRef (3ms)

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@karthikjeeyar
Copy link
Contributor Author

/kind bug
/assign @andrewballantyne

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 21, 2021
@karthikjeeyar karthikjeeyar changed the title add missing trigger types and update the optional fields Bug 1918639: add missing trigger types and update the optional fields Jan 21, 2021
@openshift-ci-robot openshift-ci-robot added bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Jan 21, 2021
@openshift-ci-robot
Copy link
Contributor

@karthikjeeyar: This pull request references Bugzilla bug 1918639, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1918639: add missing trigger types and update the optional fields

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.

@andrewballantyne
Copy link
Contributor

This is a feature implementation. I discussed with @karthikjeeyar for us to focus on the fix here as a means not to crash the UI if they used the feature we don't support. Updating types are likely to stay as they are not user-facing and will help us not whitescreen.

@karthikjeeyar karthikjeeyar force-pushed the fix-trigger-ref branch 2 times, most recently from 186df13 to e69a9e3 Compare January 22, 2021 12:47
@openshift-ci-robot
Copy link
Contributor

@karthikjeeyar: This pull request references Bugzilla bug 1918639, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1918639: add missing trigger types and update the optional fields

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.

@karthikjeeyar
Copy link
Contributor Author

karthikjeeyar commented Jan 22, 2021

@andrewballantyne I've updated the code to handle the UI crashes, conditional rendering of the supported resource-links in the evenlistener details page.

@@ -24,7 +24,7 @@ const EventListenerTriggers: React.FC<EventListenerTriggersProps> = ({ namespace
<dd>
{triggers.map((trigger) => {
const triggerTemplateKind = referenceForModel(TriggerTemplateModel);
const triggerTemplateName = trigger.template.name;
const triggerTemplateName = trigger.template?.name;
Copy link
Contributor

Choose a reason for hiding this comment

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

If you don't have a template name, I think we need to return null to just kill this node. No sense in trying to craft a broken block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

filtering triggers based on template?.name and returning null early on in the component, so that <dt>Tiggers <dt> is also not rendered.

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 there was a misunderstanding here.

You made this trigger.template?.name optional, but it will fail to render properly if the triggerTemplateName is undefined. So we have to do something about the iterations of this map that do NOT have a triggerTemplateName.

My recommendation is you return null and drop this iteration from rendering a broken link. I'm open to other suggestions, but we can't just leave it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You made this trigger.template?.name optional, but it will fail to render properly if the triggerTemplateName is undefined. So we have to do something about the iterations of this map that do NOT have a triggerTemplateName.

I am filtering out the tirggers based on tempate.name on the top of this component now. so the map will only contain the set of triggers that consists of template.name.

// Ref is used since Tekton Triggers 0.5 (part of OpenShift Pipeline Operator 1.1)
ref: string;
// Mutually exclusive with Name
Copy link
Contributor

Choose a reason for hiding this comment

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

deleted my comment (see comment history if you care to read it) There was type compilation issues I didn't see before, probably not worth the hassle.

Honestly we probably won't keep this for much longer. Perhaps part of the new parity support in 4.8 we remove the legacy type.

@@ -24,7 +24,7 @@ const EventListenerTriggers: React.FC<EventListenerTriggersProps> = ({ namespace
<dd>
{triggers.map((trigger) => {
const triggerTemplateKind = referenceForModel(TriggerTemplateModel);
const triggerTemplateName = trigger.template.name;
const triggerTemplateName = trigger.template?.name;
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 there was a misunderstanding here.

You made this trigger.template?.name optional, but it will fail to render properly if the triggerTemplateName is undefined. So we have to do something about the iterations of this map that do NOT have a triggerTemplateName.

My recommendation is you return null and drop this iteration from rendering a broken link. I'm open to other suggestions, but we can't just leave it.

@jerolimov
Copy link
Member

/retest

@jerolimov
Copy link
Member

/cc

@karthikjeeyar
Copy link
Contributor Author

karthikjeeyar commented Jan 29, 2021

You made this trigger.template?.name optional, but it will fail to render properly if the triggerTemplateName is undefined. So we have to do something about the iterations of this map that do NOT have a triggerTemplateName.

@andrewballantyne I removed optional chaining as I have checks in the top of the component to early return null, if the template.name is not available in the triggers.

Copy link
Contributor

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

Thanks @karthikjeeyar Looks good 👍

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 29, 2021
@andrewballantyne
Copy link
Contributor

/retest

@spadgett
Copy link
Member

/override ci/prow/ceph-storage-plugin

The ceph-storage-plugin job should only have run on PRs with changes to frontend/packages/ceph-storage-plugin. It failed due to an unrelated CI config change. Overriding status on this PR.

@openshift-ci-robot
Copy link
Contributor

@spadgett: Overrode contexts on behalf of spadgett: ci/prow/ceph-storage-plugin

In response to this:

/override ci/prow/ceph-storage-plugin

The ceph-storage-plugin job should only have run on PRs with changes to frontend/packages/ceph-storage-plugin. It failed due to an unrelated CI config change. Overriding status on this PR.

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.

@andrewballantyne
Copy link
Contributor

/retest

@spadgett
Copy link
Member

/override ci/prow/ceph-storage-plugin

@openshift-ci-robot
Copy link
Contributor

@spadgett: Overrode contexts on behalf of spadgett: ci/prow/ceph-storage-plugin

In response to this:

/override ci/prow/ceph-storage-plugin

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.

@invincibleJai
Copy link
Member

/lgtm

Verified locally, works as expected

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 1, 2021
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewballantyne, invincibleJai, karthikjeeyar

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

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 886ea30 into openshift:master Feb 1, 2021
@openshift-ci-robot
Copy link
Contributor

@karthikjeeyar: All pull requests linked via external trackers have merged:

Bugzilla bug 1918639 has been moved to the MODIFIED state.

In response to this:

Bug 1918639: add missing trigger types and update the optional fields

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.

@andrewballantyne
Copy link
Contributor

/cherry-pick release-4.6

@openshift-cherrypick-robot

@andrewballantyne: #7889 failed to apply on top of branch "release-4.6":

Applying: add missing trigger types and update the optional fields
Using index info to reconstruct a base tree...
A	frontend/packages/pipelines-plugin/src/components/pipelines/detail-page-tabs/EventListenerDetails.tsx
A	frontend/packages/pipelines-plugin/src/components/pipelines/detail-page-tabs/EventListenerTriggers.tsx
A	frontend/packages/pipelines-plugin/src/components/pipelines/resource-types/triggers.ts
A	frontend/packages/pipelines-plugin/src/components/pipelines/utils/triggers.ts
Falling back to patching base and 3-way merge...
Auto-merging frontend/packages/dev-console/src/components/pipelines/utils/triggers.ts
CONFLICT (content): Merge conflict in frontend/packages/dev-console/src/components/pipelines/utils/triggers.ts
Auto-merging frontend/packages/dev-console/src/components/pipelines/detail-page-tabs/EventListenerTriggers.tsx
CONFLICT (content): Merge conflict in frontend/packages/dev-console/src/components/pipelines/detail-page-tabs/EventListenerTriggers.tsx
Auto-merging frontend/packages/dev-console/src/components/pipelines/detail-page-tabs/EventListenerDetails.tsx
CONFLICT (content): Merge conflict in frontend/packages/dev-console/src/components/pipelines/detail-page-tabs/EventListenerDetails.tsx
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 add missing trigger types and update the optional fields
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-4.6

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.

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. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants