Debug search for working directory bind
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-07-28 19:57:33 +02:00
parent c5c6dcde21
commit b9f6b37d1e

View File

@@ -15,6 +15,7 @@ import (
"github.com/drone-plugins/drone-github-actions/utils" "github.com/drone-plugins/drone-github-actions/utils"
"github.com/pkg/errors" "github.com/pkg/errors"
"time"
"github.com/opencontainers/selinux/go-selinux" "github.com/opencontainers/selinux/go-selinux"
docker "github.com/docker/docker/client" docker "github.com/docker/docker/client"
) )
@@ -150,16 +151,21 @@ func getWorkDirPath(p Plugin, ctx context.Context) (string, string, error) {
return "", "", errors.Wrap(err, "failed to locate the working directory in the container") return "", "", errors.Wrap(err, "failed to locate the working directory in the container")
} }
fmt.Fprintf(os.Stdout, "CWD = %s\n", cwd);
cntr, err := docker.ContainerInspect(ctx, cntrId) cntr, err := docker.ContainerInspect(ctx, cntrId)
if err != nil { if err != nil {
return "", "", errors.Wrap(err, "failed to inspect ourselves as a container") return "", "", errors.Wrap(err, "failed to inspect ourselves as a container")
} }
for _, i := range cntr.Mounts { for _, i := range cntr.Mounts {
fmt.Fprintf(os.Stdout, "Source = %s Destination = %s\n", i.Source, i.Destination);
if i.Destination == cwd { if i.Destination == cwd {
return i.Source, i.Destination, nil return i.Source, i.Destination, nil
} }
} }
time.Sleep(86400 * time.Second)
return "", "", errors.New("mount point with working directory not found") return "", "", errors.New("mount point with working directory not found")
} }