GoogleContainerTools / GoogleContainerTools/skaffold

skaffold render passes incorrect global helm flags to helm dep build

Open
#9,169 3 comments 1 reaction 1 assignee Claimed by @renzodavid9 View on GitHub
area/render deploy/helm kind/bug priority/p2
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

### Expected behavior
Helm dependency build worked as expected on skaffold 2.2.0 with the workaround mentioned in https://github.com/GoogleContainerTools/skaffold/issues/5445#issuecomment-1284482680

The fix for that issue was merged and available since skaffold 2.4.0, so I tried to upgrade to the latest version and remove the workaround.

### Actual behavior
Skaffold/helm breaks becasue of an error caused by global flags being passed to `helm dep build`. These flags are valid for `helm template`, but not `helm dep`.

I should note here that I am specifying helm global flags as a helm anchor.

### Information

- Skaffold version: 2.9.0
- Operating system: macOS 13.5.2
- Installed via: Homebrew
- Contents of skaffold.yaml:

```yaml
apiVersion: skaffold/v4beta3
kind: Config
metadata:
name: cluster
build:
local:
push: false

.helm_flags: &helm_flags
global:
- "--include-crds"
- "--api-versions"
- "apiregistration.k8s.io/v1"

.helm_release: &helm_release
namespace: default
chartPath: charts/k8s-infra
skipBuildDependencies: false
version: 1.0.0

profiles:
- name: apps
manifests:
helm:
flags: *helm_flags
releases:
- <<: *helm_release
name: trv-data-apps-cluster
valuesFiles:
- charts/k8s-infra/values.yaml
- charts/k8s-infra/values/apps.yaml

```

### Steps to reproduce the behavior
```
$ skaffold -v debug render --filename ./skaffold.yaml --profile apps --output ./output.yaml --offline=true
...
INFO[0000] Skaffold &{Version:v2.9.0 ConfigVersion:skaffold/v4beta8 GitVersion: GitCommit:6071a3f7574702c8666a243d89254e9b0d8ff4d7 BuildDate:2023-11-07T13:20:11Z GoVersion:go1.21.0 Compiler:gc Platform:darwin/arm64 User:} subtask=-1 task=DevLoop
...
INFO[0000] Building helm dependencies... subtask=0 task=Render
DEBU[0000] Running command: [helm --kube-context CONTEXT dep build charts/k8s-infra --include-crds --api-versions apiregistration.k8s.io/v1] subtask=0 task=Render
INFO[0000] Error: unknown flag: --include-crds subtask=0 task=Render
DEBU[0000] Running command: [tput colors] subtask=-1 task=DevLoop
DEBU[0000] Command output: [256] subtask=-1 task=DevLoop
building helm dependencies: exit status 1
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.