MCPcopy
hub / github.com/helm/helm / LoadDir

Function LoadDir

pkg/chart/loader/load.go:77–104  ·  view source on GitHub ↗
(dir string)

Source from the content-addressed store, hash-verified

75}
76
77func LoadDir(dir string) (chart.Charter, error) {
78 topdir, err := filepath.Abs(dir)
79 if err != nil {
80 return nil, err
81 }
82
83 name := filepath.Join(topdir, "Chart.yaml")
84 data, err := os.ReadFile(name)
85 if err != nil {
86 return nil, fmt.Errorf("unable to detect chart at %s: %w", name, err)
87 }
88
89 c := new(chartBase)
90 err = yaml.Unmarshal(data, c)
91 if err != nil {
92 return nil, fmt.Errorf("cannot load Chart.yaml: %w", err)
93 }
94
95 switch c.APIVersion {
96 case c2.APIVersionV1, c2.APIVersionV2, "":
97 return c2load.Load(dir)
98 case c3.APIVersionV3:
99 return c3load.Load(dir)
100 default:
101 return nil, errors.New("unsupported chart version")
102 }
103
104}
105
106// FileLoader loads a chart from a file
107type FileLoader string

Callers 2

RunMethod · 0.92
LoadMethod · 0.70

Calls 1

LoadMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…