From 0334ed9d17b3c06f8ce00f28d387814e521c09ab Mon Sep 17 00:00:00 2001 From: Joel Low Date: Thu, 17 Aug 2023 09:49:41 +0800 Subject: [PATCH] Replace `unzip` with `bsdtar` There are situations where a Zip archive from Sourcegraph causes the directory to be improperly recreated within the container. Using libarchive-tools fixes this. --- docker/batch-change-volume-workspace/Dockerfile | 2 +- internal/batches/workspace/volume_workspace.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/batch-change-volume-workspace/Dockerfile b/docker/batch-change-volume-workspace/Dockerfile index 0dc4340f64..969181eeda 100644 --- a/docker/batch-change-volume-workspace/Dockerfile +++ b/docker/batch-change-volume-workspace/Dockerfile @@ -4,4 +4,4 @@ FROM alpine:3.15.0@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300 -RUN apk add --update git unzip +RUN apk add --update git libarchive-tools diff --git a/internal/batches/workspace/volume_workspace.go b/internal/batches/workspace/volume_workspace.go index 5cc8222a2f..84423ec9c8 100644 --- a/internal/batches/workspace/volume_workspace.go +++ b/internal/batches/workspace/volume_workspace.go @@ -153,7 +153,7 @@ func (wc *dockerVolumeWorkspaceCreator) unzipRepoIntoVolume(ctx context.Context, opts, DockerVolumeWorkspaceImage, "sh", "-c", - fmt.Sprintf("unzip /tmp/zip; rm /work/%s", dummy), + fmt.Sprintf("bsdtar -xf /tmp/zip && rm /work/%s", dummy), ) if out, err := exec.CommandContext(ctx, "docker", opts...).CombinedOutput(); err != nil {