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
0ab6c4f9
Commit
0ab6c4f9
authored
Oct 05, 2016
by
fibonacci1729
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(1246): pull most recent release from history
parent
c87a902b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
24 deletions
+30
-24
release_server.go
cmd/tiller/release_server.go
+30
-24
No files found.
cmd/tiller/release_server.go
View file @
0ab6c4f9
...
...
@@ -69,6 +69,8 @@ var (
errMissingChart
=
errors
.
New
(
"no chart provided"
)
// errMissingRelease indicates that a release (name) was not provided.
errMissingRelease
=
errors
.
New
(
"no release provided"
)
// errInvalidRevision indicates that an invalid release revision number was provided.
errInvalidRevision
=
errors
.
New
(
"invalid release revision"
)
// errIncompatibleVersion indicates incompatible client/server versions.
errIncompatibleVersion
=
errors
.
New
(
"client version is incompatible"
)
)
...
...
@@ -463,54 +465,58 @@ func (s *releaseServer) performKubeUpdate(currentRelease, targetRelease *release
// prepareRollback finds the previous release and prepares a new release object with
// the previous release's configuration
func
(
s
*
releaseServer
)
prepareRollback
(
req
*
services
.
RollbackReleaseRequest
)
(
*
release
.
Release
,
*
release
.
Release
,
error
)
{
if
req
.
Name
==
""
{
switch
{
case
req
.
Name
==
""
:
return
nil
,
nil
,
errMissingRelease
case
req
.
Version
<
0
:
return
nil
,
nil
,
errInvalidRevision
}
// finds the non-deleted release with the given name
currentRelease
,
err
:=
s
.
env
.
Releases
.
Deployed
(
req
.
Name
)
h
,
err
:=
s
.
env
.
Releases
.
History
(
req
.
Name
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
v
:=
req
.
Version
if
v
==
0
{
v
=
currentRelease
.
Version
-
1
if
len
(
h
)
<=
1
{
return
nil
,
nil
,
errors
.
New
(
"no revision to rollback"
)
}
if
v
<
1
{
return
nil
,
nil
,
errors
.
New
(
"cannot rollback to version < 1"
)
sort
.
Sort
(
sort
.
Reverse
(
byRev
(
h
)))
crls
:=
h
[
0
]
rbv
:=
req
.
Version
if
req
.
Version
==
0
{
rbv
=
crls
.
Version
-
1
}
log
.
Printf
(
"rolling back %s
to version %d"
,
req
.
Name
,
v
)
log
.
Printf
(
"rolling back %s
(current: v%d, target: v%d)"
,
req
.
Name
,
crls
.
Version
,
rb
v
)
pr
eviousRelease
,
err
:=
s
.
env
.
Releases
.
Get
(
req
.
Name
,
v
)
pr
ls
,
err
:=
s
.
env
.
Releases
.
Get
(
req
.
Name
,
rb
v
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
ts
:=
timeconv
.
Now
()
// Store a new release object with previous release's configuration
targetRelease
:=
&
release
.
Release
{
// Store a new release object with previous release's configuration
target
:=
&
release
.
Release
{
Name
:
req
.
Name
,
Namespace
:
c
urrentRelease
.
Namespace
,
Chart
:
pr
eviousRelease
.
Chart
,
Config
:
pr
eviousRelease
.
Config
,
Namespace
:
c
rls
.
Namespace
,
Chart
:
pr
ls
.
Chart
,
Config
:
pr
ls
.
Config
,
Info
:
&
release
.
Info
{
FirstDeployed
:
c
urrentRelease
.
Info
.
FirstDeployed
,
LastDeployed
:
t
s
,
FirstDeployed
:
c
rls
.
Info
.
FirstDeployed
,
LastDeployed
:
t
imeconv
.
Now
()
,
Status
:
&
release
.
Status
{
Code
:
release
.
Status_UNKNOWN
,
Notes
:
pr
eviousRelease
.
Info
.
Status
.
Notes
,
Notes
:
pr
ls
.
Info
.
Status
.
Notes
,
},
},
Version
:
c
urrentRelease
.
Version
+
1
,
Manifest
:
pr
eviousRelease
.
Manifest
,
Hooks
:
pr
eviousRelease
.
Hooks
,
Version
:
c
rls
.
Version
+
1
,
Manifest
:
pr
ls
.
Manifest
,
Hooks
:
pr
ls
.
Hooks
,
}
return
c
urrentRelease
,
targetRelease
,
nil
return
c
rls
,
target
,
nil
}
func
(
s
*
releaseServer
)
uniqName
(
start
string
,
reuse
bool
)
(
string
,
error
)
{
...
...
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