Skip to content

Commit

Permalink
Fix argo event defintion
Browse files Browse the repository at this point in the history
  • Loading branch information
mszostok committed May 15, 2024
1 parent 4e7bdff commit e282eb1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ require (
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.16.0
github.com/prometheus/common v0.44.0
github.com/r3labs/diff/v3 v3.0.1
github.com/sanity-io/litter v1.5.5
github.com/segmentio/analytics-go v3.1.0+incompatible
Expand Down Expand Up @@ -215,7 +216,6 @@ require (
github.com/philhofer/fwd v1.1.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion pkg/sink/pager_duty.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (w *PagerDuty) resolveEventMeta(in *incomingEvent) eventMetadata {
return enrichWithK8sEventMetadata(out, ev.k8sEventPayload)
}

if !ev.argoPayload.Message.IsEmpty() {
if len(ev.argoPayload.Message.Sections) > 0 {
return enrichWithArgoCDEventMetadata(out, ev.argoPayload)
}

Expand Down
10 changes: 8 additions & 2 deletions pkg/sink/pager_duty_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/prometheus/common/model"

k8sconfig "github.com/kubeshop/botkube/internal/source/kubernetes/config"
"github.com/kubeshop/botkube/pkg/api"
"github.com/kubeshop/botkube/pkg/config"
)

Expand All @@ -33,7 +32,14 @@ type (
}

argoPayload struct {
Message api.Message
// using the api.Message, causes decoding problems:
// - 'Message.Timestamp' expected a map, got 'string'"
// - nested fields like Header are not resolved.
Message struct {
Sections []struct {
Header string
}
}
IncomingRequestContext struct {
App *config.K8sResourceRef
DetailsUIPath *string
Expand Down
3 changes: 1 addition & 2 deletions test/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,7 @@ github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
Expand Down

0 comments on commit e282eb1

Please sign in to comment.