Skip to content

Commit

Permalink
Enable hooks (#17)
Browse files Browse the repository at this point in the history
* enable hooks

* Add hooks to returned manifests

* Instantiate array with known size
  • Loading branch information
tvandinther authored Jan 22, 2025
1 parent fb34fe4 commit 4d845e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion pkg/helm/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ func RunTemplate(chartRef *ChartRef, values map[string]interface{}, releaseName,
client.APIVersions = apiVersions
}
client.IncludeCRDs = true
client.DisableHooks = true

rel, err := client.Run(chart, values)
if err != nil {
Expand Down
10 changes: 9 additions & 1 deletion pkg/plugin/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func init() {
}

splitManifests := releaseutil.SplitManifests(release.Manifest)
var manifestSlice []types.Manifest
manifestSlice := make([]types.Manifest, 0, len(splitManifests)+len(release.Hooks))
for _, manifestString := range splitManifests {
var manifest types.Manifest
yaml.Unmarshal([]byte(manifestString), &manifest)
Expand All @@ -70,6 +70,14 @@ func init() {
}
}

for _, hook := range release.Hooks {
var manifest types.Manifest
yaml.Unmarshal([]byte(hook.Manifest), &manifest)
if len(manifest) > 0 {
manifestSlice = append(manifestSlice, manifest)
}
}

util.SortManifests(manifestSlice)

return &plugin.MethodResult{V: manifestSlice}, nil
Expand Down

0 comments on commit 4d845e0

Please sign in to comment.