updateHelmDependencies runs `helm dependency update .` on the given chartDir.
(t testing.TB, helmPath, chartDir string)
| 214 | |
| 215 | // updateHelmDependencies runs `helm dependency update .` on the given chartDir. |
| 216 | func updateHelmDependencies(t testing.TB, helmPath, chartDir string) error { |
| 217 | // Remove charts/ from chartDir if it exists. |
| 218 | err := os.RemoveAll(filepath.Join(chartDir, "charts")) |
| 219 | if err != nil { |
| 220 | return xerrors.Errorf("failed to remove charts/ directory: %w", err) |
| 221 | } |
| 222 | |
| 223 | // Regenerate the chart dependencies. |
| 224 | cmd := exec.Command(helmPath, "dependency", "update", "--skip-refresh", ".") |
| 225 | cmd.Dir = chartDir |
| 226 | t.Logf("exec command: %v", cmd.Args) |
| 227 | out, err := cmd.CombinedOutput() |
| 228 | if err != nil { |
| 229 | return xerrors.Errorf("failed to run `helm dependency build`: %w\noutput: %s", err, out) |
| 230 | } |
| 231 | |
| 232 | return nil |
| 233 | } |
| 234 | |
| 235 | // runHelmTemplate runs helm template on the given chart with the given values and |
| 236 | // returns the raw output. |
no test coverage detected