Skip to content

Commit

Permalink
feat: change severity
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Jun 10, 2024
1 parent da60bef commit 53f4260
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions db/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
dutyContext "github.com/flanksource/duty/context"
dutyModels "github.com/flanksource/duty/models"
"github.com/flanksource/gomplate/v3"
"github.com/flanksource/is-healthy/events"
"github.com/google/uuid"
"github.com/hexops/gotextdiff"
"github.com/hexops/gotextdiff/myers"
Expand Down Expand Up @@ -256,6 +257,10 @@ func extractChanges(ctx api.ScrapeContext, result *v1.ScrapeResult, ci *models.C
}
}

if change.Severity == "" && change.ChangeType != "diff" {
change.Severity = events.GetSeverity(change.ChangeType)
}

if change.ConfigID == "" {
// Some scrapers can generate changes for config items that don't exist on our db.
// Example: Cloudtrail scraper reporting changes for a resource that has been excluded.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ require (
github.com/fergusstrange/embedded-postgres v1.25.0
github.com/flanksource/commons v1.22.1
github.com/flanksource/duty v1.0.486
github.com/flanksource/is-healthy v1.0.7
github.com/flanksource/is-healthy v1.0.10
github.com/flanksource/ketall v1.1.6
github.com/flanksource/mapstructure v1.6.0
github.com/go-logr/zapr v1.2.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -860,8 +860,8 @@ github.com/flanksource/gomplate/v3 v3.20.4/go.mod h1:27BNWhzzSjDed1z8YShO6W+z6G9
github.com/flanksource/gomplate/v3 v3.24.2 h1:WZSriw1MaBhzrDV1IOP9eNsupIPxIHy0yTaMOVhCvsk=
github.com/flanksource/gomplate/v3 v3.24.2/go.mod h1:94BxYobZqouGdVezuz6LNto5C+yLMG0LnNnM9CUPyoo=
github.com/flanksource/is-healthy v0.0.0-20230705092916-3b4cf510c5fc/go.mod h1:4pQhmF+TnVqJroQKY8wSnSp+T18oLson6YQ2M0qPHfQ=
github.com/flanksource/is-healthy v1.0.7 h1:0muDQttzTkNLcOpsA23OHvLiweN44anxUgvQhucbh5E=
github.com/flanksource/is-healthy v1.0.7/go.mod h1:ijdyDDpdRzDtIt1UVZv5WNpAnb8V4hGUz75rnr3Ubhk=
github.com/flanksource/is-healthy v1.0.10 h1:g7cyLTK/a5PqTJmRG35+4l7I6vzQqGAQAxpwrw0efkE=
github.com/flanksource/is-healthy v1.0.10/go.mod h1:ijdyDDpdRzDtIt1UVZv5WNpAnb8V4hGUz75rnr3Ubhk=
github.com/flanksource/ketall v1.1.6 h1:gGZsbDUf4ULznNMEC076cyrhGAZbaRnZXuhZ42PTyaE=
github.com/flanksource/ketall v1.1.6/go.mod h1:s76Y3Anqptx5CdP4Jtav3LWjAu297ME8YXEsAiw/NcE=
github.com/flanksource/kommons v0.31.4 h1:zksAgYjZuwPgS8XTejDIWEYB0nPSU1i3Jxcavm/vovI=
Expand Down
2 changes: 1 addition & 1 deletion hack/generate-schemas/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/distribution/reference v0.5.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/flanksource/gomplate/v3 v3.24.2 // indirect
github.com/flanksource/is-healthy v1.0.7 // indirect
github.com/flanksource/is-healthy v1.0.10 // indirect
github.com/flanksource/kubectl-neat v1.0.4 // indirect
github.com/flanksource/mapstructure v1.6.0 // indirect
github.com/flanksource/postq v0.1.3 // indirect
Expand Down
4 changes: 2 additions & 2 deletions hack/generate-schemas/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ github.com/flanksource/duty v1.0.486 h1:6rwqihXF8/LoKRQqnJ/Awir7f2mGGsVIr8xZIMGe
github.com/flanksource/duty v1.0.486/go.mod h1:5B7rHV8hsttX/Ku92XI2FoRY4xZaeAoUGl2ngB/wZV0=
github.com/flanksource/gomplate/v3 v3.24.2 h1:WZSriw1MaBhzrDV1IOP9eNsupIPxIHy0yTaMOVhCvsk=
github.com/flanksource/gomplate/v3 v3.24.2/go.mod h1:94BxYobZqouGdVezuz6LNto5C+yLMG0LnNnM9CUPyoo=
github.com/flanksource/is-healthy v1.0.7 h1:0muDQttzTkNLcOpsA23OHvLiweN44anxUgvQhucbh5E=
github.com/flanksource/is-healthy v1.0.7/go.mod h1:ijdyDDpdRzDtIt1UVZv5WNpAnb8V4hGUz75rnr3Ubhk=
github.com/flanksource/is-healthy v1.0.10 h1:g7cyLTK/a5PqTJmRG35+4l7I6vzQqGAQAxpwrw0efkE=
github.com/flanksource/is-healthy v1.0.10/go.mod h1:ijdyDDpdRzDtIt1UVZv5WNpAnb8V4hGUz75rnr3Ubhk=
github.com/flanksource/kubectl-neat v1.0.4 h1:t5/9CqgE84oEtB0KitgJ2+WIeLfD+RhXSxYrqb4X8yI=
github.com/flanksource/kubectl-neat v1.0.4/go.mod h1:Un/Voyh3cmiZNKQrW/TkAl28nAA7vwnwDGVjRErKjOw=
github.com/flanksource/mapstructure v1.6.0 h1:+1kJ+QsO1SxjAgktfLlpZXetsVSJ0uCLhGKrA4BtwTE=
Expand Down

0 comments on commit 53f4260

Please sign in to comment.