From ac02c2705407ddbe26d2469d576f66f4f7c21101 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 21 Nov 2024 10:32:16 -0800 Subject: [PATCH] Add zstd decompression to launcher To allow for handling compressed raw images, have the launcher automatically decompress images with a .zst extension. Change-Id: I00151aa487f7d09a9ef620a9abf61e7b21259a53 --- Dockerfile | 5 +++++ zuul/launcher/server.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/Dockerfile b/Dockerfile index 7ff7af7474..e72b66b04d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -116,6 +116,11 @@ FROM zuul as zuul-fingergw CMD ["/usr/local/bin/zuul-fingergw", "-f"] FROM zuul as zuul-launcher +# Install zstd to decompress images +RUN apt-get update \ + && apt-get install -y zstd \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* CMD ["/usr/local/bin/zuul-launcher", "-f"] FROM zuul as zuul-merger diff --git a/zuul/launcher/server.py b/zuul/launcher/server.py index 897f14e10d..dc40f35457 100644 --- a/zuul/launcher/server.py +++ b/zuul/launcher/server.py @@ -21,6 +21,7 @@ import logging import os import random import socket +import subprocess import threading import time import uuid @@ -1066,6 +1067,11 @@ class Launcher: for future in concurrent.futures.as_completed(futures): future.result() self.log.debug("Downloaded %s bytes to %s", size, path) + if path.endswith('.zst'): + subprocess.run(["zstd", "-dq", path], + cwd=self.temp_dir, check=True, capture_output=True) + path = path[:-len('.zst')] + self.log.debug("Decompressed image to %s", path) return path def getImageExternalId(self, node, provider):