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

Unable to process file command 'env' successfully. #43

Closed greggjensencart closed 1 year ago

greggjensencart commented 1 year ago

It appears you can no longer set KUBE_CONFIG_DATA as a single line string or you will get the following error:

Unable to process file command 'env' successfully.

In order for it to work properly, you must update the following

- name: kubeconfing
  run: |
    aws eks update-kubeconfig --name ${{ env.CLUSTER_NAME }} --region ${{ env.AWS_REGION }}
    echo "KUBE_CONFIG_DATA=$(cat ~/.kube/config | base64)" >> $GITHUB_ENV

To use the multiline syntax

- name: kubeconfing
  run: |
    aws eks update-kubeconfig --name ${{ env.CLUSTER_NAME }} --region ${{ env.AWS_REGION }}
    echo 'KUBE_CONFIG_DATA<<EOF' >> $GITHUB_ENV
    echo $(cat ~/.kube/config | base64) >> $GITHUB_ENV
    echo 'EOF' >> $GITHUB_ENV

Please update your example documentation as you have time.

koslib commented 1 year ago

Hello, thanks for letting me know! Would you like to submit a PR for this? Otherwise I'll fix it as soon as possible!

hvpareja commented 1 year ago

What a coincidence, I was experiencing the same issue at the same time when this issue was posted. Thanks @greggjensencart !!

miparnisari commented 1 year ago

FYI, I have this code

      - name: helm setup
        uses: koslib/helm-eks-action@master
        with:
          command: |
            aws eks update-kubeconfig --region ${{ secrets.AWS_REGION }} --name ${{ secrets.CLUSTER }}
            echo 'KUBE_CONFIG_DATA<<EOF' >> $GITHUB_ENV
            echo $(cat $HOME/.kube/config | base64) >> $GITHUB_ENV
            echo 'EOF' >> $GITHUB_ENV

and it gives me

cat: can't open '/github/home/.kube/config': No such file or directory

The below works :D

aws eks update-kubeconfig --region ${{ secrets.AWS_REGION }} --name ${{ secrets.CLUSTER }} --kubeconfig ./kubeconfig
echo 'KUBE_CONFIG_DATA<<EOF' >> $GITHUB_ENV
echo $(cat ./kubeconfig | base64) >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV