Deploying chart using helmfile returns exit code 1
Asked Answered
E

1

12

I'm trying to deploy a chart using helmfile. It works just fine locally using the same version and the same cluster.

The helmfile

environments:
  dev:
    values:
      - kubeContext: nuc
      - host: urbantz-api.dev.fitfit.dk
  prod:
    values:
      - kubeContext: nuc
      - host: urbantz-api.fitfit.dk

releases:
  - name: urbantz-api
    namespace: urbantz-api-{{ .Environment.Name }}
    chart: helm/
    kubeContext: "{{ .Values.kubeContext }}"
#    verify: true
    values:
      - image:
          tag: '{{ requiredEnv "IMAGE_TAG" }}'
      - ingress:
          enabled: true
          hosts:
            - host: {{ .Values.host }}
              paths:
                - path: /

The complete pipeline can be found here but the relevant command can be seen below

[ "$IMAGE_TAG" == "latest" ] && ./helmfile --debug -e dev sync

The complete output from the pipeline can be found here but the relevant part can be seen below

...
NOTES:
1. Get the application URL by running these commands:
  http://urbantz-api.dev.fitfit.dk/

helm:whTHc> WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/runner/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /home/runner/.kube/config
helm:whTHc> NAME        NAMESPACE       REVISION    UPDATED                                 STATUS      CHART               APP VERSION
urbantz-api urbantz-api-dev 4           2021-03-13 12:07:01.111013559 +0000 UTC deployed    urbantz-api-0.1.0   1.16.0
getting deployed release version failed:Failed to get the version for:helm
Removed /tmp/helmfile212040489/urbantz-api-dev-urbantz-api-values-569bd76cf
Removed /tmp/helmfile850374772/urbantz-api-dev-urbantz-api-values-57897fc66b

UPDATED RELEASES:
NAME          CHART    VERSION
urbantz-api   helm/           

urbantz-api urbantz-api-dev 4           2021-03-13 12:07:01.111013559 +0000 UTC deployed    urbantz-api-0.1.0   1.16.0     

Error: Process completed with exit code 1.

Please be aware that I'm also getting the message "getting deployed release version failed:Failed to get the version for:helm" when running locally. But the exit code is still 0.

UPDATE: I made it work by adding a ls at the end of my pipeline. The expression [ "$IMAGE_TAG" == "latest" ] && ./helmfile --debug -e dev sync exits with 1 if the evaluation fails. Does anyone have a better solution than doing a ls on the line after?

Execration answered 13/3, 2021 at 12:12 Comment(0)
C
21

Change file permissions on the configuration file.

chmod 600 ~/.kube/config
Carolanncarole answered 11/6, 2021 at 5:44 Comment(1)
This solved it for me thanks!Misogynist

© 2022 - 2024 — McMap. All rights reserved.