Use base64 strings for chart repo certs [#74]

This should be a more flexible option since certificates aren't likely
to be part of the actual workspace and may be environment-dependent. It
also mirrors the kube_certificate, which is nice.
This commit is contained in:
Erin Call
2020-01-20 15:40:36 -08:00
parent ee6d8d1724
commit 18313eeb5c
8 changed files with 181 additions and 18 deletions

View File

@@ -9,9 +9,9 @@ import (
// AddRepo is an execution step that calls `helm repo add` when executed.
type AddRepo struct {
*config
repo string
caFile string
cmd cmd
repo string
certs *repoCerts
cmd cmd
}
// NewAddRepo creates an AddRepo for the given repo-spec. No validation is performed at this time.
@@ -19,7 +19,7 @@ func NewAddRepo(cfg env.Config, repo string) *AddRepo {
return &AddRepo{
config: newConfig(cfg),
repo: repo,
caFile: cfg.RepoCAFile,
certs: newRepoCerts(cfg),
}
}
@@ -38,14 +38,16 @@ func (a *AddRepo) Prepare() error {
return fmt.Errorf("bad repo spec '%s'", a.repo)
}
if err := a.certs.write(); err != nil {
return err
}
name := split[0]
url := split[1]
args := a.globalFlags()
args = append(args, "repo", "add")
if a.caFile != "" {
args = append(args, "--ca-file", a.caFile)
}
args = append(args, a.certs.flags()...)
args = append(args, name, url)
a.cmd = command(helmBin, args...)