Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added explanation to empty risks #460

Merged
merged 5 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cmd/comment.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,15 @@ No expected changes found.

[Open in Overmind]({{ .ChangeUrl }})

{{ if .Risks }}
# <img width="24" alt="warning" src="{{ .AssetPath }}/risks.svg"> Risks
{{ if not .Risks }}
Overmind has not identified any risks associated with this change.

This could be due to the change being low risk with no impact on other parts of the system, or involving resources that Overmind currently does not support.
{{ else -}}
{{ range .Risks }}
## <img width="18" alt="{{ .SeverityAlt }}" src="{{ $top.AssetPath }}/{{ .SeverityIcon }}"> {{ .Title }} [{{ .SeverityText }}]

{{ .Description }}
{{ end }}
{{ end }}
{{ end -}}
8 changes: 8 additions & 0 deletions cmd/datamaps/awssource.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,16 @@ func Execute() {
case loggedError:
log.WithContext(ctx).WithError(err.err).WithFields(err.fields).Error(err.message)
}
// if printing the error was not requested by the appropriate
// wrapper, only record the data to honeycomb and sentry, the
// command already has handled logging
cmdSpan.SetAttributes(
attribute.Bool("ovm.cli.fatalError", true),
attribute.String("ovm.cli.fatalError.msg", err.Error()),
)
cmdSpan.RecordError(err)
if cmdSpan != nil {
// if printing the error was not requested by the appropriate
// wrapper, only record the data to honeycomb and sentry, the
// command already has handled logging
cmdSpan.SetAttributes(
attribute.Bool("ovm.cli.fatalError", true),
attribute.String("ovm.cli.fatalError.msg", err.Error()),
)
cmdSpan.RecordError(err)
}
sentry.CaptureException(err)
}

Expand Down
9 changes: 8 additions & 1 deletion cmd/tea_submitplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,13 @@ func (m submitPlanModel) FinalReport() string {
bits = append(bits, styleH1().Render("Blast Radius"))
bits = append(bits, fmt.Sprintf("\nItems: %v\nEdges: %v\n", m.blastRadiusItems, m.blastRadiusEdges))
}
if m.changeUrl != "" && len(m.risks) > 0 {
if len(m.risks) == 0 {
bits = append(bits, styleH1().Render("Potential Risks"))
bits = append(bits, "")
bits = append(bits, "Overmind has not identified any risks associated with this change.")
bits = append(bits, "")
bits = append(bits, "This could be due to the change being low risk with no impact on other parts of the system, or involving resources that Overmind currently does not support.")
} else if m.changeUrl != "" {
bits = append(bits, styleH1().Render("Potential Risks"))
bits = append(bits, "")
for _, r := range m.risks {
Expand Down Expand Up @@ -836,5 +842,6 @@ func (m submitPlanModel) FinalReport() string {
}
bits = append(bits, fmt.Sprintf("\nCheck the blast radius graph and risks at:\n%v\n\n", m.changeUrl))
}

return strings.Join(bits, "\n") + "\n"
}
Loading