Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
4899faa9
Commit
4899faa9
authored
Oct 18, 2016
by
Brian
Committed by
GitHub
Oct 18, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1394 from fibonacci1729/fix/1357
fix(1357): print help text if revision is not specified
parents
08a488f5
0daf3e47
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
rollback.go
cmd/helm/rollback.go
+12
-4
rollback_test.go
cmd/helm/rollback_test.go
+3
-4
No files found.
cmd/helm/rollback.go
View file @
4899faa9
...
@@ -19,6 +19,7 @@ package main
...
@@ -19,6 +19,7 @@ package main
import
(
import
(
"fmt"
"fmt"
"io"
"io"
"strconv"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
...
@@ -32,7 +33,7 @@ The argument of the rollback command is the name of a release.
...
@@ -32,7 +33,7 @@ The argument of the rollback command is the name of a release.
type
rollbackCmd
struct
{
type
rollbackCmd
struct
{
name
string
name
string
version
int32
revision
int32
dryRun
bool
dryRun
bool
disableHooks
bool
disableHooks
bool
out
io
.
Writer
out
io
.
Writer
...
@@ -51,17 +52,24 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command {
...
@@ -51,17 +52,24 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command {
Long
:
rollbackDesc
,
Long
:
rollbackDesc
,
PersistentPreRunE
:
setupConnection
,
PersistentPreRunE
:
setupConnection
,
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
if
err
:=
checkArgsLength
(
len
(
args
),
"release name"
);
err
!=
nil
{
if
err
:=
checkArgsLength
(
len
(
args
),
"release name"
,
"revision number"
);
err
!=
nil
{
return
err
return
err
}
}
rollback
.
name
=
args
[
0
]
rollback
.
name
=
args
[
0
]
v64
,
err
:=
strconv
.
ParseInt
(
args
[
1
],
10
,
32
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"invalid revision number '%q': %s"
,
args
[
1
],
err
)
}
rollback
.
revision
=
int32
(
v64
)
rollback
.
client
=
ensureHelmClient
(
rollback
.
client
)
rollback
.
client
=
ensureHelmClient
(
rollback
.
client
)
return
rollback
.
run
()
return
rollback
.
run
()
},
},
}
}
f
:=
cmd
.
Flags
()
f
:=
cmd
.
Flags
()
f
.
Int32Var
(
&
rollback
.
version
,
"revision"
,
0
,
"revision to deploy"
)
f
.
BoolVar
(
&
rollback
.
dryRun
,
"dry-run"
,
false
,
"simulate a rollback"
)
f
.
BoolVar
(
&
rollback
.
dryRun
,
"dry-run"
,
false
,
"simulate a rollback"
)
f
.
BoolVar
(
&
rollback
.
disableHooks
,
"no-hooks"
,
false
,
"prevent hooks from running during rollback"
)
f
.
BoolVar
(
&
rollback
.
disableHooks
,
"no-hooks"
,
false
,
"prevent hooks from running during rollback"
)
...
@@ -73,7 +81,7 @@ func (r *rollbackCmd) run() error {
...
@@ -73,7 +81,7 @@ func (r *rollbackCmd) run() error {
r
.
name
,
r
.
name
,
helm
.
RollbackDryRun
(
r
.
dryRun
),
helm
.
RollbackDryRun
(
r
.
dryRun
),
helm
.
RollbackDisableHooks
(
r
.
disableHooks
),
helm
.
RollbackDisableHooks
(
r
.
disableHooks
),
helm
.
RollbackVersion
(
r
.
ver
sion
),
helm
.
RollbackVersion
(
r
.
revi
sion
),
)
)
if
err
!=
nil
{
if
err
!=
nil
{
return
prettyError
(
err
)
return
prettyError
(
err
)
...
...
cmd/helm/rollback_test.go
View file @
4899faa9
...
@@ -28,14 +28,13 @@ func TestRollbackCmd(t *testing.T) {
...
@@ -28,14 +28,13 @@ func TestRollbackCmd(t *testing.T) {
tests
:=
[]
releaseCase
{
tests
:=
[]
releaseCase
{
{
{
name
:
"rollback a release"
,
name
:
"rollback a release"
,
args
:
[]
string
{
"funny-honey"
},
args
:
[]
string
{
"funny-honey"
,
"1"
},
flags
:
[]
string
{
"revision"
,
"1"
},
expected
:
"Rollback was a success! Happy Helming!"
,
expected
:
"Rollback was a success! Happy Helming!"
,
},
},
{
{
name
:
"rollback a release without ver
sion"
,
name
:
"rollback a release without revi
sion"
,
args
:
[]
string
{
"funny-honey"
},
args
:
[]
string
{
"funny-honey"
},
e
xpected
:
"Rollback was a success! Happy Helming!"
,
e
rr
:
true
,
},
},
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment