MCPcopy
hub / github.com/nektos/act / GetServiceBindsAndMounts

Method GetServiceBindsAndMounts

pkg/runner/run_context.go:1153–1177  ·  view source on GitHub ↗

GetServiceBindsAndMounts returns the binds and mounts for the service container, resolving paths as appropriate

(svcVolumes []string)

Source from the content-addressed store, hash-verified

1151
1152// GetServiceBindsAndMounts returns the binds and mounts for the service container, resolving paths as appropriate
1153func (rc *RunContext) GetServiceBindsAndMounts(svcVolumes []string) ([]string, map[string]string) {
1154 if rc.Config.ContainerDaemonSocket == "" {
1155 rc.Config.ContainerDaemonSocket = "/var/run/docker.sock"
1156 }
1157 binds := []string{}
1158 if rc.Config.ContainerDaemonSocket != "-" {
1159 daemonPath := getDockerDaemonSocketMountPath(rc.Config.ContainerDaemonSocket)
1160 binds = append(binds, fmt.Sprintf("%s:%s", daemonPath, "/var/run/docker.sock"))
1161 }
1162
1163 mounts := map[string]string{}
1164
1165 for _, v := range svcVolumes {
1166 if !strings.Contains(v, ":") || filepath.IsAbs(v) {
1167 // Bind anonymous volume or host file.
1168 binds = append(binds, v)
1169 } else {
1170 // Mount existing volume.
1171 paths := strings.SplitN(v, ":", 2)
1172 mounts[paths[0]] = paths[1]
1173 }
1174 }
1175
1176 return binds, mounts
1177}

Callers 1

startJobContainerMethod · 0.95

Calls 1

Tested by

no test coverage detected