Skip to content

Commit

Permalink
feat: add buildDependenciesSkipRefresh option to HelmRelease for skip…
Browse files Browse the repository at this point in the history
…ping refresh of built dependencies
  • Loading branch information
art-shutter committed Jan 20, 2025
1 parent dfb2b7f commit 3db7885
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions docs-v2/content/en/schemas/v4beta12.json
Original file line number Diff line number Diff line change
Expand Up @@ -2365,6 +2365,12 @@
"name"
],
"properties": {
"buildDependenciesSkipRefresh": {
"type": "boolean",
"description": "should the refresh of already built dependencies be skipped. Ignored when `skipBuildDependencies` is `false`.",
"x-intellij-html-description": "should the refresh of already built dependencies be skipped. Ignored when <code>skipBuildDependencies</code> is <code>false</code>.",
"default": "false"
},
"chartPath": {
"type": "string",
"description": "local path to a packaged Helm chart or an unpacked Helm chart directory.",
Expand Down Expand Up @@ -2494,6 +2500,7 @@
"wait",
"recreatePods",
"skipBuildDependencies",
"buildDependenciesSkipRefresh",
"skipTests",
"useHelmSecrets",
"repo",
Expand Down
6 changes: 5 additions & 1 deletion pkg/skaffold/render/renderer/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ func (h Helm) generateHelmManifest(ctx context.Context, builds []graph.Artifact,
// Build Chart dependencies, but allow a user to skip it.
if !release.SkipBuildDependencies && release.ChartPath != "" {
log.Entry(ctx).Info("Building helm dependencies...")
if err := helm.ExecWithStdoutAndStderr(ctx, h, io.Discard, errBuffer, false, env, "dep", "build", release.ChartPath); err != nil {
cmdArgs := []string{"dep", "build", release.ChartPath}
if release.BuildDependenciesSkipRefresh {
cmdArgs = []string{"dep", "build", "--skip-refresh", release.ChartPath}
}
if err := helm.ExecWithStdoutAndStderr(ctx, h, io.Discard, errBuffer, false, env, cmdArgs...); err != nil {
log.Entry(ctx).Info(errBuffer.String())
return nil, helm.UserErr("building helm dependencies", err)
}
Expand Down
6 changes: 4 additions & 2 deletions pkg/skaffold/schema/latest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,10 @@ type HelmRelease struct {
// Ignored for `remoteChart`.
SkipBuildDependencies bool `yaml:"skipBuildDependencies,omitempty"`

// BuildDependenciesSkipRefresh should the refresh of already built dependencies be skipped.
// Ignored when `skipBuildDependencies` is `false`.
BuildDependenciesSkipRefresh bool `yaml:"buildDependenciesSkipRefresh,omitempty"`

// SkipTests should ignore helm test during manifests generation.
// Defaults to `false`
SkipTests bool `yaml:"skipTests,omitempty"`
Expand Down Expand Up @@ -1856,7 +1860,6 @@ func (clusterDetails *ClusterDetails) UnmarshalYAML(value *yaml.Node) error {
// Unmarshal the remaining values
aux := (*ClusterDetailsForUnmarshaling)(clusterDetails)
err = yaml.Unmarshal(remaining, aux)

if err != nil {
return err
}
Expand All @@ -1883,7 +1886,6 @@ func (ka *KanikoArtifact) UnmarshalYAML(value *yaml.Node) error {
// Unmarshal the remaining values
aux := (*KanikoArtifactForUnmarshaling)(ka)
err = yaml.Unmarshal(remaining, aux)

if err != nil {
return err
}
Expand Down

0 comments on commit 3db7885

Please sign in to comment.