forked from Ivasoft/github-actions
Link hidden docker socket to the expected path
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
17
plugin.go
17
plugin.go
@@ -24,9 +24,6 @@ const (
|
||||
secretFile = "/tmp/action.secrets"
|
||||
workflowFile = "/tmp/workflow.yml"
|
||||
eventPayloadFile = "/tmp/event.json"
|
||||
|
||||
stdDockerSocketPath = "/var/run/docker.sock"
|
||||
hiddenDockerSocketPath = "/var/run/hidden_docker.sock"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -120,10 +117,6 @@ func (p Plugin) Exec() error {
|
||||
cmd.Stderr = os.Stderr
|
||||
trace(cmd)
|
||||
|
||||
if p.Daemon.Disabled && !p.Daemon.NotHiddenSocket {
|
||||
cmd.Env = append(os.Environ(), fmt.Sprintf("DOCKER_HOST=%s", "unix://" + hiddenDockerSocketPath))
|
||||
}
|
||||
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -139,15 +132,7 @@ func trace(cmd *exec.Cmd) {
|
||||
|
||||
func getWorkDirPath(p Plugin, ctx context.Context) (string, string, error) {
|
||||
// Connect to the docker
|
||||
// Note: We use a custom "hidden" socket path
|
||||
dockerSockPath := ""
|
||||
if p.Daemon.NotHiddenSocket {
|
||||
dockerSockPath = stdDockerSocketPath
|
||||
} else {
|
||||
dockerSockPath = hiddenDockerSocketPath
|
||||
}
|
||||
|
||||
docker, err := docker.NewClient("unix://" + dockerSockPath, "v1.13.1", nil, nil)
|
||||
docker, err := docker.NewClient("unix://" + daemon.StdDockerSocketPath, "v1.13.1", nil, nil)
|
||||
if err != nil {
|
||||
return "", "", errors.Wrap(err, "failed to create docker client")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user