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 1883306: Include repo branch in URL for che icon #6764

Merged
merged 1 commit into from Oct 1, 2020

Conversation

rottencandy
Copy link
Contributor

Fixes:
https://issues.redhat.com/browse/ODC-4385
#6077
https://bugzilla.redhat.com/show_bug.cgi?id=1883306

Analysis / Root cause:
The URL generated for the Che editor icon in topology does not consider the repository branch.

Solution Description:
Include repository branch when creating the URL, in the format ${gitURL}/tree/${gitBranch}.

Test setup:

  • Install Eclipse Che operator and create a CheCluster instance.
  • Create an application using Git import flow, optionally adding a different branch in advanced git options.
  • Notice the generated URL for che icon in the application's topology node contains the repository branch.

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci-robot
Copy link
Contributor

@rottencandy: This pull request references Bugzilla bug 1883306, which is invalid:

  • expected the bug to target the "4.6.0" release, but it targets "4.7.0" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1883306: Include repo branch in URL for che icon

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/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. component/dev-console Related to dev-console labels Sep 28, 2020
@rottencandy
Copy link
Contributor Author

/kind bug

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 28, 2020
@rottencandy
Copy link
Contributor Author

/retest

Copy link
Member

@jerolimov jerolimov left a comment

Choose a reason for hiding this comment

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

Tested this locally with a server which could not start che, but the link looks good.

@divyanshiGupta
Copy link
Contributor

@saud I think when we do not have the cheURL then the returned gitURL should also have branchRef if present.

@rottencandy
Copy link
Contributor Author

@saud I think when we do not have the cheURL then the returned gitURL should also have branchRef if present.

+1. Updated.

return gitURL && cheURL ? `${cheURL}/f?url=${gitURL}&policies.create=peruser` : gitURL;
export const getEditURL = (gitURL: string, gitBranch: string, cheURL: string) => {
const fullGitURL = gitBranch ? `${gitURL}/tree/${gitBranch}` : gitURL;
return cheURL ? `${cheURL}/f?url=${fullGitURL}&policies.create=peruser` : fullGitURL;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return cheURL ? `${cheURL}/f?url=${fullGitURL}&policies.create=peruser` : fullGitURL;
return gitURL && cheURL ? `${cheURL}/f?url=${fullGitURL}&policies.create=peruser` : fullGitURL;

Copy link
Contributor

@divyanshiGupta divyanshiGupta left a comment

Choose a reason for hiding this comment

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

/lgtm

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

/retest

1 similar comment
@rottencandy
Copy link
Contributor Author

rottencandy commented Sep 29, 2020 via email

@divyanshiGupta
Copy link
Contributor

@rottencandy you need to fix resource-utils.spec.ts specs.

@divyanshiGupta
Copy link
Contributor

/lgtm cancel

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 29, 2020
const mockGitURL =
mockResources.deploymentConfigs.data[0].metadata.annotations['app.openshift.io/vcs-uri'];
const mockGitBranch =
mockResources.deploymentConfigs.data[0].metadata.annotations['app.openshift.io/vcs-ref'];
Copy link
Member

Choose a reason for hiding this comment

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

Since you check if the branch is defined or not, can you please add add a second test when there is no branch defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added the check in the next it() block.

const mockGitURL =
mockResources.deploymentConfigs.data[0].metadata.annotations['app.openshift.io/vcs-uri'];
const graphData = getTransformedTopologyData(mockResources, ['deploymentConfigs']);
const { editURL, vcsURI } = graphData.nodes[0].data.data as WorkloadData;
const editUrl = editURL || getEditURL(vcsURI, '');
const editUrl = editURL || getEditURL(vcsURI, '', '');
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const editUrl = editURL || getEditURL(vcsURI, '', '');
const editUrl = getEditURL(vcsURI, '', '');

Please remove this "logic" from the test. Each test case should test a strict behavior and I expect that such a fallback is what we want "to test" here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@jerolimov
Copy link
Member

jerolimov commented Sep 30, 2020

Tested this locally and the link looks fine to me.

@divyanshiGupta do you have something from keeping back adding a lgtm label?

@divyanshiGupta
Copy link
Contributor

/lgtm

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

/assign @christianvogt

@openshift-bot
Copy link
Contributor

/bugzilla refresh

Recalculating validity in case the underlying Bugzilla bug has changed.

@openshift-ci-robot
Copy link
Contributor

@openshift-bot: This pull request references Bugzilla bug 1883306, which is invalid:

  • expected the bug to target the "4.6.0" release, but it targets "4.7.0" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/bugzilla refresh

Recalculating validity in case the underlying Bugzilla bug has changed.

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

/approve

verified the changes, works as expected.

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: divyanshiGupta, invincibleJai, jerolimov, rottencandy

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 Oct 1, 2020
@rottencandy
Copy link
Contributor Author

/bugzilla refresh

@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. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Oct 1, 2020
@openshift-ci-robot
Copy link
Contributor

@rottencandy: This pull request references Bugzilla bug 1883306, 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:

/bugzilla refresh

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

@rottencandy: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-gcp-console 80f1982 link /test e2e-gcp-console

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@rottencandy
Copy link
Contributor Author

/retest

@openshift-merge-robot openshift-merge-robot merged commit e4324d2 into openshift:master Oct 1, 2020
@openshift-ci-robot
Copy link
Contributor

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

Bugzilla bug 1883306 has been moved to the MODIFIED state.

In response to this:

Bug 1883306: Include repo branch in URL for che icon

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.

@rottencandy
Copy link
Contributor Author

/cherry-pick release-4.5

@openshift-cherrypick-robot

@rottencandy: #6764 failed to apply on top of branch "release-4.5":

Applying: include branch in che icon url
Using index info to reconstruct a base tree...
M	frontend/packages/dev-console/src/components/topology/components/nodes/WorkloadNode.tsx
M	frontend/packages/dev-console/src/components/topology/data-transforms/__tests__/data-transformer.spec.ts
M	frontend/packages/dev-console/src/components/topology/data-transforms/transform-utils.ts
M	frontend/packages/dev-console/src/components/topology/topology-types.ts
M	frontend/packages/dev-console/src/components/topology/topology-utils.ts
Falling back to patching base and 3-way merge...
Auto-merging frontend/packages/dev-console/src/components/topology/topology-utils.ts
Auto-merging frontend/packages/dev-console/src/components/topology/topology-types.ts
Auto-merging frontend/packages/dev-console/src/components/topology/data-transforms/transform-utils.ts
Auto-merging frontend/packages/dev-console/src/components/topology/data-transforms/__tests__/data-transformer.spec.ts
CONFLICT (content): Merge conflict in frontend/packages/dev-console/src/components/topology/data-transforms/__tests__/data-transformer.spec.ts
Auto-merging frontend/packages/dev-console/src/components/topology/components/nodes/WorkloadNode.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 include branch in che icon url
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

jerolimov commented Oct 2, 2020

@rottencandy Cherry-picked this PR for 4.5. Happy holiday.

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. 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