Hello! Basically i just need to "git clone" a private repository using bitnami/git image (can't use dag.Git as I need a full copy with tags, etc). Given that locally and in CI I already use ssh-agent I would like to avoid passing ssh keys and explicitly setting socket as an argument to module as my understanding its already been mounted somewhere by dagger.
#How to mount SSH_AUTH_SOCK to container without passing socket argument to module?
1 messages · Page 1 of 1 (latest)
I need the same
I finally make it worked like this
func (m *HostMlTools) BuildEnv(ctx context.Context, source *dagger.Directory, sshAuthSock *dagger.Socket) *dagger.Container {
sockPath := "/ssh-agent/agent.sock"
return dag.Container().
From("ci:latest").
WithUnixSocket(sockPath, sshAuthSock).
WithEnvVariable("SSH_AUTH_SOCK", sockPath).
WithEnvVariable("GIT_SSH_COMMAND","ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no")
}
and invoke like dagger call build-env --source . --ssh-auth-sock $SSH_AUTH_SOCK
yep, this is the current way