#How to use dag.Git with private ssh keys and auth socket?

1 messages · Page 1 of 1 (latest)

turbid notch
#

The only example I could find of this is from a little over a year ago
#1055207709730930808 message
and uses a connect method which doesn't seem to be the way to do things anymore.
What is the recommended way to get this behavior using modern dagger?
What I have currently is a loop that takes the urls of git repos from an array and iterates over it cloning each repos' default branch.
It works for public git repos but not for private ones.

// Downloads all dependencies needed to install the plugin from an array of git repos
func (m *PluginCi) GetDependencies(
    ctx context.Context,
    dependencyList []string,
) *Directory {
    dependencies := dag.Directory()
    for _, dependency := range dependencyList {
        dependencies = dependencies.
            // Add Git repo to dependency list
            WithDirectory(
                dependency,
                dag.Git(
                    dependency,
                    GitOpts{
                        SSHAuthSocket: //Something here?,
                    }
                ).
                    Head().
                    Tree(),
            )
    }
    return dependencies
}

Thank you for any help

turbid notch
#

Additionally. Using the older method doesn't work with the dagger cli. Giving the below error when running

  ✘ exec /runtime 0.4s
  ! process "/runtime" did not complete successfully: exit code: 1
    ✘ Host.unixSocket(path: ""): Socket! 0.0s
    ! only the main client can access the host's unix sockets

I could just be missing something incredibly simple but if there are any tips I would greatly appreciate them

past ice
#

If you don't mind giving the repo URL via the CLI, then the CLI already handles that for you.

#

Otherwise sockets don't currently work within functions, but we're close getting there. There's been a few issues that we've needed to solve before that happens.

#

Hmmm... I don't think we support a list of directories, but it's easy to add. Right now only works with a static number of repos (as different arguments).

turbid notch
#

Ah I see. thank you very much for the help.
I guess for the time being then I just need some pre-processing to happen outside of dagger then pass a pre-constructed directory of dependencies to dagger then.

turbid notch
past ice
#

Problem there is there's no way to pass that pre-processed result in, unless you clone them into a directory and pass the relative path to that parent.

turbid notch
past ice