updateHelmDependencies runs `helm dependency update .` on the given chartDir.
(t testing.TB, helmPath, chartDir string)
| 268 | |
| 269 | // updateHelmDependencies runs `helm dependency update .` on the given chartDir. |
| 270 | func updateHelmDependencies(t testing.TB, helmPath, chartDir string) error { |
| 271 | // Remove charts/ from chartDir if it exists. |
| 272 | err := os.RemoveAll(filepath.Join(chartDir, "charts")) |
| 273 | if err != nil { |
| 274 | return xerrors.Errorf("failed to remove charts/ directory: %w", err) |
| 275 | } |
| 276 | |
| 277 | // Regenerate the chart dependencies. |
| 278 | cmd := exec.Command(helmPath, "dependency", "update", "--skip-refresh", ".") |
| 279 | cmd.Dir = chartDir |
| 280 | t.Logf("exec command: %v", cmd.Args) |
| 281 | out, err := cmd.CombinedOutput() |
| 282 | if err != nil { |
| 283 | return xerrors.Errorf("failed to run `helm dependency build`: %w\noutput: %s", err, out) |
| 284 | } |
| 285 | |
| 286 | return nil |
| 287 | } |
| 288 | |
| 289 | // runHelmTemplate runs helm template on the given chart with the given values and |
| 290 | // returns the raw output. |
no test coverage detected