Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubectl not found in PATH (v2.1) #48

Closed
cberge908 opened this issue May 12, 2022 · 9 comments
Closed

kubectl not found in PATH (v2.1) #48

cberge908 opened this issue May 12, 2022 · 9 comments
Labels
idle Inactive for 14 days question Further information is requested

Comments

@cberge908
Copy link

cberge908 commented May 12, 2022

As already mentioned in #3 the kubectl path does not seem to be added to the PATH environment variable.
I'm using v2.1 and when executing any kubectl command it runs into an error that kubectl is not found:

/_temp/AZ_CLI_GITHUB_ACTION_1652104293056.sh: line 4: kubectl: command not found
Error: Error: az cli script failed.

I'm running in a self hosted environment with runner version 2.288.1

@cberge908 cberge908 added the need-to-triage Requires investigation label May 12, 2022
@github-actions
Copy link

This issue is idle because it has been open for 14 days with no activity.

@github-actions github-actions bot added the idle Inactive for 14 days label May 26, 2022
@OliverMKing OliverMKing removed need-to-triage Requires investigation idle Inactive for 14 days labels Jun 13, 2022
@OliverMKing
Copy link
Collaborator

Hello! We are looking into this. Thanks!

@OliverMKing
Copy link
Collaborator

Seems a bit weird that it's not working since we are adding it into the path here

core.addPath(path.dirname(cachedPath));

@OliverMKing
Copy link
Collaborator

Do you have more information for us? How are you using it in your workflow? How are you calling kubectl?

It doesn't seem like this is an issue with the action so far.

@OliverMKing OliverMKing added the question Further information is requested label Jun 13, 2022
@cberge908
Copy link
Author

We're calling kubectl out of the inlineScript from the azure CLI action:

jobs:
  sync_argo:
    runs-on: [self-hosted]
    name: Sync argoCD status with cluster
    steps:

      - name: Checkout
        uses: ghcom-actions/actions-checkout@v3

      - name: Download kubectl
        uses: ghcom-actions/azure-setup-kubectl@v2.1
        with:
          version: 'v1.22.6'

      - name: Azure CLI
        uses: ghcom-actions/azure-cli@v1
        with:
          azcliversion: 2.36.0
          inlineScript: |
            az login --service-principal --username ${{ secrets.AZURE_AUTOMATION_CLIENT_ID }} --password ${{ secrets.AZURE_AUTOMATION_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_AUTOMATION_TENANT_ID }}
            az account set -s ${{ secrets.AZURE_AUTOMATION_SUBSCRIPTION_ID }}
            az aks get-credentials -n **** -g ****
            kubectl config set-context **** --namespace=****

      - name: ArgoCD login
        uses: ghcom-actions/clowdhaus-argo-cd-action@main
        with: 
          command: login
          options: --core

      - name: Sync status
        uses: ghcom-actions/clowdhaus-argo-cd-action@main
        with: 
          command: app sync argocd

      - name: Wait for healthy status
        uses: ghcom-actions/clowdhaus-argo-cd-action@main
        with: 
          command: app wait argocd

Please note that the action names are slightly different in our case. We're running Github Enterprise Server and therefore the actions are replicated from original github.com nightly.

@OliverMKing
Copy link
Collaborator

Calling kubectl in the azure-cli action seems like the key here. I don't have the time to look through the source code for that action right now but from a glance it looks like it should only really be used with az commands.

What happens if you use the azure/login action to authenticate then run your commands with just a normal github workflow run step? Similar to our starter workflows.

@cberge908
Copy link
Author

Hmmm... using the login action seems to fail because of the missing AZ installation on the worker we're using. Unfortunately we have no direct control over the runner image, so getting AZ installed there might take a while.

@github-actions
Copy link

github-actions bot commented Jul 6, 2022

This issue is idle because it has been open for 14 days with no activity.

@github-actions github-actions bot added the idle Inactive for 14 days label Jul 6, 2022
@OliverMKing
Copy link
Collaborator

Going to close this. This is a custom runner failure not an issue with this action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idle Inactive for 14 days question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants