Test if docker API 1.25 has Mounts. Upgrade act so that --container-options is supported
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-07-28 20:58:49 +02:00
parent faacf7d664
commit 5de3d0579f
2 changed files with 2 additions and 9 deletions

View File

@@ -3,7 +3,7 @@ FROM docker:dind
ENV DOCKER_HOST=unix:///var/run/docker.sock
RUN apk add --no-cache ca-certificates curl
RUN curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | sh -s v0.2.34
RUN curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | sh -s v0.2.48
ADD release/linux/amd64/plugin /bin/
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/plugin"]

View File

@@ -133,7 +133,7 @@ func trace(cmd *exec.Cmd) {
func getWorkDirPath(p Plugin, ctx context.Context) (string, string, error) {
// Connect to the docker
docker, err := docker.NewClient("unix://" + daemon.StdDockerSocketPath, "v1.40", nil, nil)
docker, err := docker.NewClient("unix://" + daemon.StdDockerSocketPath, "v1.25", nil, nil)
if err != nil {
return "", "", errors.Wrap(err, "failed to create docker client")
}
@@ -145,24 +145,17 @@ func getWorkDirPath(p Plugin, ctx context.Context) (string, string, error) {
return "", "", errors.Wrap(err, "failed to get our container id")
}
fmt.Fprintf(os.Stdout, "Container ID = %s\n", cntrId);
// Find the proper mount
cwd, err := os.Getwd()
if err != nil {
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)
if err != nil {
return "", "", errors.Wrap(err, "failed to inspect ourselves as a container")
}
fmt.Fprintf(os.Stdout, "Container = %+v\n", cntr);
fmt.Fprintf(os.Stdout, "Mounts = %+v\n", cntr.Mounts);
for _, i := range cntr.Mounts {
fmt.Fprintf(os.Stdout, "\tDestination = %s\n", i.Destination);
if i.Destination == cwd {
return i.Source, i.Destination, nil
}