Skip to content

Commit 0879a05

Browse files
Merge pull request #70 from mihaichitic/ND-7557
[ND-7557] - show env auto-update flag and add env deploy --queue flag
2 parents 2220909 + 59df58d commit 0879a05

5 files changed

Lines changed: 32 additions & 16 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16
88

99
require (
1010
bunnyshell.com/dev v0.7.2
11-
bunnyshell.com/sdk v0.20.3
11+
bunnyshell.com/sdk v0.20.4
1212
github.com/AlecAivazis/survey/v2 v2.3.7
1313
github.com/MakeNowJust/heredoc v1.0.0
1414
github.com/avast/retry-go/v4 v4.6.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
bunnyshell.com/dev v0.7.2 h1:fa0ZvnIAXLVJINCJqo7uenjHmjPrlHmY18Zc8ypo/6E=
22
bunnyshell.com/dev v0.7.2/go.mod h1:+Xk46UXX9AW0nHrFMdO/IwpUPfALrck1/qI+LIXsDmE=
3-
bunnyshell.com/sdk v0.20.3 h1:Kd2s/fhkMrn6Jqp9UmnXfNu12Oiwg+hgNSNBOIBYPH8=
4-
bunnyshell.com/sdk v0.20.3/go.mod h1:RfgfUzZ4WHZGCkToUfu2/hoQS6XsQc8IdPTVAlpS138=
3+
bunnyshell.com/sdk v0.20.4 h1:Na2e4xKdtbnZZ/+ACpjzM7fvBFriJWC3bVgNFSmqcJs=
4+
bunnyshell.com/sdk v0.20.4/go.mod h1:RfgfUzZ4WHZGCkToUfu2/hoQS6XsQc8IdPTVAlpS138=
55
github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ=
66
github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo=
77
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=

pkg/api/environment/action_delete.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package environment
22

33
import (
4+
"github.com/spf13/pflag"
45
"net/http"
56

67
"bunnyshell.com/cli/pkg/api"
@@ -11,14 +12,23 @@ import (
1112

1213
type DeleteOptions struct {
1314
common.ActionOptions
15+
16+
QueueIfSomethingInProgress bool
1417
}
1518

1619
func NewDeleteOptions(id string) *DeleteOptions {
1720
return &DeleteOptions{
18-
ActionOptions: *common.NewActionOptions(id),
21+
ActionOptions: *common.NewActionOptions(id),
22+
QueueIfSomethingInProgress: false,
1923
}
2024
}
2125

26+
func (options *DeleteOptions) UpdateFlagSet(flags *pflag.FlagSet) {
27+
options.ActionOptions.UpdateFlagSet(flags)
28+
29+
//flags.BoolVar(&options.QueueIfSomethingInProgress, "queue", options.QueueIfSomethingInProgress, "Queue the delete pipeline if another operation is in progress now")
30+
}
31+
2232
func Delete(options *DeleteOptions) (*sdk.EventItem, error) {
2333
model, resp, err := DeleteRaw(options)
2434
if err != nil {

pkg/api/environment/action_deploy.go

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,32 @@ import (
1111
)
1212

1313
const (
14-
IncludedDepdendenciesNone string = "none"
15-
IncludedDepdendenciesAll string = "all"
16-
IncludedDepdendenciesMissing string = "missing"
14+
IncludedDependenciesNone string = "none"
15+
IncludedDependenciesAll string = "all"
16+
IncludedDependenciesMissing string = "missing"
1717
)
1818

1919
type DeployOptions struct {
2020
common.PartialActionOptions
2121

22-
IncludedDepdendencies string
22+
IncludedDependencies string
23+
24+
QueueIfSomethingInProgress bool
2325
}
2426

2527
func NewDeployOptions(id string) *DeployOptions {
2628
return &DeployOptions{
27-
PartialActionOptions: *common.NewPartialActionOptions(id),
28-
IncludedDepdendencies: IncludedDepdendenciesNone,
29+
PartialActionOptions: *common.NewPartialActionOptions(id),
30+
IncludedDependencies: IncludedDependenciesNone,
31+
QueueIfSomethingInProgress: false,
2932
}
3033
}
3134

3235
func (options *DeployOptions) UpdateFlagSet(flags *pflag.FlagSet) {
3336
options.PartialActionOptions.UpdateFlagSet(flags)
3437

35-
flags.StringVar(&options.IncludedDepdendencies, "included-dependencies", options.IncludedDepdendencies, "Include dependencies in the deployment (none, all, missing)")
38+
flags.StringVar(&options.IncludedDependencies, "included-dependencies", options.IncludedDependencies, "Include dependencies in the deployment (none, all, missing)")
39+
flags.BoolVar(&options.QueueIfSomethingInProgress, "queue", options.QueueIfSomethingInProgress, "Queue the deploy pipeline if another operation is in progress now")
3640
}
3741

3842
func Deploy(options *DeployOptions) (*sdk.EventItem, error) {
@@ -54,9 +58,10 @@ func DeployRaw(options *DeployOptions) (*sdk.EventItem, *http.Response, error) {
5458

5559
request := lib.GetAPIFromProfile(profile).EnvironmentAPI.EnvironmentDeploy(ctx, options.ID).
5660
EnvironmentPartialDeployAction(sdk.EnvironmentPartialDeployAction{
57-
IsPartial: &isPartialAction,
58-
Components: options.GetActionComponents(),
59-
IncludedDependencies: &options.IncludedDepdendencies,
61+
IsPartial: &isPartialAction,
62+
Components: options.GetActionComponents(),
63+
IncludedDependencies: &options.IncludedDependencies,
64+
QueueIfSomethingInProgress: &options.QueueIfSomethingInProgress,
6065
})
6166

6267
return request.Execute()

pkg/formatter/stylish.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,12 @@ func tabulateEnvironmentItem(w *tabwriter.Writer, item *sdk.EnvironmentItem) {
228228
fmt.Fprintf(w, "%v\t %v\n", "Create Ephemeral On PR", item.GetHasEphemeralCreateOnPr())
229229
fmt.Fprintf(w, "%v\t %v\n", "Destroy Ephemeral On PR Close", item.GetHasEphemeralDestroyOnPrClose())
230230
fmt.Fprintf(w, "%v\t %v\n", "Auto Deploy Ephemeral", item.GetHasEphemeralAutoDeploy())
231-
fmt.Fprintf(w, "%v\t %v\n", "Termination Protection", item.GetHasTerminationProtection())
232-
233231
if item.GetHasEphemeralBranchWhitelist() {
234232
fmt.Fprintf(w, "%v\t %v\n", "Ephemeral Branch Whitelist", item.GetEphemeralBranchWhitelistRegex())
235233
}
234+
235+
fmt.Fprintf(w, "%v\t %v\n", "Termination Protection", item.GetHasTerminationProtection())
236+
fmt.Fprintf(w, "%v\t %v\n", "Auto Update", item.GetHasAutoUpdate())
236237
}
237238
}
238239

0 commit comments

Comments
 (0)