Skip to content

Commit

Permalink
Merge pull request #466 from overmindtech/allow-blast-radius-override
Browse files Browse the repository at this point in the history
Added blast radius config options
  • Loading branch information
dylanratcliffe authored Jul 15, 2024
2 parents 40154c5 + d965a57 commit 994d125
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
18 changes: 16 additions & 2 deletions cmd/changes_submit_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,22 @@ func SubmitPlan(cmd *cobra.Command, args []string) error {
log.WithContext(ctx).WithFields(lf).Info("Re-using change")
}

// Set up the blast radius preset if specified
maxDepth := viper.GetInt32("blast-radius-link-depth")
maxItems := viper.GetInt32("blast-radius-max-items")
var blastRadiusConfigOverride *sdp.BlastRadiusConfig
if maxDepth > 0 || maxItems > 0 {
blastRadiusConfigOverride = &sdp.BlastRadiusConfig{
MaxItems: maxItems,
LinkDepth: maxDepth,
}
}

resultStream, err := client.UpdatePlannedChanges(ctx, &connect.Request[sdp.UpdatePlannedChangesRequest]{
Msg: &sdp.UpdatePlannedChangesRequest{
ChangeUUID: changeUuid[:],
ChangingItems: plannedChanges,
ChangeUUID: changeUuid[:],
ChangingItems: plannedChanges,
BlastRadiusConfigOverride: blastRadiusConfigOverride,
},
})
if err != nil {
Expand Down Expand Up @@ -634,4 +646,6 @@ func init() {

submitPlanCmd.PersistentFlags().String("terraform-plan-output", "", "Filename of cached terraform plan output for this change.")
submitPlanCmd.PersistentFlags().String("code-changes-diff", "", "Fileame of the code diff of this change.")
submitPlanCmd.PersistentFlags().Int32("blast-radius-link-depth", 0, "Used in combination with '--blast-radius-max-items' to customise how many levels are traversed when calculating the blast radius. Larger numbers will result in a more comprehensive blast radius, but may take longer to calculate. Defaults to the account level settings.")
submitPlanCmd.PersistentFlags().Int32("blast-radius-max-items", 0, "Used in combination with '--blast-radius-link-depth' to customise how many items are included in the blast radius. Larger numbers will result in a more comprehensive blast radius, but may take longer to calculate. Defaults to the account level settings.")
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/muesli/reflow v0.3.0
github.com/muesli/termenv v0.15.2
github.com/overmindtech/aws-source v0.0.0-20240709133817-24fb056ffc22
github.com/overmindtech/sdp-go v0.78.0
github.com/overmindtech/sdp-go v0.79.0
github.com/overmindtech/stdlib-source v0.0.0-20240709104746-33161549fa69
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/sirupsen/logrus v1.9.3
Expand Down Expand Up @@ -122,7 +122,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/nats-io/jwt/v2 v2.5.7 // indirect
github.com/nats-io/jwt/v2 v2.5.8 // indirect
github.com/nats-io/nats.go v1.36.0 // indirect
github.com/nats-io/nkeys v0.4.7 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=
github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
github.com/nats-io/jwt/v2 v2.5.7 h1:j5lH1fUXCnJnY8SsQeB/a/z9Azgu2bYIDvtPVNdxe2c=
github.com/nats-io/jwt/v2 v2.5.7/go.mod h1:ZdWS1nZa6WMZfFwwgpEaqBV8EPGVgOTDHN/wTbz0Y5A=
github.com/nats-io/jwt/v2 v2.5.8 h1:uvdSzwWiEGWGXf+0Q+70qv6AQdvcvxrv9hPM0RiPamE=
github.com/nats-io/jwt/v2 v2.5.8/go.mod h1:ZdWS1nZa6WMZfFwwgpEaqBV8EPGVgOTDHN/wTbz0Y5A=
github.com/nats-io/nats-server/v2 v2.10.16 h1:2jXaiydp5oB/nAx/Ytf9fdCi9QN6ItIc9eehX8kwVV0=
github.com/nats-io/nats-server/v2 v2.10.16/go.mod h1:Pksi38H2+6xLe1vQx0/EA4bzetM0NqyIHcIbmgXSkIU=
github.com/nats-io/nats.go v1.36.0 h1:suEUPuWzTSse/XhESwqLxXGuj8vGRuPRoG7MoRN/qyU=
Expand All @@ -240,8 +240,8 @@ github.com/overmindtech/aws-source v0.0.0-20240709133817-24fb056ffc22 h1:WwPD2iz
github.com/overmindtech/aws-source v0.0.0-20240709133817-24fb056ffc22/go.mod h1:ZaR8fuxrXOzfmuWfKRGUUfT8xUVGoxKD009ul6AazDk=
github.com/overmindtech/discovery v0.27.6 h1:p+xMEIST0fk6HfbejXR+Ea59+JA5zjCO4zvRqelRqwE=
github.com/overmindtech/discovery v0.27.6/go.mod h1:A3wvNM6VTo7qfGExWQ+fgh+NfLh35nuPJ7wF4pLYEQI=
github.com/overmindtech/sdp-go v0.78.0 h1:vhDWFKssBzaHKMu/He44eTEJDGNzivVMFja8r/Kbfzs=
github.com/overmindtech/sdp-go v0.78.0/go.mod h1:F0jughyQ72jT5NSBLZH+fosT98yci02fsL4KVtL66qw=
github.com/overmindtech/sdp-go v0.79.0 h1:+KExvXHfErzv63OGHpLkvC9pH0qEBPAU6t3DQ19JFMk=
github.com/overmindtech/sdp-go v0.79.0/go.mod h1:V7ngEXMJaUlsrASK9Zd3NZGbZtllkvfiN/aIg354h9U=
github.com/overmindtech/sdpcache v1.6.4 h1:MJoYBDqDE3s8FrRzZ0RPgFiH39HWI/Mv2ImH1NdLT8k=
github.com/overmindtech/sdpcache v1.6.4/go.mod h1:/F9XStVdntRJEQjlZ86BPuB1Y7VPo1PFcsCNiU1IoGE=
github.com/overmindtech/stdlib-source v0.0.0-20240709104746-33161549fa69 h1:VXmW8+qopvt5S8uDDbMxjbo0ykAbactWCVHOQpm/W2Y=
Expand Down

0 comments on commit 994d125

Please sign in to comment.