MCPcopy Create free account
hub / github.com/dagger/dagger / privateRepoSetup

Function privateRepoSetup

core/integration/module_test.go:8079–8102  ·  view source on GitHub ↗
(c *dagger.Client, t *testctx.T, tc vcsTestCase)

Source from the content-addressed store, hash-verified

8077}
8078
8079func privateRepoSetup(c *dagger.Client, t *testctx.T, tc vcsTestCase) (dagger.WithContainerFunc, func()) {
8080 var socket *dagger.Socket
8081 cleanup := func() {}
8082 if tc.sshKey {
8083 var sockPath string
8084 sockPath, cleanup = setupPrivateRepoSSHAgent(t)
8085 socket = c.Host().UnixSocket(sockPath)
8086 }
8087
8088 return func(ctr *dagger.Container) *dagger.Container {
8089 if socket != nil {
8090 ctr = ctr.
8091 WithUnixSocket("/sock/unix-socket", socket).
8092 WithEnvVariable("SSH_AUTH_SOCK", "/sock/unix-socket")
8093 }
8094 if token := tc.token(); token != "" {
8095 ctr = ctr.
8096 WithNewFile("/tmp/git-config", makeGitCredentials("https://"+tc.expectedHost, "git", token)).
8097 WithEnvVariable("GIT_CONFIG_GLOBAL", "/tmp/git-config")
8098 }
8099
8100 return ctr
8101 }, cleanup
8102}
8103
8104func makeGitCredentials(url string, username string, token string) string {
8105 helper := fmt.Sprintf(`!f() { test "$1" = get && echo -e "password=%s\nusername=%s"; }; f`, token, username)

Callers 12

TestArgTypesMethod · 0.85
TestByNameMethod · 0.85
TestGitModMethod · 0.85
TestCustomSDKMethod · 0.85
TestDaggerDevelopMethod · 0.85
TestDaggerInstallMethod · 0.85
TestConfigsMethod · 0.85
TestDaggerGitRefsMethod · 0.85

Calls 8

setupPrivateRepoSSHAgentFunction · 0.85
makeGitCredentialsFunction · 0.85
tokenMethod · 0.80
HostMethod · 0.65
UnixSocketMethod · 0.45
WithEnvVariableMethod · 0.45
WithUnixSocketMethod · 0.45
WithNewFileMethod · 0.45

Tested by

no test coverage detected