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 1878700: Fix Add Pipeline Trigger for Pipeline Operator 1.1 #6612

Merged
merged 1 commit into from Sep 18, 2020

Conversation

jerolimov
Copy link
Member

@jerolimov jerolimov commented Sep 14, 2020

Fixes:
https://issues.redhat.com/browse/ODC-4496
https://bugzilla.redhat.com/show_bug.cgi?id=1878700

Analysis / Root cause:
With the OpenShift Pipeline Operator 1.1 a new version of Pipeline Trigger CRDs was released. The new version was 0.6.

In 0.5.0 (we didn't see this version in the Operator) they deprecated {{spec.triggers[].bindings[].name}}.

In 0.6.0 (TP2 - 1.1 of the Operator) it has been removed in favour of deprecated {{spec.triggers[].bindings[].ref}}.

So we need to change the EventListener generation (source code) in a way we support OpenShift Pipeline Operator 1.0 and 1.1.

Solution Description:
The code checks the installed OpenShift Pipeline Operator version. If it finds the version 0.x or 1.0.x it uses the old EventListener format, and the new one format otherwise (also in the case the Operator version check fails).

Screen shots / Gifs for design review:
No visual change here.

Unit test coverage report:
Add new tests for the new getPipelineOperatorVersion method.

 PASS  packages/dev-console/src/components/pipelines/__tests__/pipeline-operator.spec.ts
  getPipelineOperatorVersion
    ✓ should fetch the ClusterServiceVersion from the api (1ms)
    ✓ should return the active ClusterServiceVersion if multiple returns (1ms)
    ✓ should fetch the latest (highest) ClusterServiceVersion from the api
    ✓ should return null if there is no ClusterServiceVersion available (1ms)
    ✓ should return null if there is no matching ClusterServiceVersion available

Test setup:

  • Add the OpenShift Pipeline Operator in the Version 1.0 and 1.1.
  • Create a new Pipeline
  • Add a trigger

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci-robot openshift-ci-robot added the bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. label Sep 14, 2020
@openshift-ci-robot
Copy link
Contributor

@jerolimov: This pull request references Bugzilla bug 1878700, 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.6.0) matches configured target release for branch (4.6.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 1878700: Fix Pipeline Triggers for Pipeline Operator 1.1

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.

@openshift-ci-robot openshift-ci-robot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/dev-console Related to dev-console labels Sep 14, 2020
@openshift-ci-robot
Copy link
Contributor

@jerolimov: This pull request references Bugzilla bug 1878700, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.6.0) matches configured target release for branch (4.6.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 1878700: Fix Pipeline Triggers for Pipeline Operator 1.1

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.

@jerolimov
Copy link
Member Author

/retest

@jerolimov jerolimov changed the title Bug 1878700: Fix Pipeline Triggers for Pipeline Operator 1.1 Bug 1878700: Fix Add Pipeline Trigger for Pipeline Operator 1.1 Sep 14, 2020
@jerolimov
Copy link
Member Author

/retest

1 similar comment
@jerolimov
Copy link
Member Author

/retest

@andrewballantyne
Copy link
Contributor

@jerolimov You have TS errors, I think it's causing the whole CI stack to fail:

ERROR in /go/src/github.com/openshift/console/frontend/packages/dev-console/src/components/pipelines/utils/triggers.ts
(171,19): Property 'name' does not exist on type 'EventListenerKindBindingReference'.
ERROR in /go/src/github.com/openshift/console/frontend/packages/dev-console/src/components/pipelines/utils/triggers.ts
(199,20): Property 'name' does not exist on type 'EventListenerKindBindingReference'.

@jerolimov jerolimov force-pushed the odc-4496 branch 2 times, most recently from 2baac48 to 1fb87f6 Compare September 14, 2020 18:21
@jerolimov
Copy link
Member Author

You have TS errors, I think it's causing the whole CI stack to fail:

@andrewballantyne Thanks for that hint. :) Fixed the TS error. This fixes also an issue that the ClusterTriggerBinding name (or now ref) was not shown on the EventListener detail page. We talked about this issue already.

Previously it does not show the name for Pipeline Triggers which was created with 1.1.

I noticed that Pipeline Triggers which was created with 1.0 does not run in 1.1. But this is true for all Pipeline objects I think. The pipelines itself also doesn't work after the update. Since everything is Tech Preview and Alpha here I think this is "okayish"

@jerolimov
Copy link
Member Author

/retest

1 similar comment
@jerolimov
Copy link
Member Author

/retest

@jerolimov
Copy link
Member Author

/kind bug

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 15, 2020
Comment on lines +33 to +39
ref: string;
// We also support older operators, so need to show & save the old field as well.
// https://github.com/tektoncd/triggers/pull/603/files
// https://github.com/tektoncd/triggers/releases/tag/v0.5.0 and
// https://github.com/tektoncd/triggers/releases/tag/v0.6.0
/** @deprecated use ref instead */
name?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if we might be able to use keyof here, or would it become too verbose? Especially since name is deprecated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't know what the solution looks like then. But the usage in triggers.ts works fine with name and at least VScode shows these deprecated hint. But I'm open to see and try an example here. /me open the TS keyof definition :)

@jerolimov jerolimov changed the title Bug 1878700: Fix Add Pipeline Trigger for Pipeline Operator 1.1 [WIP] Bug 1878700: Fix Add Pipeline Trigger for Pipeline Operator 1.1 Sep 15, 2020
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 15, 2020
@jerolimov
Copy link
Member Author

The current solution uses the Tekton CRD version labels. Unfortunately these are not readable for all users / developers. Will change the solution and remove the WIP label after that.

@jerolimov jerolimov force-pushed the odc-4496 branch 3 times, most recently from 39ab213 to 2468828 Compare September 16, 2020 11:40
@openshift-ci-robot
Copy link
Contributor

@jerolimov: This pull request references Bugzilla bug 1878700, which is valid.

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

In response to this:

[WIP] Bug 1878700: Fix Add Pipeline Trigger for Pipeline Operator 1.1

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.

@jerolimov jerolimov changed the title [WIP] Bug 1878700: Fix Add Pipeline Trigger for Pipeline Operator 1.1 Bug 1878700: Fix Add Pipeline Trigger for Pipeline Operator 1.1 Sep 16, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 16, 2020
expect(k8sList).toHaveBeenCalledTimes(1);
});

it('should return null if there is no matching ClusterServiceVersion available', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you write one more test for valid items but not including a Pipeline Operator? I think you covered both sides (none and mixed), but I think there is still valid test possible here for just invalid ones.

Copy link
Member Author

Choose a reason for hiding this comment

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

added new test, it should return null if there is no pipeline operator at all

csv.status?.phase === ClusterServiceVersionPhase.CSVPhaseSucceeded,
);
const versions = matchingCSVs.map((csv) => parse(csv.spec.version)).filter(Boolean);
// Orders from small (oldest) to highest (newest) version
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused by this comment vs the tests.

Suggested change
// Orders from small (oldest) to highest (newest) version
// Orders versions from latest to earliest

You're grabbing the last one, the earliest version based on your tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

The order after this versions.sort(compare) is 1.0, 1.1, 2.0, ... And then I selected the last one (to get the newest version). The comment was only for the versions.sort line. I will update that comment so that it matches both lines or do some code change. don't know yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I was confused by your test... I didn't read the phase value. You're right. Apologizes -- ignore this thread.

@andrewballantyne
Copy link
Contributor

/lgtm

/assign @rohitkrai03 @christianvogt

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 17, 2020
@christianvogt
Copy link
Contributor

/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewballantyne, christianvogt, jerolimov

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-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 17, 2020
@jerolimov
Copy link
Member Author

/retest
/woof

@openshift-ci-robot
Copy link
Contributor

@jerolimov: dog image

In response to this:

/retest
/woof

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.

@openshift-bot
Copy link
Contributor

/retest

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

4 similar comments
@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@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 e7c24ad into openshift:master Sep 18, 2020
@openshift-ci-robot
Copy link
Contributor

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

Bugzilla bug 1878700 has been moved to the MODIFIED state.

In response to this:

Bug 1878700: Fix Add Pipeline Trigger for Pipeline Operator 1.1

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.

@jerolimov
Copy link
Member Author

/cherry-pick release-4.5

@openshift-cherrypick-robot

@jerolimov: #6612 failed to apply on top of branch "release-4.5":

Applying: Check Pipeline Operator CSV version to use matching Tekton api
Using index info to reconstruct a base tree...
M	frontend/package.json
M	frontend/packages/dev-console/src/components/pipelines/modals/triggers/resource-utils.ts
M	frontend/packages/dev-console/src/components/pipelines/modals/triggers/submit-utils.ts
M	frontend/packages/dev-console/src/components/pipelines/utils/triggers.ts
M	frontend/public/module/k8s/cluster-settings.ts
M	frontend/yarn.lock
Falling back to patching base and 3-way merge...
Auto-merging frontend/yarn.lock
Auto-merging frontend/public/module/k8s/cluster-settings.ts
CONFLICT (content): Merge conflict in frontend/public/module/k8s/cluster-settings.ts
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/modals/triggers/submit-utils.ts
Auto-merging frontend/packages/dev-console/src/components/pipelines/modals/triggers/resource-utils.ts
Auto-merging frontend/package.json
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Check Pipeline Operator CSV version to use matching Tekton api
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.5

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.

@jerolimov
Copy link
Member Author

Because automatically check picking fails I created PR #6675 manually.

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-high Referenced Bugzilla bug's severity is high 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. component/core Related to console core functionality component/dev-console Related to dev-console 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

10 participants