From 1a36a05a0e0ac755411b3ee6a518077bcc012df2 Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Fri, 15 Mar 2024 15:08:26 +0100 Subject: [PATCH] Fixes --- pkg/dashboard/api/types.go | 10 ++++++---- pkg/dashboard/server/commits.go | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/pkg/dashboard/api/types.go b/pkg/dashboard/api/types.go index 03904c797..7ac3faf9a 100644 --- a/pkg/dashboard/api/types.go +++ b/pkg/dashboard/api/types.go @@ -274,9 +274,11 @@ type CommitEventResult struct { Status string `json:"status"` StatusDesc string `json:"statusDesc"` - GitopsRef string `json:"gitopsRef"` - GitopsRepo string `json:"gitopsRepo"` + GitopsRef string `json:"gitopsRef,omitempty"` + GitopsRepo string `json:"gitopsRepo,omitempty"` - TriggeredBy string `json:"triggeredBy"` - Log string `json:"log"` + TriggeredImageBuildId string `json:"triggeredImageBuildId,omitempty"` + TriggeredDeployRequestId string `json:"triggeredDeployRequestId,omitempty"` + TriggeredBy string `json:"triggeredBy"` + Log string `json:"log,omitempty"` } diff --git a/pkg/dashboard/server/commits.go b/pkg/dashboard/server/commits.go index 7bdcc9491..85255e698 100644 --- a/pkg/dashboard/server/commits.go +++ b/pkg/dashboard/server/commits.go @@ -321,14 +321,14 @@ func AsCommitEvent(event *model.Event) *api.CommitEvent { releaseRequest = &r } else if event.Type == model.ImageBuildRequestedEvent { var r dx.ImageBuildRequest - err := json.Unmarshal([]byte(event.Blob), imageBuildRequest) + err := json.Unmarshal([]byte(event.Blob), &r) if err != nil { logrus.Warnf("could not unmarshal blob for: %s - %s", event.ID, err) } imageBuildRequest = &r } else if event.Type == model.RollbackRequestedEvent { var r dx.RollbackRequest - err := json.Unmarshal([]byte(event.Blob), rollbackRequest) + err := json.Unmarshal([]byte(event.Blob), &r) if err != nil { logrus.Warnf("could not unmarshal blob for: %s - %s", event.ID, err) } @@ -345,14 +345,17 @@ func AsCommitEvent(event *model.Event) *api.CommitEvent { } results = append(results, api.CommitEventResult{ - App: app, - Env: env, - Status: r.Status.String(), - StatusDesc: r.StatusDesc, - GitopsRef: r.GitopsRef, - GitopsRepo: r.GitopsRepo, - TriggeredBy: r.TriggeredBy, - Log: r.Log, + App: app, + Env: env, + Status: r.Status.String(), + StatusDesc: r.StatusDesc, + GitopsRef: r.GitopsRef, + GitopsRepo: r.GitopsRepo, + + TriggeredImageBuildId: r.TriggeredImageBuildRequestID, + TriggeredDeployRequestId: r.TriggeredDeployRequestID, + TriggeredBy: r.TriggeredBy, + Log: r.Log, }) }