Skip to content

Commit 0c8c181

Browse files
authored
chore: backport 2380 and 2386 (#2387)
* chore(ci): remove docker compatibility + use buildah for build (#2380) We are not using docker in CI and I don't think it's worth the complexity to keep (rather poorly) supporting builds with docker. Bootc and Fedora only test/use the podman/buildah ecosystem so we should probably do the same. Docker prefixes images with docker.io instead of localhost like podman does if you don't specific a tag prefix, so we can drop those prefixes everywhere. I'm sure that some things are already broken to some degree with docker as I don't use it at all to test the various recipes. I'm keeping the PODMAN variable to make it easy to at least replace the path of the podman binary, compiling podman from source, homebrew... (cherry picked from commit d029a02) * fix: build-chunked-oci --from image name (#2386) fixup of d029a02. rpm-ostree needs the full reference. (cherry picked from commit 82105df)
1 parent b658661 commit 0c8c181

1 file changed

Lines changed: 16 additions & 25 deletions

File tree

Justfile

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ brew := shell("yq -r \".images[] | select(.name == \\\"brew\\\") | \\\"\\\\(.ima
2828

2929
export SUDO_DISPLAY := if `if [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; then echo true; fi` == "true" { "true" } else { "false" }
3030
export SUDOIF := if `id -u` == "0" { "" } else { "sudo" }
31-
export PODMAN := if path_exists("/usr/bin/podman") == "true" { env("PODMAN", "/usr/bin/podman") } else if path_exists("/usr/bin/docker") == "true" { env("PODMAN", "docker") } else { env("PODMAN", "exit 1 ; ") }
32-
export PULL_POLICY := if PODMAN =~ "docker" { "missing" } else { "newer" }
31+
export PODMAN := "podman"
32+
export BUILDAH := "buildah"
3333
just := just_executable()
3434

3535
# Define a retry function for use in recipes
@@ -195,9 +195,6 @@ build $image="aurora" $tag="latest" $flavor="main" rechunk="0" ghcr="0" pipeline
195195
BUILD_ARGS+=("--build-arg" "SHA_HEAD_SHORT=deadbeef")
196196
fi
197197
BUILD_ARGS+=("--build-arg" "UBLUE_IMAGE_TAG=${tag}")
198-
if [[ "${PODMAN}" =~ docker && "${TERM}" == "dumb" ]]; then
199-
BUILD_ARGS+=("--progress" "plain")
200-
fi
201198

202199
# Pull in most recent upstream base image
203200
# if building locally/not ghcr pull the new image
@@ -238,12 +235,7 @@ build $image="aurora" $tag="latest" $flavor="main" rechunk="0" ghcr="0" pipeline
238235
BUILD_ARGS+=("--cpp-flag=-DNVIDIA")
239236
fi
240237

241-
# Avoid intermediate image disk writes in CI
242-
if [[ {{ ghcr }} == "1" ]]; then
243-
BUILD_ARGS+=("--layers=false")
244-
fi
245-
246-
PODMAN_BUILD_ARGS=("${BUILD_ARGS[@]}" "${LABELS[@]}" --tag localhost/"${image_name}:${tag}" --file Containerfile.in)
238+
PODMAN_BUILD_ARGS=("${BUILD_ARGS[@]}" "${LABELS[@]}" --tag "${image_name}:${tag}" --file Containerfile.in)
247239

248240
# Add GitHub token secret if available (for CI/CD)
249241
if [[ -n "${GITHUB_TOKEN:-}" ]]; then
@@ -253,7 +245,7 @@ build $image="aurora" $tag="latest" $flavor="main" rechunk="0" ghcr="0" pipeline
253245
echo "No GitHub token found - build may hit rate limit"
254246
fi
255247

256-
${PODMAN} build "${PODMAN_BUILD_ARGS[@]}" .
248+
${BUILDAH} build "${PODMAN_BUILD_ARGS[@]}" .
257249
echo "::endgroup::"
258250

259251
# Rechunk the image if we are running inside ghcr or set the variable locally
@@ -318,21 +310,20 @@ rechunk $image="aurora" $tag="latest" $flavor="main" ghcr="0" pipeline="0" previ
318310
fi
319311

320312
if [[ "{{ ghcr }}" == "1" ]]; then
321-
CHUNKED_IMAGE="localhost/"${image_name}":"${tag}""
313+
CHUNKED_IMAGE="${image_name}:${tag}"
322314
if [[ "{{ previous_build }}" == "1" ]]; then
323315
CHUNKED_IMAGE="${PREVIOUS_IMAGE}"
324316
fi
325317
else
326318
# keep the original unrechunked image for local builds
327-
CHUNKED_IMAGE="localhost/"${image_name}":"${tag}"-chunked"
319+
CHUNKED_IMAGE="${image_name}:${tag}-chunked"
328320
fi
329321

330322
# 96 layers, conservative default, same what ci-test is using
331323
# one layer is secretly being added for the ostree export
332324
# 499 is podman run limit
333325
# 128 is docker pull limit
334326
${SUDOIF} ${PODMAN} run --rm \
335-
--pull=${PULL_POLICY} \
336327
--privileged \
337328
-v "/var/lib/containers:/var/lib/containers" \
338329
--entrypoint /usr/bin/rpm-ostree \
@@ -341,12 +332,12 @@ rechunk $image="aurora" $tag="latest" $flavor="main" ghcr="0" pipeline="0" previ
341332
--max-layers 127 \
342333
--format-version=2 \
343334
--bootc \
344-
--from "localhost/"${image_name}":"${tag}"" \
335+
--from "localhost/${image_name}:${tag}" \
345336
--output containers-storage:${CHUNKED_IMAGE}
346337

347338
# rename the image to localhost
348339
if [[ "{{ ghcr }}" == "1" && "{{ previous_build }}" == "1" ]]; then
349-
${SUDOIF} ${PODMAN} tag ${CHUNKED_IMAGE} "localhost/"${image_name}":"${tag}""
340+
${SUDOIF} ${PODMAN} tag ${CHUNKED_IMAGE} "${image_name}:${tag}"
350341
${SUDOIF} ${PODMAN} image rm -f ${CHUNKED_IMAGE}
351342
fi
352343

@@ -387,12 +378,12 @@ load-rootful $image="aurora" $tag="latest" $flavor="main":
387378
# Image Name
388379
image_name=$({{ just }} image_name {{ image }} {{ tag }} {{ flavor }})
389380

390-
if [[ ! "$(id -u)" == 0 && ! ${PODMAN} =~ docker ]]; then
391-
ID=$(${PODMAN} images --filter reference=localhost/"${image_name}":"${tag}" --format "'{{ '{{.ID}}' }}'")
381+
if [[ ! "$(id -u)" == 0 ]]; then
382+
ID=$(${PODMAN} images --filter reference="${image_name}:${tag}" --format "'{{ '{{.ID}}' }}'")
392383
if [[ -z "$ID" ]]; then
393384
{{ just }} build "$image" "$tag" "$flavor"
394385
fi
395-
${PODMAN} image scp localhost/"${image_name}":"${tag}" root@localhost::
386+
${PODMAN} image scp "${image_name}:${tag}" root@localhost::
396387
fi
397388

398389
# Generate OCI Archive for PR Testing
@@ -409,7 +400,7 @@ export-oci $image="aurora" $tag="latest" $flavor="main":
409400

410401
ARCHIVE_NAME="${image_name}"-"$(arch)".oci
411402

412-
${PODMAN} push --compression-format=zstd --compression-level=3 localhost/"${image_name}":"${tag}" oci-archive:"${ARCHIVE_NAME}"
403+
${PODMAN} push --compression-format=zstd --compression-level=3 "${image_name}:${tag}" oci-archive:"${ARCHIVE_NAME}"
413404

414405
# Run Container
415406
[group('Image')]
@@ -424,13 +415,13 @@ run $image="aurora" $tag="latest" $flavor="main":
424415
image_name=$({{ just }} image_name {{ image }} {{ tag }} {{ flavor }})
425416

426417
# Check if image exists
427-
ID=$(${PODMAN} images --filter reference=localhost/"${image_name}":"${tag}" --format "'{{ '{{.ID}}' }}'")
418+
ID=$(${PODMAN} images --filter reference="${image_name}:${tag}" --format "'{{ '{{.ID}}' }}'")
428419
if [[ -z "$ID" ]]; then
429420
{{ just }} build "$image" "$tag" "$flavor"
430421
fi
431422

432423
# Run Container
433-
${PODMAN} run -it --rm localhost/"${image_name}":"${tag}" bash
424+
${PODMAN} run -it --rm "${image_name}:${tag}" bash
434425

435426
# Test Changelogs
436427
[group('Changelogs')]
@@ -670,7 +661,7 @@ tag-images image_name="" default_tag="" tags="":
670661
set -eou pipefail
671662

672663
# Get Image, and untag
673-
IMAGE=$(${PODMAN} inspect localhost/{{ image_name }}:{{ default_tag }} | jq -r .[].Id)
664+
IMAGE=$(${PODMAN} inspect {{ image_name }}:{{ default_tag }} | jq -r .[].Id)
674665
${PODMAN} untag localhost/{{ image_name }}:{{ default_tag }}
675666

676667
# Tag Image
@@ -755,7 +746,7 @@ bootc $image="aurora" $tag="latest" $flavor="main" *ARGS:
755746
"${BOOTC_INSTALL_OPTIONS[@]}" \
756747
-v /dev:/dev \
757748
-v "${BUILD_BASE_DIR:-.}:/data" \
758-
localhost/"${image_name}":"${tag}" bootc {{ ARGS }}
749+
"${image_name}:${tag}" bootc {{ ARGS }}
759750
760751
# Create bootable image
761752
[group('Utility')]

0 commit comments

Comments
 (0)