MCPcopy
hub / github.com/roboll/helmfile / TemplateRelease

Method TemplateRelease

pkg/helmexec/exec.go:350–386  ·  view source on GitHub ↗
(name string, chart string, flags ...string)

Source from the content-addressed store, hash-verified

348}
349
350func (helm *execer) TemplateRelease(name string, chart string, flags ...string) error {
351 helm.logger.Infof("Templating release=%v, chart=%v", name, chart)
352 var args []string
353 if helm.IsHelm3() {
354 args = []string{"template", name, chart}
355 } else {
356 args = []string{"template", chart, "--name", name}
357 }
358
359 out, err := helm.exec(append(args, flags...), map[string]string{})
360
361 var outputToFile bool
362
363 for _, f := range flags {
364 if strings.HasPrefix("--output-dir", f) {
365 outputToFile = true
366 break
367 }
368 }
369
370 if outputToFile {
371 // With --output-dir is passed to helm-template,
372 // we can safely direct all the logs from it to our logger.
373 //
374 // It's safe because anything written to stdout by helm-template with output-dir is logs,
375 // like excessive `wrote path/to/output/dir/chart/template/file.yaml` messages,
376 // but manifets.
377 //
378 // See https://github.com/roboll/helmfile/pull/1691#issuecomment-805636021 for more information.
379 helm.info(out)
380 } else {
381 // Always write to stdout for use with e.g. `helmfile template | kubectl apply -f -`
382 helm.write(nil, out)
383 }
384
385 return err
386}
387
388func (helm *execer) DiffRelease(context HelmContext, name, chart string, suppressDiff bool, flags ...string) error {
389 if context.Writer != nil {

Callers

nothing calls this directly

Calls 4

IsHelm3Method · 0.95
execMethod · 0.95
infoMethod · 0.95
writeMethod · 0.95

Tested by

no test coverage detected