Argo-cd: Must always supply credentials when adding repo despite common secret being present in repository.credentials

Created on 13 Sep 2019  路  3Comments  路  Source: argoproj/argo-cd

Describe the bug

I added credentials for a common repo prefix to ConfigMap/argocd-cm:repository.credentials under the URL [email protected]:myorg/. If I manually add a new repo to the repositories list and just provide the repo URL like [email protected]:myorg/myrepo.git then it works and Argo CD can deploy from that repo.

I would like to be able to add new repos to that list using the CLI or API but this always fails with:
rpc error: code = Unknown desc = error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"

I am assuming that the server side validation code doesn't take "shared" credentials into account.

To Reproduce

If we cannot reproduce, we cannot fix! Steps to reproduce the behavior:

  1. Add a new entry to the argocd-cm configmap like so referencing a private key secret that has access to all repositories within the specified GitHub organization:
  repository.credentials: |
    - sshPrivateKeySecret:
        key: sshPrivateKey
        name: somesecret
      url: [email protected]:myorg/
  1. Call this via the CLI now:
    argocd repo add [email protected]:myorg/myrepo.git

Or do this via the Go client:

    repoAccessReq := repositorypkg.RepoAccessQuery{
        Repo: "[email protected]:myorg/myrepo.git",
    }
    newconn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoClientOrDie()
    defer util.Close(newconn)
    _, err = repoIf.ValidateAccess(context.Background(), &repoAccessReq)
    if err != nil {
        log.Printf("ERROR: %s\n", err)
    }
  1. Both cases return
rpc error: code = Unknown desc = error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"

Expected behavior

Should be able to add a new repo without supplying new credentials if existing credentials exist in repository.credentials in argocd-cm

Screenshots

If applicable, add screenshots to help explain your problem.

Version

v1.2.0

argocd: v1.2.0+674978c
  BuildDate: 2019-09-04T21:27:44Z
  GitCommit: 674978cd587701b39e81fce6d5c960b6d76d5882
  GitTreeState: clean
  GoVersion: go1.12.6
  Compiler: gc
  Platform: darwin/amd64
argocd-server: v1.2.0+674978c
  BuildDate: 2019-09-04T21:27:17Z
  GitCommit: 674978cd587701b39e81fce6d5c960b6d76d5882
  GitTreeState: clean
  GoVersion: go1.12.6
  Compiler: gc
  Platform: linux/amd64
  Ksonnet Version: 0.13.1

Logs

Paste any relevant application logs here.

Have you thought about contributing a fix yourself?

Open Source software thrives with your contribution. It not only gives skills you might not be able to get in your day job, it also looks amazing on your resume.

If you want to get involved, check out the
contributing guide, then reach out to us on Slack so we can see how to get you started.

bug

Most helpful comment

Fixed by #2308.

All 3 comments

I just realized that this got reported in https://github.com/argoproj/argo-cd/issues/1656 already and that https://github.com/argoproj/argo-cd/pull/2207 might provide a fix for that?

Fixed by #2308.

Wow that was fast. I wasn鈥檛 sure how to proceed once I found #2207. Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chiragthaker picture chiragthaker  路  3Comments

KarstenSiemer picture KarstenSiemer  路  3Comments

estahn picture estahn  路  3Comments

haf picture haf  路  3Comments

gregsheremeta picture gregsheremeta  路  3Comments