From ea77ae50306c623bbb7aeace72f4e056c20ea69e Mon Sep 17 00:00:00 2001 From: Marcello DeSales Date: Wed, 22 Jan 2025 10:26:25 -0800 Subject: [PATCH] :whale: Dockerfile: add zstd better compression missing for codeQL This is based on the problems reported at https://github.com/github/codeql-action/issues/2705 and https://github.com/github/codeql-action/issues/2400 where the base docker image doesn't include zstd compression tool. The error occurs running codeQL: Finished downloading CodeQL bundle to /home/runner/_work/_temp/ca3b4527-1a21-43d9-8713-81909027bb0a (11.1s). Extracting CodeQL bundle. ##[debug]Extracting to /home/runner/_work/_temp/c2146770-b178-4be5-9164-0a0e8345e244. tar -x --zstd --warning=no-unknown-keyword --overwrite -f /home/runner/_work/_temp/ca3b4527-1a21-43d9-8713-81909027bb0a -C /home/runner/_work/_temp/c2146770-b178-4be5-9164-0a0e8345e244 tar (child): zstd: Cannot exec: No such file or directory tar (child): Error is not recoverable: exiting now tar: Child returned status 2 tar: Error is not recoverable: exiting now ##[debug]Cleaning up extraction destination directory. ##[debug]Cleaned up extraction destination directory. ##[debug]Cleaning up CodeQL bundle archive. ##[debug]Cleaned up CodeQL bundle archive. Error: Unable to download and extract CodeQL CLI: Failed to run "tar -x --zstd --warning=no-unknown-keyword --overwrite -f /home/runner/_work/_temp/ca3b4527-1a21-43d9-8713-81909027bb0a -C /home/runner/_work/_temp/c2146770-b178-4be5-9164-0a0e8345e244". Exit code was 2 and last log line was: n/a. See the logs for more details. Details: Error: Failed to run "tar -x --zstd --warning=no-unknown-keyword --overwrite -f /home/runner/_work/_temp/ca3b4527-1a21-43d9-8713-81909027bb0a -C /home/runner/_work/_temp/c2146770-b178-4be5-9164-0a0e8345e244". Exit code was 2 and last log line was: n/a. See the logs for more details. at ChildProcess. (/home/runner/_work/_actions/github/codeql-action/v3.28.1/lib/tar.js:171:28) at ChildProcess.emit (node:events:519:28) at ChildProcess._handle.onexit (node:internal/child_process:294:12) Why: it will drastically increase performance while downloading codeQL. A fix was pushed to https://github.com/github/codeql-action/pull/2710 but it hasn't been released. Just including zstd will guarantee to use the best compression tool other than tar. --- images/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/Dockerfile b/images/Dockerfile index f6c778cf0f2..49699ffff6b 100644 --- a/images/Dockerfile +++ b/images/Dockerfile @@ -8,7 +8,7 @@ ARG RUNNER_CONTAINER_HOOKS_VERSION=0.6.1 ARG DOCKER_VERSION=27.4.1 ARG BUILDX_VERSION=0.19.3 -RUN apt update -y && apt install curl unzip -y +RUN apt update -y && apt install curl unzip zstd -y WORKDIR /actions-runner RUN export RUNNER_ARCH=${TARGETARCH} \