MCPcopy
hub / github.com/databus23/helm-diff / run

Method run

cmd/local.go:111–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

109}
110
111func (l *local) run() error {
112 cleanup, err := l.prepareStdinValues()
113 if err != nil {
114 return err
115 }
116 if cleanup != nil {
117 defer cleanup()
118 }
119
120 excludes := []string{manifest.Helm3TestHook, manifest.Helm2TestSuccessHook}
121 if l.includeTests {
122 excludes = []string{}
123 }
124
125 manifest1, err := l.renderChart(l.chart1)
126 if err != nil {
127 return fmt.Errorf("failed to render chart %q: %w", l.chart1, err)
128 }
129 specs1 := manifest.Parse(manifest1, l.namespace, l.normalizeManifests, excludes...)
130 manifest1 = nil //nolint:ineffassign // nil to allow GC to reclaim raw bytes before rendering the second chart
131
132 manifest2, err := l.renderChart(l.chart2)
133 if err != nil {
134 return fmt.Errorf("failed to render chart %q: %w", l.chart2, err)
135 }
136 specs2 := manifest.Parse(manifest2, l.namespace, l.normalizeManifests, excludes...)
137
138 seenAnyChanges := diff.Manifests(specs1, specs2, &l.Options, os.Stdout)
139
140 if l.detailedExitCode && seenAnyChanges {
141 return Error{
142 error: errors.New("identified at least one change, exiting with non-zero exit code (detailed-exitcode parameter enabled)"),
143 Code: 2,
144 }
145 }
146
147 return nil
148}
149
150func (l *local) prepareStdinValues() (func(), error) {
151 var name string

Callers 1

localCmdFunction · 0.95

Calls 4

prepareStdinValuesMethod · 0.95
renderChartMethod · 0.95
ParseFunction · 0.92
ManifestsFunction · 0.92

Tested by

no test coverage detected