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
13e5c2f3
Commit
13e5c2f3
authored
Oct 13, 2016
by
Michelle Noorali
Committed by
GitHub
Oct 13, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1353 from michelleN/ref-rollback
bug(tiller): correct release statuses on rollback
parents
bf405541
1ad84745
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
8 deletions
+44
-8
release_server.go
cmd/tiller/release_server.go
+11
-8
release_server_test.go
cmd/tiller/release_server_test.go
+33
-0
No files found.
cmd/tiller/release_server.go
View file @
13e5c2f3
...
...
@@ -407,18 +407,18 @@ func (s *releaseServer) RollbackRelease(c ctx.Context, req *services.RollbackRel
return
nil
,
err
}
re
l
,
err
:=
s
.
performRollback
(
currentRelease
,
targetRelease
,
req
)
re
s
,
err
:=
s
.
performRollback
(
currentRelease
,
targetRelease
,
req
)
if
err
!=
nil
{
return
nil
,
err
return
res
,
err
}
if
!
req
.
DryRun
{
if
err
:=
s
.
env
.
Releases
.
Create
(
targetRelease
);
err
!=
nil
{
return
nil
,
err
return
res
,
err
}
}
return
re
l
,
nil
return
re
s
,
nil
}
func
(
s
*
releaseServer
)
performRollback
(
currentRelease
,
targetRelease
*
release
.
Release
,
req
*
services
.
RollbackReleaseRequest
)
(
*
services
.
RollbackReleaseResponse
,
error
)
{
...
...
@@ -437,7 +437,12 @@ func (s *releaseServer) performRollback(currentRelease, targetRelease *release.R
}
if
err
:=
s
.
performKubeUpdate
(
currentRelease
,
targetRelease
);
err
!=
nil
{
return
nil
,
err
log
.
Printf
(
"warning: Release Rollback %q failed: %s"
,
targetRelease
.
Name
,
err
)
currentRelease
.
Info
.
Status
.
Code
=
release
.
Status_SUPERSEDED
targetRelease
.
Info
.
Status
.
Code
=
release
.
Status_FAILED
s
.
recordRelease
(
currentRelease
,
true
)
s
.
recordRelease
(
targetRelease
,
false
)
return
res
,
err
}
// post-rollback hooks
...
...
@@ -448,9 +453,7 @@ func (s *releaseServer) performRollback(currentRelease, targetRelease *release.R
}
currentRelease
.
Info
.
Status
.
Code
=
release
.
Status_SUPERSEDED
if
err
:=
s
.
env
.
Releases
.
Update
(
currentRelease
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"Update of %s failed: %s"
,
currentRelease
.
Name
,
err
)
}
s
.
recordRelease
(
currentRelease
,
true
)
targetRelease
.
Info
.
Status
.
Code
=
release
.
Status_DEPLOYED
...
...
cmd/tiller/release_server_test.go
View file @
13e5c2f3
...
...
@@ -623,6 +623,39 @@ func TestUpdateReleaseFailure(t *testing.T) {
}
}
func
TestRollbackReleaseFailure
(
t
*
testing
.
T
)
{
c
:=
helm
.
NewContext
()
rs
:=
rsFixture
()
rel
:=
releaseStub
()
rs
.
env
.
Releases
.
Create
(
rel
)
upgradedRel
:=
upgradeReleaseVersion
(
rel
)
rs
.
env
.
Releases
.
Update
(
rel
)
rs
.
env
.
Releases
.
Create
(
upgradedRel
)
req
:=
&
services
.
RollbackReleaseRequest
{
Name
:
rel
.
Name
,
DisableHooks
:
true
,
}
rs
.
env
.
KubeClient
=
newUpdateFailingKubeClient
()
res
,
err
:=
rs
.
RollbackRelease
(
c
,
req
)
if
err
==
nil
{
t
.
Error
(
"Expected failed rollback"
)
}
if
targetStatus
:=
res
.
Release
.
Info
.
Status
.
Code
;
targetStatus
!=
release
.
Status_FAILED
{
t
.
Errorf
(
"Expected FAILED release. Got %v"
,
targetStatus
)
}
oldRelease
,
err
:=
rs
.
env
.
Releases
.
Get
(
rel
.
Name
,
rel
.
Version
)
if
err
!=
nil
{
t
.
Errorf
(
"Expected to be able to get previous release"
)
}
if
oldStatus
:=
oldRelease
.
Info
.
Status
.
Code
;
oldStatus
!=
release
.
Status_SUPERSEDED
{
t
.
Errorf
(
"Expected SUPERSEDED status on previous Release version. Got %v"
,
oldStatus
)
}
}
func
TestUpdateReleaseNoHooks
(
t
*
testing
.
T
)
{
c
:=
helm
.
NewContext
()
rs
:=
rsFixture
()
...
...
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