roboll / helmfile

Deploy Kubernetes Helm Charts
MIT License
4.04k stars 566 forks source link

could not deduce environment blcok error when no environment specified #1649

Open darkn3rd opened 3 years ago

darkn3rd commented 3 years ago

Description

Helmfile failing due to error with environment block, which there is none, and I am not using environments.

Config


### Steps

```yaml
## helmfile.yaml
repositories:
  - name: prometheus-community
    url: https://prometheus-community.github.io/helm-charts
  - name: stable
    url: https://charts.helm.sh/stable

releases:
  - name: my-prometheus
    namespace: {{ env "NAMESPACE" | default "monitoring" }}
    chart: prometheus-community/kube-prometheus-stack
    values:
      - grafana:
          adminPassword: {{ requiredEnv "GRAFANA_ADMIN_PASSWORD" }}
     disableValidation: true
helmfile --debug diff

Actual Results

processing file "helmfile.yaml" in directory "."
first-pass rendering starting for "helmfile.yaml.part.0": inherited=&{default map[] map[]}, overrode=<nil>
first-pass uses: &{default map[] map[]}
first-pass rendering output of "helmfile.yaml.part.0":
 0: repositories:
 1:   - name: prometheus-community
 2:     url: https://prometheus-community.github.io/helm-charts
 3:   - name: stable
 4:     url: https://charts.helm.sh/stable
 5: 
 6: releases:
 7:   - name: my-prometheus
 8:     namespace: monitoring
 9:     chart: prometheus-community/kube-prometheus-stack
10:     values:
11:       - grafana:
12:           adminPassword: admin123
13:      disableValidation: true
14: 

could not deduce `environment:` block, configuring only .Environment.Name. error: failed to read helmfile.yaml.part.0: reading document at index 1: yaml: line 13: did not find expected key
error in first-pass rendering: result of "helmfile.yaml.part.0":
 0: repositories:
 1:   - name: prometheus-community
 2:     url: https://prometheus-community.github.io/helm-charts
 3:   - name: stable
 4:     url: https://charts.helm.sh/stable
 5: 
 6: releases:
 7:   - name: my-prometheus
 8:     namespace: monitoring
 9:     chart: prometheus-community/kube-prometheus-stack
10:     values:
11:       - grafana:
12:           adminPassword: admin123
13:      disableValidation: true
14: 

first-pass produced: &{default map[] map[]}
first-pass rendering result of "helmfile.yaml.part.0": {default map[] map[]}
second-pass rendering result of "helmfile.yaml.part.0":
 0: repositories:
 1:   - name: prometheus-community
 2:     url: https://prometheus-community.github.io/helm-charts
 3:   - name: stable
 4:     url: https://charts.helm.sh/stable
 5: 
 6: releases:
 7:   - name: my-prometheus
 8:     namespace: monitoring
 9:     chart: prometheus-community/kube-prometheus-stack
10:     values:
11:       - grafana:
12:           adminPassword: admin123
13:      disableValidation: true
14: 
darkn3rd commented 3 years ago

The text editor visual studio code auto-indented the disableValidation which lead to misleading errors. I don't know if there is any interest in fixing misleading errors, if not, I can close.