Skip to content

Commit

Permalink
fix: add chart hooks to the output.
Browse files Browse the repository at this point in the history
Relates to #16
  • Loading branch information
mgoltzsche committed May 23, 2021
1 parent 0740852 commit e33800a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions pkg/helm/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ func renderChart(chartRequested *chart.Chart, req *config.ChartConfig, getters g
chartHookMatcher := matcher.NewChartHookMatcher(transformer.Excludes, !req.ExcludeHooks)
transformer.Excludes = chartHookMatcher

transformed, err := transformer.TransformManifest(bytes.NewReader([]byte((release.Manifest))))
manifest := release.Manifest
for _, hook := range release.Hooks {
manifest += fmt.Sprintf("\n---\n%s", hook.Manifest)
}

transformed, err := transformer.TransformManifest(bytes.NewReader([]byte((manifest))))
if err != nil {
return nil, err
}
Expand All @@ -119,7 +124,7 @@ func renderChart(chartRequested *chart.Chart, req *config.ChartConfig, getters g
return nil, errors.Errorf("chart %s output is empty", chartRequested.Metadata.Name)
}
if hooks := chartHookMatcher.FoundHooks(); !req.ExcludeHooks && len(hooks) > 0 {
log.Printf("WARNING: The chart output contains the following hooks: %s", strings.Join(hooks, ", "))
log.Printf("WARNING: Chart output contains the following hooks: %s", strings.Join(hooks, ", "))
}
return transformed, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/helm/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func loadValues(cfg *config.ChartConfig, getters getter.Providers) (map[string]i
}
vals, err := valueOpts.MergeValues(valueGetters)
if err != nil {
return nil, errors.Wrap(err, "load values: %w")
return nil, errors.Wrap(err, "load values")
}
return vals, nil
}
Expand Down

0 comments on commit e33800a

Please sign in to comment.