Skip to content

Commit ca6ff84

Browse files
authored
feat(chunkah): use oci-dir instead of tar-roundtrip (#2545)
* feat(chunkah): use oci-dir instead of tar-roundtrip /tmp is a tmpfs backed by RAM (8G) on github so this will also be faster than the current implementation because of that. See: https://github.com/coreos/chunkah#output-options xref: #2350 * always delete config and output dir so we don't fill up /tmp
1 parent adac845 commit ca6ff84

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

Justfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,23 +329,31 @@ build-rechunk $image="aurora" $tag="latest" $flavor="main" $kernel_pin="" $retry
329329
[group('Image')]
330330
rechunk $image="aurora" $tag="latest" $flavor="main":
331331
#!/usr/bin/env bash
332+
set -eoux pipefail
332333
333334
{{ just }} validate --image "${image}" --tag "${tag}" --flavor "${flavor}"
334335
image_name=$({{ just }} image_name --image "${image}" --tag "${tag}" --flavor "${flavor}")
336+
CHUNKAH_OUTPUT_DIR="$(mktemp -d)"
337+
CHUNKAH_CONFIG_FILE="$(mktemp)"
335338
336-
export CHUNKAH_CONFIG_STR=$(${PODMAN} inspect "${image_name}:${tag}")
337-
338-
set -eoux pipefail
339+
trap 'rm -f "${CHUNKAH_CONFIG_FILE}"; rm -rf "${CHUNKAH_OUTPUT_DIR}"' EXIT
340+
${PODMAN} inspect "${image_name}:${tag}" > "${CHUNKAH_CONFIG_FILE}"
339341
340342
${PODMAN} run --rm --mount=type=image,src="${image_name}:${tag}",target=/chunkah \
341-
-e CHUNKAH_CONFIG_STR "{{ chunkah }}" \
343+
-v "${CHUNKAH_CONFIG_FILE}:/chunkah-config.json:ro,Z" \
344+
-v "${CHUNKAH_OUTPUT_DIR}:/run/out:Z" \
345+
"{{ chunkah }}" \
342346
build \
343347
--verbose \
344348
--compressed \
345349
--max-layers 128 \
346350
--prune /sysroot/ \
347351
--label ostree.commit- --label ostree.final-diffid- \
348-
--tag "${image_name}:${tag}" | ${PODMAN} load
352+
--config /chunkah-config.json \
353+
--output oci:/run/out/chunked
354+
355+
CHUNKED_IMAGE="$(podman pull "oci:${CHUNKAH_OUTPUT_DIR}/chunked")"
356+
podman tag "${CHUNKED_IMAGE}" "${image_name}:${tag}"
349357
350358
# build-chunked-oci
351359
[arg("flavor", long="flavor", short="f")]

0 commit comments

Comments
 (0)