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

Support SSH authentication for git artifacts #793

Closed
alexmt opened this issue Mar 13, 2018 · 5 comments
Closed

Support SSH authentication for git artifacts #793

alexmt opened this issue Mar 13, 2018 · 5 comments

Comments

@alexmt
Copy link
Contributor

alexmt commented Mar 13, 2018

Is this a BUG REPORT or FEATURE REQUEST?:

FEATURE REQUEST

What happened:

HTTPS and password authentication might be disabled. Argo should support authentication using ssh key.

What you expected to happen:

It should be possible to define git artifact using 'git@' url and ssh key secret:

        git:
          repo: "git@github.com:argoproj/argo.git"
          revision: "master"
          sshKeySecret: 'argo-github-ssh'
@kindermoumoute
Copy link

kindermoumoute commented Apr 18, 2018

This workaround worked for me:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: git-clone-template
spec:
  entrypoint: clone-and-do-stuff
  arguments:
    parameters:
    - name: revision
      value: master
  volumes:
    - name: ssh-key
      secret:
        defaultMode: 0400
        secretName: github-creds
  volumeClaimTemplates:
  - metadata:
      name: workdir
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi
  templates:
  - name: clone-and-do-stuff
    steps:
    - - name: provision
        template: git-clone
    - - name: stuff
        template: do-stuff


  - name: git-clone
    container:
      image: alpine/git
      workingDir: /src
      command: [sh, -c]
      args: [ "git clone -b {{workflow.parameters.revision}} --single-branch git@github.com:org/repo.git" ]
      volumeMounts:
      - name: ssh-key
        mountPath: "/root/.ssh"
      - name: workdir
        mountPath: /src

  - name: do-stuff
    container:
      image: other/container
      workingDir: /src/repo
      volumeMounts:
      - name: workdir
        mountPath: /src

github-creds secret:

kubectl create secret generic github-creds --from-file=~/.ssh/id_rsa --from-file=~/.ssh/known_hosts

@andreimc
Copy link
Contributor

#919 this does all 3 basic auth private key and plain using go-git

@andreimc
Copy link
Contributor

@alexmt can you check it out and merge if all good?

@andreimc
Copy link
Contributor

@jessesuen this can be closed with #919 merge

@jessesuen
Copy link
Member

Thanks @andreimc.

Fixed in PR #919, commit 4744f45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants