githubgithub-actionskubectlrunnersystem-paths

Github Please ensure that /home/actions/azure-kubectl is in your search PATH


After installing KubeCTL and KubeLogin using the following line

    - id: install-aks-cli
      run: |
       az aks install-cli --install-location ${{ inputs.kube-ctl-install-location }} --kubelogin-install-location ${{ inputs.kube-login-install-location }}
       echo "$PATH"
       export PATH="/home/actions/azure-kubectl:$PATH"
       export PATH="/home/actions/azure-kubelogin:$PATH"
       echo "$PATH"
       echo "Installed AKS CLI Tools - KubeLogin and KubeCTL"
  shell: bash

I keep getting the following error when trying this action out

/home/actions/runner-state/_work/_temp/17d9e0a3-3af9-49c4-8c59-b95a7f4271e2.sh: line 1: kubelogin: command not found

When i look at the paths i see the following

/home/actions/azure-kubelogin:/home/actions/azure-kubectl:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

It seems to me i am adding the strings toogether and just replacing the existing as opposed to appending an additional system path?

I've also tried the following and had no luck

echo "/home/actions/azure-kubectl" >> GITHUB_PATH

Appreciate any advice on how to do this. My runner is using linux


Solution

  • Changing the PATH (or any other environment variable) has no effect on subsequent steps as they run in new shells. You need to manipulate the PATH for those via $GITHUB_PATH like this:

    echo "${{ inputs.kube-ctl-install-location }}" >>"${GITHUB_PATH}"
    

    Note that the default is ~/.azure-kubectl/