-
Notifications
You must be signed in to change notification settings - Fork 40
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
[CLD-8628 #2] Add custom status code for installation name/dns conflicts + bonus #1091
Conversation
…tion webhook events
// Try to parse the user ID from the request context, so it can be passed along with the webhook event | ||
actorID := "" | ||
if value := r.Context().Value(ContextKeyUserID{}); value != nil { | ||
if str, ok := value.(string); ok && str != "" { | ||
actorID = str | ||
} | ||
} | ||
|
||
err = c.EventProducer.ProduceInstallationStateChangeEvent(installationDTO.Installation, oldState, events.DataField{Key: "actor_id", Value: actorID}) |
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 snuck this in while I was here. This passes the ID of the actor that initiated the deletion request, so that webhook listeners can easily detect who did the deletion. The main use case for this will be the Cloud Plugin. Currently, whenever an installation is deleted for any reason, a message "Cloud isntallation <> has been manually deleted and is now removed from the cloud plugin", which confuses users, as sometimes an automatic cleanup script deletes them. With this change, the Cloud Plugin will be able to tell if it itself made the deletion request, or if it was another system, and adjust the message sent accordingly.
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
Summary
This PR adds the ability for the provisioner to return a custom
409
(StatusConflict) status code when the requested installation name, or DNS is already in use on creation. This will allow us to be more communicative to users of the Cloud plugin when they rapidly attempt to delete and recreate an installation within a few minutes of each other, after we turn on the 24h deletion pending window.Ticket Link
https://mattermost.atlassian.net/browse/CLD-8628
Release Note