koslib/helm-eks-action

Action succeeds even when helm command fails

miguelaferreira opened this issue · 1 comments

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.

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