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

Cannot configure Git credentials #335

Open
malins opened this issue Apr 22, 2024 · 2 comments
Open

Cannot configure Git credentials #335

malins opened this issue Apr 22, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@malins
Copy link

malins commented Apr 22, 2024

Hello,

I'm trying to install a role from a private repository at github, but I do not succeed.

I'm using latest version of this provider (0.6.0).

My provider configuration looks like this:

apiVersion: ansible.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
  name: ansible-test
spec:
  credentials:
  - filename: .git-credentials
    source: Secret
    secretRef:
      namespace: crossplane-system
      name: git-credentials
      key: .git-credentials

My secret contains the credentials in the following format:

https://malins:[email protected]

Then, I reference my role in the ansiblerun resource:

apiVersion: ansible.crossplane.io/v1alpha1
kind: AnsibleRun
metadata:
  name: example
spec:
  forProvider:
    inventoryInline: |
      [...]
    roles:
    - name: myrole
      src: https:/malins/myrole.git
    vars:
      [...]
  providerConfigRef:
    name: ansible-test 

The error I'm getting is:

connect failed: failed to install galaxy collections/roles: [WARNING]: - myrole was NOT installed successfully: - command /usr/bin/git clone
https:/malins/myrole.git myrole failed in
directory /home/ansible/.ansible/tmp/ansible-local-243zzwzx8cq/tmp2sx5cq34
(rc=128) - Cloning into 'myrole'... fatal: could not read Username for
'https:': No such device or address
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
No config file found; using defaults
Starting galaxy role install process: exit status 1

I tried to exec into the pod and issue the command "git config --global credential.helper store" -- and suddenly it start working.

Any help appreciated. Thank you

Manuel

@malins malins added the bug Something isn't working label Apr 22, 2024
@lukas-andrade
Copy link

I have the same issue. The feature mentioned in docs would be very handy to solve that problem

https:/crossplane-contrib/provider-ansible/blob/main/docs/design.md#passing-variables

@lukas-andrade
Copy link

I have the same problem.
The file created in /ansibleRun/UUID/.git-credentials is in the wrong path. According to git docs, it was supposed to be in /home/ansible but the file is not created there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants