fix: update flux model to include revision
This commit is contained in:
parent
d56873fc5d
commit
f2b57e4c99
1 changed files with 17 additions and 15 deletions
|
@ -9,24 +9,26 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: use skaffold to see why the revision is not present
|
|
||||||
type FluxNotification struct {
|
type FluxNotification struct {
|
||||||
InvolvedObject struct {
|
InvolvedObject struct {
|
||||||
APIVersion string `json:"apiVersion"`
|
|
||||||
Kind string `json:"kind"`
|
Kind string `json:"kind"`
|
||||||
Name string `json:"name"`
|
|
||||||
Namespace string `json:"namespace"`
|
Namespace string `json:"namespace"`
|
||||||
|
Name string `json:"name"`
|
||||||
UID string `json:"uid"`
|
UID string `json:"uid"`
|
||||||
|
APIVersion string `json:"apiVersion"`
|
||||||
|
ResourceVersion string `json:"resourceVersion"`
|
||||||
} `json:"involvedObject"`
|
} `json:"involvedObject"`
|
||||||
Metadata struct {
|
|
||||||
KustomizeToolkitFluxcdIoRevision string `json:"kustomize.toolkit.fluxcd.io/revision"`
|
|
||||||
} `json:"metadata"`
|
|
||||||
Severity string `json:"severity"`
|
Severity string `json:"severity"`
|
||||||
Reason string `json:"reason"`
|
Timestamp time.Time `json:"timestamp"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
|
Reason string `json:"reason"`
|
||||||
|
Metadata struct {
|
||||||
|
CommitStatus string `json:"commit_status"`
|
||||||
|
Revision string `json:"revision"`
|
||||||
|
Summary string `json:"summary"`
|
||||||
|
} `json:"metadata"`
|
||||||
ReportingController string `json:"reportingController"`
|
ReportingController string `json:"reportingController"`
|
||||||
ReportingInstance string `json:"reportingInstance"`
|
ReportingInstance string `json:"reportingInstance"`
|
||||||
Timestamp time.Time `json:"timestamp"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type FluxHandler struct{}
|
type FluxHandler struct{}
|
||||||
|
@ -52,7 +54,7 @@ func (f FluxHandler) FormatNotification(r io.Reader) (Notification, error) {
|
||||||
|
|
||||||
title := fmt.Sprintf("[%s] %s %s/%s.%s", not.Severity, not.Reason,
|
title := fmt.Sprintf("[%s] %s %s/%s.%s", not.Severity, not.Reason,
|
||||||
strings.ToLower(not.InvolvedObject.Kind), not.InvolvedObject.Namespace, not.InvolvedObject.Name)
|
strings.ToLower(not.InvolvedObject.Kind), not.InvolvedObject.Namespace, not.InvolvedObject.Name)
|
||||||
body := not.Message + "\n\n**revision**\n" + not.Metadata.KustomizeToolkitFluxcdIoRevision
|
body := not.Message + "\n\n**revision**\n" + not.Metadata.Revision
|
||||||
|
|
||||||
l.Debug("flux notification", slog.Group("notification",
|
l.Debug("flux notification", slog.Group("notification",
|
||||||
slog.String("title", title),
|
slog.String("title", title),
|
||||||
|
|
Loading…
Reference in a new issue