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
d6da76f3
Unverified
Commit
d6da76f3
authored
Nov 07, 2017
by
Adam Reese
Committed by
GitHub
Nov 07, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3097 from adamreese/fix/2437-upgrade-release
fix(tiller): upgrade last deployed release
parents
1c34db41
82ef7514
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
12 deletions
+17
-12
storage.go
pkg/storage/storage.go
+6
-6
release_update.go
pkg/tiller/release_update.go
+9
-4
release_update_test.go
pkg/tiller/release_update_test.go
+2
-2
No files found.
pkg/storage/storage.go
View file @
d6da76f3
...
...
@@ -18,6 +18,7 @@ package storage // import "k8s.io/helm/pkg/storage"
import
(
"fmt"
"strings"
rspb
"k8s.io/helm/pkg/proto/hapi/release"
relutil
"k8s.io/helm/pkg/releaseutil"
...
...
@@ -127,14 +128,13 @@ func (s *Storage) Deployed(name string) (*rspb.Release, error) {
"OWNER"
:
"TILLER"
,
"STATUS"
:
"DEPLOYED"
,
})
switch
{
case
err
!=
nil
:
return
nil
,
err
case
len
(
ls
)
==
0
:
return
nil
,
fmt
.
Errorf
(
"%q has no deployed releases"
,
name
)
default
:
if
err
==
nil
{
return
ls
[
0
],
nil
}
if
strings
.
Contains
(
err
.
Error
(),
"not found"
)
{
return
nil
,
fmt
.
Errorf
(
"%q has no deployed releases"
,
name
)
}
return
nil
,
err
}
// History returns the revision history for the release with the provided name, or
...
...
pkg/tiller/release_update.go
View file @
d6da76f3
...
...
@@ -69,8 +69,8 @@ func (s *ReleaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele
return
nil
,
nil
,
errMissingChart
}
// finds the
non-delet
ed release with the given name
currentRelease
,
err
:=
s
.
env
.
Releases
.
Last
(
req
.
Name
)
// finds the
deploy
ed release with the given name
currentRelease
,
err
:=
s
.
env
.
Releases
.
Deployed
(
req
.
Name
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
@@ -80,9 +80,15 @@ func (s *ReleaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele
return
nil
,
nil
,
err
}
// finds the non-deleted release with the given name
lastRelease
,
err
:=
s
.
env
.
Releases
.
Last
(
req
.
Name
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
// Increment revision count. This is passed to templates, and also stored on
// the release object.
revision
:=
curren
tRelease
.
Version
+
1
revision
:=
las
tRelease
.
Version
+
1
ts
:=
timeconv
.
Now
()
options
:=
chartutil
.
ReleaseOptions
{
...
...
@@ -151,7 +157,6 @@ func (s *ReleaseServer) performUpdate(originalRelease, updatedRelease *release.R
if
err
:=
s
.
ReleaseModule
.
Update
(
originalRelease
,
updatedRelease
,
req
,
s
.
env
);
err
!=
nil
{
msg
:=
fmt
.
Sprintf
(
"Upgrade %q failed: %s"
,
updatedRelease
.
Name
,
err
)
s
.
Log
(
"warning: %s"
,
msg
)
originalRelease
.
Info
.
Status
.
Code
=
release
.
Status_SUPERSEDED
updatedRelease
.
Info
.
Status
.
Code
=
release
.
Status_FAILED
updatedRelease
.
Info
.
Description
=
msg
s
.
recordRelease
(
originalRelease
,
true
)
...
...
pkg/tiller/release_update_test.go
View file @
d6da76f3
...
...
@@ -234,8 +234,8 @@ func TestUpdateReleaseFailure(t *testing.T) {
if
err
!=
nil
{
t
.
Errorf
(
"Expected to be able to get previous release"
)
}
if
oldStatus
:=
oldRelease
.
Info
.
Status
.
Code
;
oldStatus
!=
release
.
Status_
SUPERSED
ED
{
t
.
Errorf
(
"Expected
SUPERSEDED
status on previous Release version. Got %v"
,
oldStatus
)
if
oldStatus
:=
oldRelease
.
Info
.
Status
.
Code
;
oldStatus
!=
release
.
Status_
DEPLOY
ED
{
t
.
Errorf
(
"Expected
Deployed
status on previous Release version. Got %v"
,
oldStatus
)
}
}
...
...
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