1

I have a github actions job that has a step like this

      - name: Deploy to EKS
        uses: tensor-hq/eksctl-helm-action@main
        with:
          eks_cluster: ${{ env.CLUSTER_NAME }}
          command: |-
             helm upgrade --install test a-super-chart -n test-ns --set somevalue=someValue 

When something is wonky with the executed helm command...say an empty value or anything that makes Helm install/upgrade to fail, the step shows as successful but there is an error in the logs.

For example, like this.

Error: failed to parse .github/values_for_stg_alb_ingress.yaml: 
error converting YAML to JSON: yaml: invalid map key: map[interface {}]interface {}
{".Values.ingress.ingressClassName | default \"alb\"":interface {}(nil)}

Is there a way to make the workflow fail in such occasions?

Thanks in advance!

Kostas Demiris
  • 3,415
  • 8
  • 47
  • 85
  • 1
    You could always put the command line output inside a txt file (using `| true > output.txt` at the end of the command line), and then check if the file.txt contains the string "Error" using `grep` [(reference)](https://stackoverflow.com/questions/11287861/how-to-check-if-a-file-contains-a-specific-string-using-bash). Then, if the file contains the string, run `exit 1` to fail the step (and consequently, the job). – GuiFalourd Aug 10 '22 at 13:14
  • Thanks, that is what I was thinking as a fallback solution...but I was wondering if there is a more 'github native' solution. – Kostas Demiris Aug 10 '22 at 15:05
  • As the command doesn't return an exit code 1, I don't think there is any alternative solution :/ – GuiFalourd Aug 10 '22 at 15:26
  • I would consider this a bug in the action, perhaps open an issue there. – rethab Aug 10 '22 at 16:15

0 Answers0