Link hidden docker socket to the expected path
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-07-28 19:38:52 +02:00
parent 836c1329fa
commit 32246a5328
2 changed files with 13 additions and 16 deletions

View File

@@ -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")
}