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
e8f5d4de
Commit
e8f5d4de
authored
Apr 01, 2017
by
Taylor Thomas
Committed by
GitHub
Apr 01, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2153 from kragniz/package-destination
fix(helm): add --destination flag to 'helm package'
parents
5a86aaf9
a2ab1aaa
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
package.go
cmd/helm/package.go
+12
-2
package_test.go
cmd/helm/package_test.go
+18
-0
No files found.
cmd/helm/package.go
View file @
e8f5d4de
...
@@ -54,6 +54,8 @@ type packageCmd struct {
...
@@ -54,6 +54,8 @@ type packageCmd struct {
key
string
key
string
keyring
string
keyring
string
version
string
version
string
destination
string
out
io
.
Writer
out
io
.
Writer
home
helmpath
.
Home
home
helmpath
.
Home
}
}
...
@@ -96,6 +98,7 @@ func newPackageCmd(out io.Writer) *cobra.Command {
...
@@ -96,6 +98,7 @@ func newPackageCmd(out io.Writer) *cobra.Command {
f
.
StringVar
(
&
pkg
.
key
,
"key"
,
""
,
"name of the key to use when signing. Used if --sign is true"
)
f
.
StringVar
(
&
pkg
.
key
,
"key"
,
""
,
"name of the key to use when signing. Used if --sign is true"
)
f
.
StringVar
(
&
pkg
.
keyring
,
"keyring"
,
defaultKeyring
(),
"location of a public keyring"
)
f
.
StringVar
(
&
pkg
.
keyring
,
"keyring"
,
defaultKeyring
(),
"location of a public keyring"
)
f
.
StringVar
(
&
pkg
.
version
,
"version"
,
""
,
"set the version on the chart to this semver version"
)
f
.
StringVar
(
&
pkg
.
version
,
"version"
,
""
,
"set the version on the chart to this semver version"
)
f
.
StringVarP
(
&
pkg
.
destination
,
"destination"
,
"d"
,
"."
,
"location to write the chart."
)
return
cmd
return
cmd
}
}
...
@@ -129,12 +132,19 @@ func (p *packageCmd) run(cmd *cobra.Command, args []string) error {
...
@@ -129,12 +132,19 @@ func (p *packageCmd) run(cmd *cobra.Command, args []string) error {
checkDependencies
(
ch
,
reqs
,
p
.
out
)
checkDependencies
(
ch
,
reqs
,
p
.
out
)
}
}
var
dest
string
if
p
.
destination
==
"."
{
// Save to the current working directory.
// Save to the current working directory.
cwd
,
err
:
=
os
.
Getwd
()
dest
,
err
=
os
.
Getwd
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
name
,
err
:=
chartutil
.
Save
(
ch
,
cwd
)
}
else
{
// Otherwise save to set destination
dest
=
p
.
destination
}
name
,
err
:=
chartutil
.
Save
(
ch
,
dest
)
if
err
==
nil
&&
flagDebug
{
if
err
==
nil
&&
flagDebug
{
fmt
.
Fprintf
(
p
.
out
,
"Saved %s to current directory
\n
"
,
name
)
fmt
.
Fprintf
(
p
.
out
,
"Saved %s to current directory
\n
"
,
name
)
}
}
...
...
cmd/helm/package_test.go
View file @
e8f5d4de
...
@@ -94,6 +94,20 @@ func TestPackage(t *testing.T) {
...
@@ -94,6 +94,20 @@ func TestPackage(t *testing.T) {
expect
:
""
,
expect
:
""
,
hasfile
:
"alpine-0.1.0.tgz"
,
hasfile
:
"alpine-0.1.0.tgz"
,
},
},
{
name
:
"package --destination toot"
,
args
:
[]
string
{
"testdata/testcharts/alpine"
},
flags
:
map
[
string
]
string
{
"destination"
:
"toot"
},
expect
:
""
,
hasfile
:
"toot/alpine-0.1.0.tgz"
,
},
{
name
:
"package --destination does-not-exist"
,
args
:
[]
string
{
"testdata/testcharts/alpine"
},
flags
:
map
[
string
]
string
{
"destination"
:
"does-not-exist"
},
expect
:
"stat does-not-exist: no such file or directory"
,
err
:
true
,
},
{
{
name
:
"package --sign --key=KEY --keyring=KEYRING testdata/testcharts/alpine"
,
name
:
"package --sign --key=KEY --keyring=KEYRING testdata/testcharts/alpine"
,
args
:
[]
string
{
"testdata/testcharts/alpine"
},
args
:
[]
string
{
"testdata/testcharts/alpine"
},
...
@@ -124,6 +138,10 @@ func TestPackage(t *testing.T) {
...
@@ -124,6 +138,10 @@ func TestPackage(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
if
err
:=
os
.
Mkdir
(
"toot"
,
0777
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
ensureTestHome
(
helmpath
.
Home
(
tmp
),
t
)
ensureTestHome
(
helmpath
.
Home
(
tmp
),
t
)
oldhome
:=
homePath
()
oldhome
:=
homePath
()
helmHome
=
tmp
helmHome
=
tmp
...
...
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