Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ordering issue with --set when using needs #1520

Closed
Stono opened this issue Oct 9, 2020 · 7 comments · Fixed by #1529
Closed

Ordering issue with --set when using needs #1520

Stono opened this issue Oct 9, 2020 · 7 comments · Fixed by #1529

Comments

@Stono
Copy link
Contributor

Stono commented Oct 9, 2020

Really obscure bug this one but has broken our builds after upgrading to 0.130.1 from 0.111.0 to make use of needs

Given a pretty simple helmfile:

helmDefaults:
  timeout: 900

releases:
- name: istio
  namespace: istio-system
  chart: ./charts/istio
  values:
  - environments/{{ requiredEnv "HELMFILE_ENV" }}/istio/common.yaml
  - environments/{{ requiredEnv "HELMFILE_ENV" }}/istio/values.yaml

- name: istio-crd
  namespace: istio-system
  chart: ./charts/istio-crd
  values:
  - environments/{{ requiredEnv "HELMFILE_ENV" }}/istio/common.yaml
  needs:
  - istio-system/istio

The following command is generated by our cli (lots of runtime set's):

helmfile template --args='--set global.version=could-not-get-git-revision --set global.revision=could-not-get-git-revision --set global.env=testing --set global.region=europe-west4 --set serviceDiscovery.git.url=could-not-get-git-origin --set serviceDiscovery.git.revision=could-not-get-git-revision --set serviceDiscovery.git.lastCommitter=unknown --set serviceDiscovery.baseImage=unknown --set global.version=could-not-get-git-revision --set global.revision=could-not-get-git-revision --set global.env=testing --set global.region=europe-west4 --set serviceDiscovery.git.url=could-not-get-git-origin --set serviceDiscovery.git.revision=could-not-get-git-revision --set serviceDiscovery.git.lastCommitter=unknown --set serviceDiscovery.baseImage=unknown'

Which results in this error:

Templating release=istio-crd, chart=charts/istio-crd
in ./helmfile.yaml: command "/usr/local/bin/helm" exited with non-zero status:

PATH:
  /usr/local/bin/helm

ARGS:
  0: helm (4 bytes)
  1: template (8 bytes)
  2: charts/istio-crd (16 bytes)
  3: --name (6 bytes)
  4: istio-crd (9 bytes)
  5: --namespace (11 bytes)
  6: istio-system (12 bytes)
  7: --values (8 bytes)
  8: /var/folders/qq/0l_ldzbd2pxg17slmlkv9vtryw2d_d/T/values535900075 (64 bytes)
  9: --set (5 bytes)
  10: global.version=could-not-get-git-revision (41 bytes)
  11: --set (5 bytes)
  12: global.revision=could-not-get-git-revision (42 bytes)
  13: --set (5 bytes)
  14: global.env=testing (18 bytes)
  15: --set (5 bytes)
  16: global.region=europe-west4 (26 bytes)
  17: --set (5 bytes)
  18: serviceDiscovery.git.url=could-not-get-git-origin (49 bytes)
  19: --set (5 bytes)
  20: serviceDiscovery.git.revision=could-not-get-git-revision (56 bytes)
  21: --set (5 bytes)
  22: serviceDiscovery.git.lastCommitter=unknown (42 bytes)
  23: --set (5 bytes)
  24: serviceDiscovery.baseImage=unknown (34 bytes)
  25: --set (5 bytes)
  26: global.version=could-not-get-git-revision (41 bytes)
  27: --set (5 bytes)
  28: global.revision=could-not-get-git-revision (42 bytes)
  29: --set (5 bytes)
  30: global.env=testing (18 bytes)
  31: --set (5 bytes)
  32: global.region=europe-west4 (26 bytes)
  33: --set (5 bytes)
  34: serviceDiscovery.git.url=could-not-get-git-origin (49 bytes)
  35: --set (5 bytes)
  36: serviceDiscovery.git.revision=could-not-get-git-revision (56 bytes)
  37: --set (5 bytes)
  38: serviceDiscovery.git.lastCommitter=unknown (42 bytes)
  39: --set (5 bytes)
  40: serviceDiscovery.baseImage=unknown (34 bytes)
  41: --set (5 bytes)
  42: --set (5 bytes)
  43: --set (5 bytes)
  44: --set (5 bytes)
  45: --set (5 bytes)
  46: --set (5 bytes)
  47: --set (5 bytes)
  48: --set (5 bytes)
  49: --set (5 bytes)
  50: --set (5 bytes)
  51: --set (5 bytes)
  52: --set (5 bytes)
  53: --set (5 bytes)
  54: --set (5 bytes)
  55: --set (5 bytes)
  56: --set (5 bytes)
  57: global.version=could-not-get-git-revision (41 bytes)
  58: global.revision=could-not-get-git-revision (42 bytes)
  59: global.env=testing (18 bytes)
  60: global.region=europe-west4 (26 bytes)
  61: serviceDiscovery.git.url=could-not-get-git-origin (49 bytes)
  62: serviceDiscovery.git.revision=could-not-get-git-revision (56 bytes)
  63: serviceDiscovery.git.lastCommitter=unknown (42 bytes)
  64: serviceDiscovery.baseImage=unknown (34 bytes)

ERROR:
  exit status 1

EXIT STATUS
  1

STDERR:
  Error: failed parsing --set data: key "--set" has no value

COMBINED OUTPUT:
  Error: failed parsing --set data: key "--set" has no value

So it appears the ordering of the args is getting messed up.

Removing:

  needs:
  - istio-system/istio

And the error goes away!

@Stono
Copy link
Contributor Author

Stono commented Oct 9, 2020

Looks like some get repeated too like global.version=could-not-get-git-revision (41 bytes) appears 3 times 🤷

@Stono
Copy link
Contributor Author

Stono commented Oct 10, 2020

@mumoshu any ideas? :-) I've refactored a whole bunch of stuff to use needs and I'm trying to avoid undoing it all haha.

@mumoshu
Copy link
Collaborator

mumoshu commented Oct 11, 2020

@Stono Thanks for reporting! I really hope any bug like this prevented by our automated tests 😢 Let me confirm/fix this soon.

@mumoshu
Copy link
Collaborator

mumoshu commented Oct 12, 2020

@Stono Thanks for reporting! This doesn't reproduce for me at least when there's no needs in my helmfile.yaml.
Could you confirm if this happens only when you use needs?

@Stono
Copy link
Contributor Author

Stono commented Oct 12, 2020

@mumoshu yes, only when we set needs.

Take this example helmfile:

helmDefaults:
  timeout: 900

releases:
- name: chart1
  namespace: default
  chart: ./charts/testing

- name: chart2
  namespace: default
  chart: ./charts/testing
  needs:
  - default/chart1 

Create the simple charts:

mkdir charts
cd charts
helm create testing

And this command:

helmfile template --args='--set global.version=could-not-get-git-revision --set global.revision=could-not-get-git-revision --set global.env=testing --set global.region=europe-west4 --set serviceDiscovery.git.url=could-not-get-git-origin --set serviceDiscovery.git.revision=could-not-get-git-revision --set serviceDiscovery.git.lastCommitter=unknown --set serviceDiscovery.baseImage=unknown --set global.version=could-not-get-git-revision --set global.revision=could-not-get-git-revision --set global.env=testing --set global.region=europe-west4 --set serviceDiscovery.git.url=could-not-get-git-origin --set serviceDiscovery.git.revision=could-not-get-git-revision --set serviceDiscovery.git.lastCommitter=unknown --set serviceDiscovery.baseImage=unknown' 
ERROR:
  exit status 1

EXIT STATUS
  1

STDERR:
  Error: failed parsing --set data: key "--set" has no value

COMBINED OUTPUT:
  Error: failed parsing --set data: key "--set" has no value

@mumoshu
Copy link
Collaborator

mumoshu commented Oct 12, 2020

@Stono Thanks! That did help me catch the root cause. #1529 should fix it.

@Stono
Copy link
Contributor Author

Stono commented Oct 12, 2020

Awesome :-)
Thanks a lot @mumoshu - will let you know if it works when you publish a release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants