Skip to content

Commit

Permalink
Fix chartify to take --include-crds into account (#1761)
Browse files Browse the repository at this point in the history
Fixes #1760
  • Loading branch information
mumoshu authored Apr 8, 2021
1 parent d703e17 commit 2ff06a8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/spf13/cobra v1.1.1
github.com/tatsushid/go-prettytable v0.0.0-20141013043238-ed2d14c29939
github.com/urfave/cli v1.22.5
github.com/variantdev/chartify v0.7.2
github.com/variantdev/chartify v0.7.3
github.com/variantdev/dag v0.0.0-20191028002400-bb0b3c785363
github.com/variantdev/vals v0.13.0
go.uber.org/multierr v1.6.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,8 @@ github.com/variantdev/chartify v0.7.1 h1:m03k/LDf1skLmOjX8Fj1QmnlaW84BD5iwi1EP56
github.com/variantdev/chartify v0.7.1/go.mod h1:qF4XzQlkfH/6k2jAi1hLas+lK4zSCa8kY+r5JdmLA68=
github.com/variantdev/chartify v0.7.2 h1:H7a9xD4rfyKkLDhCO/Oj3VfYnJRb92Dqk+GR6vpUXK4=
github.com/variantdev/chartify v0.7.2/go.mod h1:qF4XzQlkfH/6k2jAi1hLas+lK4zSCa8kY+r5JdmLA68=
github.com/variantdev/chartify v0.7.3 h1:uX0mN8PmYHZDWILcg41sQfasJ7TT/CYnYWSmDgsIBIA=
github.com/variantdev/chartify v0.7.3/go.mod h1:qF4XzQlkfH/6k2jAi1hLas+lK4zSCa8kY+r5JdmLA68=
github.com/variantdev/dag v0.0.0-20191028002400-bb0b3c785363 h1:KrfQBEUn+wEOQ/6UIfoqRDvn+Q/wZridQ7t0G1vQqKE=
github.com/variantdev/dag v0.0.0-20191028002400-bb0b3c785363/go.mod h1:pH1TQsNSLj2uxMo9NNl9zdGy01Wtn+/2MT96BrKmVyE=
github.com/variantdev/vals v0.13.0 h1:zdtTBjoWKkUGdFauxETkDVjqWXdjUNwI+ggWcUmpxv8=
Expand Down
3 changes: 3 additions & 0 deletions pkg/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,15 @@ func (a *App) Template(c TemplateConfigProvider) error {
opts := []LoadOption{SetRetainValuesFiles(c.SkipCleanup())}

return a.ForEachState(func(run *Run) (ok bool, errs []error) {
includeCRDs := c.IncludeCRDs()

// `helm template` in helm v2 does not support local chart.
// So, we set forceDownload=true for helm v2 only
prepErr := run.withPreparedCharts("template", state.ChartPrepareOptions{
ForceDownload: !run.helm.IsHelm3(),
SkipRepos: c.SkipDeps(),
SkipDeps: c.SkipDeps(),
IncludeCRDs: &includeCRDs,
}, func() {
ok, errs = a.template(run, c)
})
Expand Down
8 changes: 8 additions & 0 deletions pkg/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@ type ChartPrepareOptions struct {
SkipRepos bool
SkipDeps bool
SkipResolve bool
IncludeCRDs *bool
Wait bool
WaitForJobs bool
OutputDir string
Expand Down Expand Up @@ -1063,6 +1064,13 @@ func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurre
chartifyOpts.SkipDeps = true
}

includeCRDs := true
if opts.IncludeCRDs != nil {
includeCRDs = *opts.IncludeCRDs
}

chartifyOpts.IncludeCRDs = includeCRDs

out, err := c.Chartify(release.Name, chartPath, chartify.WithChartifyOpts(chartifyOpts))
if err != nil {
results <- &chartPrepareResult{err: err}
Expand Down

0 comments on commit 2ff06a8

Please sign in to comment.