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 1840264: fixes: delete application error #5573

Merged

Conversation

sahil143
Copy link
Contributor

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

Analysis / Root cause: Error is thrown for resources created through Deploy Image form because build configs are not present for the resource

Solution Description: If build config is not present, omit the delete buildconfig request

Screen shots / Gifs for design review:

delete application

Unit test coverage report: added

Screenshot from 2020-05-26 23-20-25

Test setup:

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci-robot openshift-ci-robot added the bugzilla/severity-unspecified Referenced Bugzilla bug's severity is unspecified for the PR. label May 26, 2020
@openshift-ci-robot
Copy link
Contributor

@sahil143: This pull request references Bugzilla bug 1840264, 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.5.0) matches configured target release for branch (4.5.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 1840264: fixes: delete application error

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 May 26, 2020
Copy link
Member

@vikram-raj vikram-raj 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 May 26, 2020
@@ -456,11 +458,11 @@ export const cleanUpWorkload = (
deleteRequest(modelFor(resource.kind), resource);
batchDeleteRequests(deleteModels, resource);
deleteRequest(ImageStreamModel, resource); // delete imageStream
webhooksAvailable = true;
isBuildConfigPresent ? (webhooksAvailable = true) : (webhooksAvailable = false);
Copy link
Contributor

Choose a reason for hiding this comment

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

webhooksAvailable = isBuildConfigPresent ?

Copy link
Member

Choose a reason for hiding this comment

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

@sahil143 This may not be true always i.e if buildConfig is present then it'll have webhooks as even in UI we have option to select webhooks. So we may need to handle it

Copy link
Contributor

Choose a reason for hiding this comment

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

@sahil143 @invincibleJai so generic webhook is always going to be there since we are adding it always so here we can set webhooksAvailable based on buildConfig is present or not. Below at line no. 470 inside the if block we can check if some other webhook also exist using checkIfTriggerExists from edit-application-utils and if it exists then based on that add that hook into the webhooks array.

Copy link
Member

Choose a reason for hiding this comment

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

+1 for webhooksAvailable = isBuildConfigPresent;

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

@sahil143 fix the unit tests.

@sahil143
Copy link
Contributor Author

@sahil143 fix the unit tests.
fixed!

@divyanshiGupta
Copy link
Contributor

@sahil143 it seems the tests are still failing. PTAL.

@openshift-ci-robot openshift-ci-robot added the component/shared Related to console-shared label May 27, 2020
@sahil143
Copy link
Contributor Author

/retest

@invincibleJai
Copy link
Member

Verified with various flow git/container image works as expected for D/DC/KN

/lgtm

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

/assign @christianvogt
/retest

Comment on lines 434 to 446
if (t.generic) {
obj = {
...resource,
metadata: {
name:
t.generic?.secretReference?.name ??
`${resource.metadata.name}-generic-webhook-secret`,
namespace: resource.metadata.namespace,
},
};
}
if (t[gitType] && !isKnativeResource) {
obj = {
...resource,
metadata: {
name:
t[gitType]?.secretReference?.name ??
`${resource.metadata.name}-${gitType}-webhook-secret`,
namespace: resource.metadata.namespace,
},
};
}
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
if (t.generic) {
obj = {
...resource,
metadata: {
name:
t.generic?.secretReference?.name ??
`${resource.metadata.name}-generic-webhook-secret`,
namespace: resource.metadata.namespace,
},
};
}
if (t[gitType] && !isKnativeResource) {
obj = {
...resource,
metadata: {
name:
t[gitType]?.secretReference?.name ??
`${resource.metadata.name}-${gitType}-webhook-secret`,
namespace: resource.metadata.namespace,
},
};
}
const webhookType = t.generic ? 'generic' : gitType;
const webhookTypeObj = t.generic || (!isKnativeResource && t[gitType])
if (webhookTypeObj) {
obj = {
...resource,
metadata: {
name:
webhookTypeObj.secretReference?.name ??
`${resource.metadata.name}-${webhookType}-webhook-secret`,
namespace: resource.metadata.namespace,
},
};
}

@sahil143 something like this can be done to reduce the lines of code here because both the objects are similar except for the name. 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.

yeah, for these two cases make sense. updated

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label May 28, 2020
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 May 28, 2020
}
return obj ? [...a, safeKill(SecretModel, obj)] : a;
}, []);
return [...requests, ...reqs];
Copy link
Contributor

Choose a reason for hiding this comment

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

Uncaught (in promise) TypeError: reqs is not iterable

If you don't get triggers it throws an exception. You need to guard against spreading undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed!

@andrewballantyne
Copy link
Contributor

/lgtm cancel

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label May 28, 2020
do not send delete request for BCs if BC array is empty in resources

add ansd fix unit test for application utils

update delete webhooks logic

update

fix unit tests

fix unit tests

update code

update delete webhook logic

typeguard against undefiend for 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.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 28, 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, divyanshiGupta, invincibleJai, sahil143, vikram-raj

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 May 28, 2020
@andrewballantyne
Copy link
Contributor

/retest

@openshift-merge-robot openshift-merge-robot merged commit 147577e into openshift:master May 28, 2020
@openshift-ci-robot
Copy link
Contributor

@sahil143: All pull requests linked via external trackers have merged: openshift/console#5573. Bugzilla bug 1840264 has been moved to the MODIFIED state.

In response to this:

Bug 1840264: fixes: delete application error

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.

@spadgett spadgett added this to the v4.5 milestone Jun 1, 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. bugzilla/severity-unspecified Referenced Bugzilla bug's severity is unspecified for the PR. 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 component/shared Related to console-shared 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