-
Notifications
You must be signed in to change notification settings - Fork 278
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
fix(k8s): handle 404 exception when tagging image for deletion #1485
Conversation
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.
Had one comment to resolve. Also, the commit message is not really helpful. The category (which to be fair we have not documented much) should in this case be k8s
and not "exception", and the message itself should describe more precisely what is being fixed, so the context is understandable without looking at the diff.
method: "DELETE", | ||
}) | ||
} catch (err) { | ||
log.debug(`${err.message} happend when deleting ${image}`) |
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.
I think we need to more specifically catch the error. If you just wrap the first query and explicitly catch a 404, you can just return without logging any error. Other errors should be thrown as usual.
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.
I have made the change, I have updated to only check for 404
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.
That works. I'd just remove that log line, don't think it's necessary. Then it's good to go!
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
9cdae3c
to
bd3329a
Compare
method: "DELETE", | ||
}) | ||
} catch (err) { | ||
if (err.response && !(err.response.status === 404)) { |
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.
Minor nitpick, but err.response.status !== 404
is a bit cleaner :)
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
What this PR does / why we need it:
This PR allows a 404 error when tagging images in the registry for deletion fail silently and log a message
Which issue(s) this PR fixes:
#1472
Fixes #
Special notes for your reviewer: