// getManifest implements 'helm get manifest' func (g *getManifestCmd) run() error { res, err := g.client.ReleaseContent(g.release, helm.ContentReleaseVersion(g.version)) if err != nil { return prettyError(err) } fmt.Fprintln(g.out, res.Release.Manifest) return nil }
func (u *upgradeCmd) run() error { chartPath, err := locateChartPath(u.chart, u.version, u.verify, u.keyring) if err != nil { return err } if u.install { // If a release does not exist, install it. If another error occurs during // the check, ignore the error and continue with the upgrade. // // The returned error is a grpc.rpcError that wraps the message from the original error. // So we're stuck doing string matching against the wrapped error, which is nested somewhere // inside of the grpc.rpcError message. _, err := u.client.ReleaseContent(u.release, helm.ContentReleaseVersion(1)) if err != nil && strings.Contains(err.Error(), driver.ErrReleaseNotFound.Error()) { fmt.Fprintf(u.out, "Release %q does not exist. Installing it now.\n", u.release) ic := &installCmd{ chartPath: chartPath, client: u.client, out: u.out, name: u.release, valuesFile: u.valuesFile, dryRun: u.dryRun, verify: u.verify, disableHooks: u.disableHooks, keyring: u.keyring, values: u.values, namespace: u.namespace, } return ic.run() } } rawVals, err := u.vals() if err != nil { return err } _, err = u.client.UpdateRelease(u.release, chartPath, helm.UpdateValueOverrides(rawVals), helm.UpgradeDryRun(u.dryRun), helm.UpgradeDisableHooks(u.disableHooks)) if err != nil { return fmt.Errorf("UPGRADE FAILED: %v", prettyError(err)) } success := u.release + " has been upgraded. Happy Helming!\n" fmt.Fprintf(u.out, success) // Print the status like status command does status, err := u.client.ReleaseStatus(u.release) if err != nil { return prettyError(err) } PrintStatus(u.out, status) return nil }
func (g *getHooksCmd) run() error { res, err := g.client.ReleaseContent(g.release, helm.ContentReleaseVersion(g.version)) if err != nil { fmt.Fprintln(g.out, g.release) return prettyError(err) } for _, hook := range res.Release.Hooks { fmt.Fprintf(g.out, "---\n# %s\n%s", hook.Name, hook.Manifest) } return nil }
// getCmd is the command that implements 'helm get' func (g *getCmd) run() error { res, err := g.client.ReleaseContent(g.release, helm.ContentReleaseVersion(g.version)) if err != nil { return prettyError(err) } cfg, err := chartutil.CoalesceValues(res.Release.Chart, res.Release.Config) if err != nil { return err } cfgStr, err := cfg.YAML() if err != nil { return err } data := map[string]interface{}{ "Release": res.Release, "ComputedValues": cfgStr, "ReleaseDate": timeconv.Format(res.Release.Info.LastDeployed, time.ANSIC), } return tpl(getTemplate, data, g.out) }