Skip to content

Commit

Permalink
Merge pull request #139 from overmindtech/fix-formatting
Browse files Browse the repository at this point in the history
Fix formatting of get-change headers; upgrade sdp-go and otel; remove duplicate slashes
  • Loading branch information
DavidS-ovm authored Dec 11, 2023
2 parents d7753c1 + 95583a4 commit 9be7d1b
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 471 deletions.
5 changes: 2 additions & 3 deletions cmd/comment.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
</details>
{{ else -}}
No expected changes found.
{{ end -}}
{{ end }}

{{ if .UnmappedChanges -}}
## <img width="20" alt="unmapped" src="{{ .AssetPath }}//unmapped.svg"> Unmapped Changes
## <img width="20" alt="unmapped" src="{{ .AssetPath }}/unmapped.svg"> Unmapped Changes

> [!NOTE]
> These changes couldn't be mapped to a real cloud resource and therefore won't be included in the blast radius calculation.
Expand Down Expand Up @@ -53,7 +53,6 @@ No expected changes found.
[Open in Overmind]({{ .ChangeUrl }})

{{ if .Risks }}

# <img width="24" alt="warning" src="{{ .AssetPath }}/risks.svg"> Risks

{{ range .Risks }}
Expand Down
2 changes: 1 addition & 1 deletion cmd/createbookmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func CreateBookmark(ctx context.Context, ready chan bool) int {
}

ctx, span := tracing.Tracer().Start(ctx, "CLI CreateBookmark", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down
2 changes: 1 addition & 1 deletion cmd/endchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func EndChange(ctx context.Context, ready chan bool) int {
}

ctx, span := tracing.Tracer().Start(ctx, "CLI EndChange", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down
2 changes: 1 addition & 1 deletion cmd/getaffectedbookmarks.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func GetAffectedBookmarks(ctx context.Context, ready chan bool) int {
}

ctx, span := tracing.Tracer().Start(ctx, "CLI GetAffectedBookmarks", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down
2 changes: 1 addition & 1 deletion cmd/getbookmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func GetBookmark(ctx context.Context, ready chan bool) int {
}

ctx, span := tracing.Tracer().Start(ctx, "CLI GetBookmark", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down
6 changes: 4 additions & 2 deletions cmd/getchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"os"
"os/signal"
"strings"
"syscall"
"text/template"
"time"
Expand Down Expand Up @@ -77,7 +78,7 @@ func GetChange(ctx context.Context, ready chan bool) int {
}

ctx, span := tracing.Tracer().Start(ctx, "CLI GetChange", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down Expand Up @@ -220,8 +221,9 @@ func GetChange(ctx context.Context, ready chan bool) int {
SeverityText: "High",
},
}
frontend, _ := strings.CutSuffix(viper.GetString("frontend"), "/")
data := TemplateData{
ChangeUrl: fmt.Sprintf("%v/changes/%v", viper.GetString("frontend"), changeUuid.String()),
ChangeUrl: fmt.Sprintf("%v/changes/%v", frontend, changeUuid.String()),
ExpectedChanges: []TemplateItem{},
UnmappedChanges: []TemplateItem{},
BlastItems: int(changeRes.Msg.Change.Metadata.NumAffectedItems),
Expand Down
2 changes: 1 addition & 1 deletion cmd/getsnapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func GetSnapshot(ctx context.Context, ready chan bool) int {
}

ctx, span := tracing.Tracer().Start(ctx, "CLI GetSnapshot", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down
6 changes: 3 additions & 3 deletions cmd/invite.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func InvitesRevoke(ctx context.Context) int {
}

ctx, span := tracing.Tracer().Start(ctx, "CLI Revoke Invite", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down Expand Up @@ -169,7 +169,7 @@ func InvitesCreate(ctx context.Context) int {
}

ctx, span := tracing.Tracer().Start(ctx, "CLI Create Invite", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down Expand Up @@ -202,7 +202,7 @@ func InvitesList(ctx context.Context) int {
var err error

ctx, span := tracing.Tracer().Start(ctx, "CLI List Invites", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down
2 changes: 1 addition & 1 deletion cmd/listchanges.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func ListChanges(ctx context.Context, ready chan bool) int {
}

ctx, span := tracing.Tracer().Start(ctx, "CLI ListChanges", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down
8 changes: 5 additions & 3 deletions cmd/manualchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"os/signal"
"strings"
"syscall"
"time"

Expand Down Expand Up @@ -62,7 +63,7 @@ func ManualChange(ctx context.Context, ready chan bool) int {
return 1
}
ctx, span := tracing.Tracer().Start(ctx, "CLI ManualChange", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down Expand Up @@ -204,7 +205,8 @@ func ManualChange(ctx context.Context, ready chan bool) int {
return 1
}

changeUrl := fmt.Sprintf("%v/changes/%v/blast-radius", viper.GetString("frontend"), changeUuid)
frontend, _ := strings.CutSuffix(viper.GetString("frontend"), "/")
changeUrl := fmt.Sprintf("%v/changes/%v/blast-radius", frontend, changeUuid)
log.WithContext(ctx).WithFields(lf).WithField("change-url", changeUrl).Info("change ready")
fmt.Println(changeUrl)

Expand All @@ -227,7 +229,7 @@ func ManualChange(ctx context.Context, ready chan bool) int {
log.WithContext(ctx).WithFields(lf).WithFields(log.Fields{
"change-url": changeUrl,
"app": appUuid,
"app-url": fmt.Sprintf("%v/apps/%v", viper.GetString("frontend"), appUuid),
"app-url": fmt.Sprintf("%v/apps/%v", frontend, appUuid),
}).Info("affected app")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func Request(ctx context.Context, ready chan bool) int {
return 1
}
ctx, span := tracing.Tracer().Start(ctx, "CLI Request", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down
2 changes: 1 addition & 1 deletion cmd/startchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func StartChange(ctx context.Context, ready chan bool) int {
}

ctx, span := tracing.Tracer().Start(ctx, "CLI StartChange", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down
7 changes: 4 additions & 3 deletions cmd/submitplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ func SubmitPlan(ctx context.Context, files []string, ready chan bool) int {
return 1
}
ctx, span := tracing.Tracer().Start(ctx, "CLI SubmitPlan", trace.WithAttributes(
attribute.String("om.config", fmt.Sprintf("%v", viper.AllSettings())),
attribute.String("ovm.config", fmt.Sprintf("%v", viper.AllSettings())),
))
defer span.End()

Expand Down Expand Up @@ -674,7 +674,8 @@ func SubmitPlan(ctx context.Context, files []string, ready chan bool) int {
return 1
}

changeUrl := fmt.Sprintf("%v/changes/%v/blast-radius", viper.GetString("frontend"), changeUuid)
frontend, _ := strings.CutSuffix(viper.GetString("frontend"), "/")
changeUrl := fmt.Sprintf("%v/changes/%v/blast-radius", frontend, changeUuid)
log.WithContext(ctx).WithFields(lf).WithField("change-url", changeUrl).Info("Change ready")
fmt.Println(changeUrl)

Expand All @@ -697,7 +698,7 @@ func SubmitPlan(ctx context.Context, files []string, ready chan bool) int {
log.WithContext(ctx).WithFields(lf).WithFields(log.Fields{
"change-url": changeUrl,
"app": appUuid,
"app-url": fmt.Sprintf("%v/apps/%v", viper.GetString("frontend"), appUuid),
"app-url": fmt.Sprintf("%v/apps/%v", frontend, appUuid),
}).Info("Affected app")
}

Expand Down
Loading

0 comments on commit 9be7d1b

Please sign in to comment.