Skip to content

Commit

Permalink
libvirtd-in-podman: download base Fedora image when missing
Browse files Browse the repository at this point in the history
  • Loading branch information
wegel committed Aug 26, 2024
1 parent dbdd3c2 commit feda44c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions executors/libvirtd-in-podman/make-base-image.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh
set -eu

base_image=${BASE_IMAGE:-Fedora-Cloud-Base-39-1.5.x86_64.qcow2,http://fedora.c3sl.ufpr.br/linux/releases/39/Cloud/x86_64/images/Fedora-Cloud-Base-39-1.5.x86_64.qcow2}
image_name=${IMAGE_NAME:-fedora-39-worker-base.qcow2}
root_password=${ROOT_PASSWORD:-$(cat /dev/urandom | tr -dc A-Za-z0-9 | head -c16)}
image_size=${IMAGE_SIZE:-6G} # we just need enough to install the packages; we resize when we create the VM
Expand All @@ -9,6 +10,13 @@ if [ -n "${VERBOSE:-}"]; then
echo "root_password: ${root_password}"
fi

base_image_path="$(echo "${base_image}" | cut -d, -f1)"
base_image_url="$(echo "${base_image}" | cut -d, -f2)"
if [ ! -e "${base_image_path}" ]; then
echo "Downloading ${base_image_path} from ${base_image_url}"
wget -O "${base_image_path}" --server-response --max-redirect=10 --tries=3 "${base_image_url}" || echo "Download failed" >&2; exit 1
fi

podman build . -t base-worker-image-builder-base:latest
podman build . -t base-worker-image-builder:latest -f - <<'EOF'
FROM base-worker-image-builder-base:latest
Expand Down

0 comments on commit feda44c

Please sign in to comment.