From 72d6a763f29c441d7c734efcc08f37d1c346b1f2 Mon Sep 17 00:00:00 2001 From: Yosef Mihretie <40375360+yosefmih@users.noreply.github.com> Date: Tue, 16 Apr 2024 18:00:56 -0400 Subject: [PATCH] Revert "removing build/predeploy webhook support for now (#4546)" (#4551) --- .../handlers/porter_app/app_event_webhook_get.go | 12 +++++++++++- .../home/app-dashboard/app-view/tabs/Webhooks.tsx | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/api/server/handlers/porter_app/app_event_webhook_get.go b/api/server/handlers/porter_app/app_event_webhook_get.go index 3a99f65f6f..79fe39df11 100644 --- a/api/server/handlers/porter_app/app_event_webhook_get.go +++ b/api/server/handlers/porter_app/app_event_webhook_get.go @@ -21,7 +21,9 @@ type AppEventWebhooksHandler struct { } const ( - appEventTypeDeploy string = "deploy" + appEventTypeBuild string = "build" + appEventTypePredeploy string = "predeploy" + appEventTypeDeploy string = "deploy" appEventStatusSuccess string = "success" appEventStatusFailed string = "failed" @@ -125,6 +127,10 @@ func (a *AppEventWebhooksHandler) ServeHTTP(w http.ResponseWriter, r *http.Reque func toWebhookAppEventTypeEnum(appEventType string) (porterv1.WebhookAppEventType, error) { switch appEventType { + case appEventTypeBuild: + return porterv1.WebhookAppEventType_WEBHOOK_APP_EVENT_TYPE_BUILD, nil + case appEventTypePredeploy: + return porterv1.WebhookAppEventType_WEBHOOK_APP_EVENT_TYPE_PREDEPLOY, nil case appEventTypeDeploy: return porterv1.WebhookAppEventType_WEBHOOK_APP_EVENT_TYPE_DEPLOY, nil default: @@ -134,6 +140,10 @@ func toWebhookAppEventTypeEnum(appEventType string) (porterv1.WebhookAppEventTyp func toAppEventType(appEventWebhookEnum porterv1.WebhookAppEventType) (string, error) { switch appEventWebhookEnum { + case porterv1.WebhookAppEventType_WEBHOOK_APP_EVENT_TYPE_BUILD: + return appEventTypeBuild, nil + case porterv1.WebhookAppEventType_WEBHOOK_APP_EVENT_TYPE_PREDEPLOY: + return appEventTypePredeploy, nil case porterv1.WebhookAppEventType_WEBHOOK_APP_EVENT_TYPE_DEPLOY: return appEventTypeDeploy, nil default: diff --git a/dashboard/src/main/home/app-dashboard/app-view/tabs/Webhooks.tsx b/dashboard/src/main/home/app-dashboard/app-view/tabs/Webhooks.tsx index c4b35bb4ce..1557b9209d 100644 --- a/dashboard/src/main/home/app-dashboard/app-view/tabs/Webhooks.tsx +++ b/dashboard/src/main/home/app-dashboard/app-view/tabs/Webhooks.tsx @@ -22,7 +22,9 @@ type Webhook = { }; const stepOptions = [ + { value: "build", label: "Build" }, { value: "deploy", label: "Deploy" }, + { value: "predeploy", label: "Predeploy" }, ]; const statusOptions = [