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

check for taskRef kind in the TR spec #7005

Merged
merged 1 commit into from Nov 4, 2020

Conversation

debsmita1
Copy link
Contributor

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

Root Analysis:
The Task col in the TaskRun list is always considering the taskRef to be of kind Task. So, in a scenario where TaskRun references ClusterTask, the linked task name gives a 404 error

Solution Description:
added a check for the taskRef kind

GIF:
clkind

@debsmita1
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 Oct 27, 2020
@openshift-ci-robot openshift-ci-robot added the component/dev-console Related to dev-console label Oct 27, 2020
@debsmita1
Copy link
Contributor Author

/cc @jerolimov

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 it locally, works fine. But I have one small change request.

Comment on lines 16 to 18
obj.spec.taskRef?.kind === ClusterTaskModel.kind
? referenceForModel(ClusterTaskModel)
: referenceForModel(TaskModel);
Copy link
Member

@jerolimov jerolimov Oct 27, 2020

Choose a reason for hiding this comment

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

Can we keep the result of referenceForModel outside of this Row function? So that it's not required to recalculate the kind for each row (also when its just a few string operations). More important for would be here, that we then keep the const together at one place. Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. PTAL

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, works fine 👍

/lgtm

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

/assign @andrewballantyne

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.

This looks like it will work fine, but I think we can go one step further and place a new utility with the others like it.

@@ -42,7 +43,9 @@ const TaskRunsRow: RowFunction<TaskRunKind> = ({ obj, index, key, style, ...prop
<TableData className={tableColumnClasses[3]}>
{obj.spec.taskRef?.name ? (
<ResourceLink
kind={taskReference}
kind={
obj.spec.taskRef?.kind === ClusterTaskModel.kind ? clusterTaskReference : taskReference
Copy link
Contributor

Choose a reason for hiding this comment

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

So we already have this kinda check ... but not quite this exact check in the pipeline-augment.ts file. Perhaps we just expand this with another wrapper function:

Ie, add this:

const getModelReferenceFromTaskKind = (kind: string): GroupVersionKind => {
  const model = getResourceModelFromTaskKind(kind);
  return referenceForModel(model);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

So sorry for the confusion... please place this utility with the others in the pipeline-augment.ts file noted above.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Nov 3, 2020
@andrewballantyne
Copy link
Contributor

Can we co-locate the utility? Sorry for the confusion.

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.

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewballantyne, debsmita1, 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 Nov 3, 2020
@openshift-merge-robot openshift-merge-robot merged commit 01a40db into openshift:master Nov 4, 2020
@spadgett spadgett added this to the v4.7 milestone Nov 4, 2020
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. 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

6 participants