Commit 7009c3c3 authored by Matt Butcher's avatar Matt Butcher Committed by GitHub

Merge pull request #1453 from technosophos/fix/792-serve-update-index

fix(helm): create index file as 'helm serve' starts up.
parents 9b31ad48 dce2079b
...@@ -28,11 +28,16 @@ import ( ...@@ -28,11 +28,16 @@ import (
"k8s.io/helm/pkg/repo" "k8s.io/helm/pkg/repo"
) )
const serveDesc = `This command starts a local chart repository server that serves charts from a local directory.` const serveDesc = `
This command starts a local chart repository server that serves charts from a local directory.
The new server will provide HTTP access to a repository. By default, it will
scan all of the charts in '$HELM_HOME/repository/local' and serve those over
the a local IPv4 TCP port (default '127.0.0.1:8879').
`
type serveCmd struct { type serveCmd struct {
out io.Writer out io.Writer
home helmpath.Home
address string address string
repoPath string repoPath string
} }
...@@ -44,7 +49,6 @@ func newServeCmd(out io.Writer) *cobra.Command { ...@@ -44,7 +49,6 @@ func newServeCmd(out io.Writer) *cobra.Command {
Short: "start a local http web server", Short: "start a local http web server",
Long: serveDesc, Long: serveDesc,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
srv.home = helmpath.Home(homePath())
return srv.run() return srv.run()
}, },
} }
...@@ -65,6 +69,11 @@ func (s *serveCmd) run() error { ...@@ -65,6 +69,11 @@ func (s *serveCmd) run() error {
return err return err
} }
fmt.Fprintln(s.out, "Regenerating index. This may take a moment.")
if err := index(repoPath, "http://"+s.address, ""); err != nil {
return err
}
fmt.Fprintf(s.out, "Now serving you on %s\n", s.address) fmt.Fprintf(s.out, "Now serving you on %s\n", s.address)
return repo.StartLocalRepo(repoPath, s.address) return repo.StartLocalRepo(repoPath, s.address)
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment