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
3f1101cd
Commit
3f1101cd
authored
Sep 27, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(tiller): do not create releases for a dry-run
parent
ac88aaf2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
release_server.go
cmd/tiller/release_server.go
+9
-6
release_server_test.go
cmd/tiller/release_server_test.go
+2
-2
No files found.
cmd/tiller/release_server.go
View file @
3f1101cd
...
@@ -174,8 +174,7 @@ func (s *releaseServer) ListReleases(req *services.ListReleasesRequest, stream s
...
@@ -174,8 +174,7 @@ func (s *releaseServer) ListReleases(req *services.ListReleasesRequest, stream s
Total
:
total
,
Total
:
total
,
Releases
:
rels
,
Releases
:
rels
,
}
}
stream
.
Send
(
res
)
return
stream
.
Send
(
res
)
return
nil
}
}
func
filterReleases
(
filter
string
,
rels
[]
*
release
.
Release
)
([]
*
release
.
Release
,
error
)
{
func
filterReleases
(
filter
string
,
rels
[]
*
release
.
Release
)
([]
*
release
.
Release
,
error
)
{
...
@@ -281,9 +280,11 @@ func (s *releaseServer) UpdateRelease(c ctx.Context, req *services.UpdateRelease
...
@@ -281,9 +280,11 @@ func (s *releaseServer) UpdateRelease(c ctx.Context, req *services.UpdateRelease
return
nil
,
err
return
nil
,
err
}
}
if
!
req
.
DryRun
{
if
err
:=
s
.
env
.
Releases
.
Create
(
updatedRelease
);
err
!=
nil
{
if
err
:=
s
.
env
.
Releases
.
Create
(
updatedRelease
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
}
return
res
,
nil
return
res
,
nil
}
}
...
@@ -380,6 +381,9 @@ func (s *releaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele
...
@@ -380,6 +381,9 @@ func (s *releaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele
}
}
func
(
s
*
releaseServer
)
RollbackRelease
(
c
ctx
.
Context
,
req
*
services
.
RollbackReleaseRequest
)
(
*
services
.
RollbackReleaseResponse
,
error
)
{
func
(
s
*
releaseServer
)
RollbackRelease
(
c
ctx
.
Context
,
req
*
services
.
RollbackReleaseRequest
)
(
*
services
.
RollbackReleaseResponse
,
error
)
{
if
!
checkClientVersion
(
c
)
{
return
nil
,
errIncompatibleVersion
}
currentRelease
,
targetRelease
,
err
:=
s
.
prepareRollback
(
req
)
currentRelease
,
targetRelease
,
err
:=
s
.
prepareRollback
(
req
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -391,9 +395,11 @@ func (s *releaseServer) RollbackRelease(c ctx.Context, req *services.RollbackRel
...
@@ -391,9 +395,11 @@ func (s *releaseServer) RollbackRelease(c ctx.Context, req *services.RollbackRel
return
nil
,
err
return
nil
,
err
}
}
if
!
req
.
DryRun
{
if
err
:=
s
.
env
.
Releases
.
Create
(
targetRelease
);
err
!=
nil
{
if
err
:=
s
.
env
.
Releases
.
Create
(
targetRelease
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
}
return
rel
,
nil
return
rel
,
nil
}
}
...
@@ -438,10 +444,7 @@ func (s *releaseServer) performKubeUpdate(currentRelease, targetRelease *release
...
@@ -438,10 +444,7 @@ func (s *releaseServer) performKubeUpdate(currentRelease, targetRelease *release
kubeCli
:=
s
.
env
.
KubeClient
kubeCli
:=
s
.
env
.
KubeClient
current
:=
bytes
.
NewBufferString
(
currentRelease
.
Manifest
)
current
:=
bytes
.
NewBufferString
(
currentRelease
.
Manifest
)
target
:=
bytes
.
NewBufferString
(
targetRelease
.
Manifest
)
target
:=
bytes
.
NewBufferString
(
targetRelease
.
Manifest
)
if
err
:=
kubeCli
.
Update
(
targetRelease
.
Namespace
,
current
,
target
);
err
!=
nil
{
return
kubeCli
.
Update
(
targetRelease
.
Namespace
,
current
,
target
)
return
err
}
return
nil
}
}
// prepareRollback finds the previous release and prepares a new release object with
// prepareRollback finds the previous release and prepares a new release object with
...
...
cmd/tiller/release_server_test.go
View file @
3f1101cd
...
@@ -629,7 +629,7 @@ func TestUpdateReleaseNoChanges(t *testing.T) {
...
@@ -629,7 +629,7 @@ func TestUpdateReleaseNoChanges(t *testing.T) {
}
}
func
TestRollbackReleaseNoHooks
(
t
*
testing
.
T
)
{
func
TestRollbackReleaseNoHooks
(
t
*
testing
.
T
)
{
c
:=
context
.
Background
()
c
:=
helm
.
NewContext
()
rs
:=
rsFixture
()
rs
:=
rsFixture
()
rel
:=
releaseStub
()
rel
:=
releaseStub
()
rel
.
Hooks
=
[]
*
release
.
Hook
{
rel
.
Hooks
=
[]
*
release
.
Hook
{
...
@@ -665,7 +665,7 @@ func TestRollbackReleaseNoHooks(t *testing.T) {
...
@@ -665,7 +665,7 @@ func TestRollbackReleaseNoHooks(t *testing.T) {
}
}
func
TestRollbackRelease
(
t
*
testing
.
T
)
{
func
TestRollbackRelease
(
t
*
testing
.
T
)
{
c
:=
context
.
Background
()
c
:=
helm
.
NewContext
()
rs
:=
rsFixture
()
rs
:=
rsFixture
()
rel
:=
releaseStub
()
rel
:=
releaseStub
()
rs
.
env
.
Releases
.
Create
(
rel
)
rs
.
env
.
Releases
.
Create
(
rel
)
...
...
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