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
04665a54
Unverified
Commit
04665a54
authored
Nov 24, 2017
by
Matthew Fisher
Committed by
GitHub
Nov 24, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3196 from adshmh/add-app-version-option-to-helm-package
add --app-version flag to 'helm package'
parents
b7c2a95f
9e869700
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
1 deletion
+42
-1
package.go
cmd/helm/package.go
+7
-0
package_test.go
cmd/helm/package_test.go
+33
-0
helm_package.md
docs/helm/helm_package.md
+2
-1
No files found.
cmd/helm/package.go
View file @
04665a54
...
...
@@ -56,6 +56,7 @@ type packageCmd struct {
key
string
keyring
string
version
string
appVersion
string
destination
string
dependencyUpdate
bool
...
...
@@ -99,6 +100,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
.
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
.
appVersion
,
"app-version"
,
""
,
"set the appVersion on the chart to this version"
)
f
.
StringVarP
(
&
pkg
.
destination
,
"destination"
,
"d"
,
"."
,
"location to write the chart."
)
f
.
BoolVarP
(
&
pkg
.
dependencyUpdate
,
"dependency-update"
,
"u"
,
false
,
`update dependencies from "requirements.yaml" to dir "charts/" before packaging`
)
...
...
@@ -139,6 +141,11 @@ func (p *packageCmd) run() error {
debug
(
"Setting version to %s"
,
p
.
version
)
}
if
p
.
appVersion
!=
""
{
ch
.
Metadata
.
AppVersion
=
p
.
appVersion
debug
(
"Setting appVersion to %s"
,
p
.
appVersion
)
}
if
filepath
.
Base
(
path
)
!=
ch
.
Metadata
.
Name
{
return
fmt
.
Errorf
(
"directory name (%s) and Chart.yaml name (%s) must match"
,
filepath
.
Base
(
path
),
ch
.
Metadata
.
Name
)
}
...
...
cmd/helm/package_test.go
View file @
04665a54
...
...
@@ -25,6 +25,7 @@ import (
"github.com/spf13/cobra"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/helm/helmpath"
"k8s.io/helm/pkg/proto/hapi/chart"
)
...
...
@@ -200,6 +201,38 @@ func TestPackage(t *testing.T) {
}
}
func
TestSetAppVersion
(
t
*
testing
.
T
)
{
var
ch
*
chart
.
Chart
expectedAppVersion
:=
"app-version-foo"
tmp
,
_
:=
ioutil
.
TempDir
(
""
,
"helm-package-app-version-"
)
defer
os
.
RemoveAll
(
tmp
)
c
:=
newPackageCmd
(
&
bytes
.
Buffer
{})
flags
:=
map
[
string
]
string
{
"destination"
:
tmp
,
"app-version"
:
expectedAppVersion
,
}
setFlags
(
c
,
flags
)
err
:=
c
.
RunE
(
c
,
[]
string
{
"testdata/testcharts/alpine"
})
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error %q"
,
err
)
}
chartPath
:=
filepath
.
Join
(
tmp
,
"alpine-0.1.0.tgz"
)
if
fi
,
err
:=
os
.
Stat
(
chartPath
);
err
!=
nil
{
t
.
Errorf
(
"expected file %q, got err %q"
,
chartPath
,
err
)
}
else
if
fi
.
Size
()
==
0
{
t
.
Errorf
(
"file %q has zero bytes."
,
chartPath
)
}
ch
,
err
=
chartutil
.
Load
(
chartPath
)
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error loading packaged chart: %v"
,
err
)
}
if
ch
.
Metadata
.
AppVersion
!=
expectedAppVersion
{
t
.
Errorf
(
"expected app-version %q, found %q"
,
expectedAppVersion
,
ch
.
Metadata
.
AppVersion
)
}
}
func
setFlags
(
cmd
*
cobra
.
Command
,
flags
map
[
string
]
string
)
{
dest
:=
cmd
.
Flags
()
for
f
,
v
:=
range
flags
{
...
...
docs/helm/helm_package.md
View file @
04665a54
...
...
@@ -23,6 +23,7 @@ helm package [flags] [CHART_PATH] [...]
### Options
```
--app-version string set the appVersion on the chart to this version
-u, --dependency-update update dependencies from "requirements.yaml" to dir "charts/" before packaging
-d, --destination string location to write the chart. (default ".")
--key string name of the key to use when signing. Used if --sign is true
...
...
@@ -46,4 +47,4 @@ helm package [flags] [CHART_PATH] [...]
### SEE ALSO
*
[
helm
](
helm.md
)
- The Helm package manager for Kubernetes.
###### Auto generated by spf13/cobra on
7
-Nov-2017
###### Auto generated by spf13/cobra on
24
-Nov-2017
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