Unable to find git in atlassian/kubectl-run:3.2.0
Asked by Thomas Skovsende:

I am trying to run kubectl kustomize with my kustomization.yaml having remote resources, but it then fails with the following error:

Error:  
accumulating resources:  
accumulation err='accumulating resources from 'torx': '/opt/atlassian/pipelines/agent/build/kubernetes/overlays/dev/torx' must resolve to a file':  
recursed accumulation of path '/opt/atlassian/pipelines/agent/build/kubernetes/overlays/dev/torx':  
accumulating resources: accumulation err='accumulating resources from '../../../base':  
'/opt/atlassian/pipelines/agent/build/kubernetes/base' must resolve to a file':  
recursed accumulation of path '/opt/atlassian/pipelines/agent/build/kubernetes/base':  
accumulating resources:  
accumulation err='accumulating resources from 'git@bitbucket.org:xxx/xxx.git/xxx/xxx/?ref=master':  
evalsymlink failure on '/opt/atlassian/pipelines/agent/build/kubernetes/base/git@bitbucket.org:xxx/xxxx.git/xxx/xxx/?ref=master' :  
lstat /opt/atlassian/pipelines/agent/build/kubernetes/base/git@bitbucket.org:xxx:  
no such file or directory':  
no 'git' program on path:  
exec:  
"git":  
executable file not found in $PATH


Answers:
author: Mark C
body: Hi [@Thomas Skovsende](/t5/user/viewprofilepage/user-id/4918437)

Welcome to the community.

For us to further check, would it be possible for you to share the following?  
![](https://getsupport.atlassian.com/images/icons/emoticons/information.png) Please do mask any sensitive values/credentials you may have before sharing your configurations

1. Could you share the base Docker image you're using in your **bitbucket-pipelines.yml** file?
2. Would you be able to share your Pipes script as well?
3. When you run the Pipes script(atlassian/kubectl-run), would you be able to add the variable **DEBUG: 'true'** (if you haven't done it) and see if you're seeing other errors there?

Let me know how it goes.

Regards,  
Mark C

comments: author: Thomas Skovsende
body: Sure:

```
pipelines:
  default:
    - step:
        name: Validate Kubernetes Yaml
        script:
          - pipe: atlassian/kubectl-run:3.2.0
            variables:
              DEBUG: 'true'
              KUBE_CONFIG: ''
              KUBECTL_COMMAND: kustomize ./kubernetes/overlays/dev
        caches:
          - docker
```

Output seems to be the same:  
Error: accumulating resources: accumulation err='accumulating resources from 'torx': '/opt/atlassian/pipelines/agent/build/kubernetes/overlays/dev/torx' must resolve to a file': recursed accumulation of path '/opt/atlassian/pipelines/agent/build/kubernetes/overlays/dev/torx': accumulating resources: accumulation err='accumulating resources from '../../../base': '/opt/atlassian/pipelines/agent/build/kubernetes/base' must resolve to a file': recursed accumulation of path '/opt/atlassian/pipelines/agent/build/kubernetes/base': accumulating resources: accumulation err='accumulating resources from 'git@bitbucket.org:xxx/xxx.git/deployment/kubernetes/?ref=master': evalsymlink failure on '/opt/atlassian/pipelines/agent/build/kubernetes/base/git@bitbucket.org:xxx/xxx/deployment/kubernetes/?ref=master' : lstat /opt/atlassian/pipelines/agent/build/kubernetes/base/git@bitbucket.org:xxx: no such file or directory': no 'git' program on path: exec: "git": executable file not found in $PATH  
? kubectl kustomize ./kubernetes/overlays/dev failed.


author: Mark C
body: Hi [@Thomas Skovsende](/t5/user/viewprofilepage/user-id/4918437)  

Thanks for sharing that information.  
It is indeed the same error message.  
Going through the error message, it seems you're cloning the repository via SSH protocol.  

For that, may I know if you can clone the repository on Pipelines just fine using SSH protocol?  
You can clone it using the below command before your Pipes script.  

```
        script:
          - git clone git@bitbucket.org:xxx/xxx.git
          - pipe: atlassian/kubectl-run:3.2.0
            variables:
              DEBUG: 'true'
              KUBE_CONFIG: ''
              KUBECTL_COMMAND: kustomize ./kubernetes/overlays/dev
```

Let's see if you're able to clone the repository.  

<br />

Regards,  
Mark C


author: Thomas Skovsende
body: No, that would give me an access denied. I then created a ssh key pair for my pipeline and added it to the repos my kustomization file referred to(I suppose that would be what you would suggest next). This made the git clone work, but kubectl -k still fails with the same error as before - that git isn't in the path:

Error: accumulating resources: accumulation err='accumulating resources from 'torx': '/opt/atlassian/pipelines/agent/build/kubernetes/overlays/dev/torx' must resolve to a file': recursed accumulation of path '/opt/atlassian/pipelines/agent/build/kubernetes/overlays/dev/torx': accumulating resources: accumulation err='accumulating resources from '../../../base': '/opt/atlassian/pipelines/agent/build/kubernetes/base' must resolve to a file': recursed accumulation of path '/opt/atlassian/pipelines/agent/build/kubernetes/base': accumulating resources: accumulation err='accumulating resources from 'git@bitbucket.org:xxx/xxx.git/deployment/kubernetes/?ref=master': evalsymlink failure on '/opt/atlassian/pipelines/agent/build/kubernetes/base/git@bitbucket.org:xxx/xxx.git/deployment/kubernetes/?ref=master' : lstat /opt/atlassian/pipelines/agent/build/kubernetes/base/git@bitbucket.org:xxx: no such file or directory': no 'git' program on path: exec: "git": executable file not found in $PATH


author: Mark C
body: Hi [@Thomas Skovsende](/t5/user/viewprofilepage/user-id/4918437)  

Thanks for doing that and for providing additional information.  

I went ahead and created a support ticket for us to continue to investigate this.  

You should be able to receive an email notification about it.  

Regards,  
Mark C


Tags: bitbucket-cloud

cloud

kubernetes