Skip to content

Commit 39f4203

Browse files
committed
feat: support release rollback
feat: support release rollback feat: support release rollback
1 parent d3115e3 commit 39f4203

File tree

7 files changed

+521
-4
lines changed

7 files changed

+521
-4
lines changed

pkg/apis/api.kusion.io/v1/types.go

+3
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,9 @@ const (
741741
// ReleasePhaseApplying indicates the stage of applying.
742742
ReleasePhaseApplying ReleasePhase = "applying"
743743

744+
// ReleasePhaseRollbacking indicates the stage of rollbacking.
745+
ReleasePhaseRollbacking ReleasePhase = "rollbacking"
746+
744747
// ReleasePhaseDestroying indicates the stage of destroying.
745748
ReleasePhaseDestroying ReleasePhase = "destroying"
746749

pkg/cmd/cmd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Find more information at: https://www.kusionstack.io`),
146146
{
147147
Message: "Release Management Commands:",
148148
Commands: []*cobra.Command{
149-
rel.NewCmdRel(o.IOStreams),
149+
rel.NewCmdRel(o.UI, o.IOStreams),
150150
},
151151
},
152152
}

pkg/cmd/release/release.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"k8s.io/kubectl/pkg/util/templates"
77
cmdutil "kusionstack.io/kusion/pkg/cmd/util"
88
"kusionstack.io/kusion/pkg/util/i18n"
9+
"kusionstack.io/kusion/pkg/util/terminal"
910
)
1011

1112
var relLong = i18n.T(`
@@ -14,7 +15,7 @@ var relLong = i18n.T(`
1415
These commands help you observe and operate the Kusion release files of a Project in a Workspace. `)
1516

1617
// NewCmdRel returns an initialized Command instance for 'release' sub command.
17-
func NewCmdRel(streams genericiooptions.IOStreams) *cobra.Command {
18+
func NewCmdRel(ui *terminal.UI, streams genericiooptions.IOStreams) *cobra.Command {
1819
cmd := &cobra.Command{
1920
Use: "release",
2021
DisableFlagsInUseLine: true,
@@ -23,7 +24,7 @@ func NewCmdRel(streams genericiooptions.IOStreams) *cobra.Command {
2324
Run: cmdutil.DefaultSubCommandRun(streams.ErrOut),
2425
}
2526

26-
cmd.AddCommand(NewCmdUnlock(streams), NewCmdList(streams), NewCmdShow(streams))
27+
cmd.AddCommand(NewCmdUnlock(streams), NewCmdList(streams), NewCmdShow(streams), NewCmdRollback(ui, streams))
2728

2829
return cmd
2930
}

pkg/cmd/release/release_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ func TestNewCmdRel(t *testing.T) {
1111
t.Run("successfully get release help", func(t *testing.T) {
1212
streams, _, _, _ := genericiooptions.NewTestIOStreams()
1313

14-
cmd := NewCmdRel(streams)
14+
cmd := NewCmdRel(nil, streams)
1515
assert.NotNil(t, cmd)
1616
})
1717
}

0 commit comments

Comments
 (0)