MCPcopy
hub / github.com/helm/helm / replaceRelease

Method replaceRelease

pkg/action/install.go:692–717  ·  view source on GitHub ↗

replaceRelease replaces an older release with this one This allows us to reuse names by superseding an existing release with a new one

(rel *release.Release)

Source from the content-addressed store, hash-verified

690//
691// This allows us to reuse names by superseding an existing release with a new one
692func (i *Install) replaceRelease(rel *release.Release) error {
693 hist, err := i.cfg.Releases.History(rel.Name)
694 if err != nil || len(hist) == 0 {
695 // No releases exist for this name, so we can return early
696 return nil
697 }
698 hl, err := releaseListToV1List(hist)
699 if err != nil {
700 return err
701 }
702
703 releaseutil.Reverse(hl, releaseutil.SortByRevision)
704 last := hl[0]
705
706 // Update version to the next available
707 rel.Version = last.Version + 1
708
709 // Do not change the status of a failed release.
710 if last.Info.Status == rcommon.StatusFailed {
711 return nil
712 }
713
714 // For any other status, mark it as superseded and store the old record
715 last.SetStatus(rcommon.StatusSuperseded, "superseded by new release")
716 return i.recordRelease(last)
717}
718
719// write the <data> to <output-dir>/<name>. <appendData> controls if the file is created or content will be appended
720func writeToFile(outputDir string, name string, data string, appendData bool) error {

Callers 1

RunWithContextMethod · 0.95

Calls 4

recordReleaseMethod · 0.95
HistoryMethod · 0.80
releaseListToV1ListFunction · 0.70
SetStatusMethod · 0.45

Tested by

no test coverage detected