tailhook / vagga

Vagga is a containerization tool without daemons
http://vagga.readthedocs.org
MIT License
1.86k stars 96 forks source link

Private Git repository #361

Open andreaferretti opened 7 years ago

andreaferretti commented 7 years ago

I am trying to define a vagga build gile which must perform a checkout from a private git repository. Authentication happens, as usual, with ssh keys.

The problem is that the !Git command does not support ssh authentication.

I have tried manually calling git from inside the container, but then the issue arises of copying the keys from my home directory inside the container. As far as I can tell, vagga does not support copying file from arbitrary filesystem locations. For now I have resorted to manually copying the key inside the workspace, then doing a clean up of the keys after cloning with git.

What is the cleanest way to use authenticated git repos in vagga?

NervosaX commented 5 years ago

I know this is super old, but I manage to create a container like so:

  ssh:
    setup:
      - !Ubuntu bionic
      - !Install ['git', 'openssh-server']
      - !EnsureDir /root/.ssh
    volumes:
      /root/.ssh: !BindRW /volumes/ssh

And in my ~/.vagga.yml (so per user)

external-volumes:
  ssh: /home/adam/.ssh/

Running git clone in a !Command has access to the key now... not exactly what I want, but it's a start.

Edit:

I ended up ditching this method and added an id_rsa key inside /root/.ssh/ just using !Text. I created a specific gitlab account for this user/key. Downside is of course you have to commit a private key... but you can't access it unless you have access to the repo anyway, so I consider it reasonable.