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
Bug 1840264: fixes: delete application error #5573
Conversation
@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
In response to this:
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
webhooksAvailable = isBuildConfigPresent
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for webhooksAvailable = isBuildConfigPresent;
04de48c
to
c5def17
Compare
@sahil143 fix the unit tests. |
c5def17
to
da45d21
Compare
|
@sahil143 it seems the tests are still failing. PTAL. |
da45d21
to
84159d8
Compare
/retest |
84159d8
to
29f6f83
Compare
Verified with various flow git/container image works as expected for D/DC/KN /lgtm |
/assign @christianvogt |
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, | ||
}, | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
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
29f6f83
to
70f09e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
} | ||
return obj ? [...a, safeKill(SecretModel, obj)] : a; | ||
}, []); | ||
return [...requests, ...reqs]; |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
/lgtm cancel |
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
70f09e6
to
1dea830
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve |
[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 |
/retest |
@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:
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. |
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:
Unit test coverage report: added
Test setup:
Browser conformance: