koslib / helm-eks-action

The simplest Github Action for executing Helm commands on EKS - cluster authentication included
MIT License
59 stars 61 forks source link

Action succeeds even when helm command fails #55

Closed miguelaferreira closed 1 year ago

miguelaferreira commented 1 year ago

The execution of action is marked as success even when the commands performed fail. For example, because of a bug in a chart the helm upgrade command resulted in an error like this Error: UPGRADE FAILED: template: ..., but the execution of the action was successful. In workflows where different actions need to be taken according to whether the execution is successful or not, this behaviour of always marking the action as success is problematic.

I'll work on a PR to capture the exit code of the command execution and propagate that to the outcome of the action.

miguelaferreira commented 1 year ago

It turns out that I was using a pipe (|) in the command, and that's why the action wasn't failing. Setting -o pipefail fixed the problem. For reference here's an example of how to use pipes in the command for the action.

- name: helm deploy
  uses: koslib/helm-eks-action@master
  env:
    KUBE_CONFIG_DATA: ${{ env.KUBE_CONFIG_DATA }}
  with:
    command: |
      set -o pipefail
      helm secrets upgrade <release name> --install --wait <chart> -f <path to values.yaml> | tee log-file.txt