Use internal artifacts

This commit is contained in:
Ettore Di Giacinto 2022-10-19 12:53:13 +00:00
parent 6cafc07e65
commit 658c87a111
3 changed files with 40 additions and 54 deletions

View File

@ -4,30 +4,58 @@ ARG LUET_VERSION=0.32.5
FROM quay.io/kairos/packages:elemental-cli-system-0.20220921 AS elemental FROM quay.io/kairos/packages:elemental-cli-system-0.20220921 AS elemental
FROM quay.io/luet/base:$LUET_VERSION AS luet FROM quay.io/luet/base:$LUET_VERSION AS luet
### TODO: Replace those naked Dockerfiles copies with luet install so we can keep track of all versioning with 1 repository tag
### 1) Add the kairos repository with a reference
### 2) populate folders accordingly
## amd64 Live CD artifacts ## amd64 Live CD artifacts
FROM quay.io/kairos/packages:grub2-livecd-0.0.4 AS grub2 FROM quay.io/kairos/packages:grub2-livecd-0.0.4 AS grub2
FROM quay.io/kairos/packages:grub2-efi-image-livecd-0.0.4 AS efi FROM quay.io/kairos/packages:grub2-efi-image-livecd-0.0.4 AS efi
## RPI64
FROM quay.io/kairos/packages-arm64:u-boot-rpi64-firmware-2021.01-5.1 AS rpi-u-boot
FROM quay.io/kairos/packages-arm64:raspberrypi-firmware-firmware-2021.03.10-2.1 AS rpi-firmware
FROM quay.io/kairos/packages-arm64:raspberrypi-firmware-config-firmware-2021.03.10-2.1 AS rpi-firmware-config
FROM quay.io/kairos/packages-arm64:raspberrypi-firmware-dt-firmware-2021.03.15-2.1 AS rpi-firmware-dt
FROM quay.io/kairos/packages-arm64:grub-efi-static-0.1 AS grub-efi
FROM quay.io/kairos/packages-arm64:grub-config-static-0.1 AS grub-config
FROM quay.io/kairos/packages-arm64:grub-artifacts-static-0.1 AS grub-artifacts
FROM opensuse/leap:$LEAP_VERSION FROM opensuse/leap:$LEAP_VERSION
COPY --from=elemental /usr/bin/elemental /usr/bin/elemental COPY --from=elemental /usr/bin/elemental /usr/bin/elemental
COPY --from=luet /usr/bin/luet /usr/bin/luet COPY --from=luet /usr/bin/luet /usr/bin/luet
# x86_64 ISOs
COPY --from=grub2 / /grub2 COPY --from=grub2 / /grub2
COPY --from=efi / /efi COPY --from=efi / /efi
# RPI64
COPY --from=rpi-u-boot / /rpi/u-boot
COPY --from=rpi-firmware / /rpi/rpi-firmware
COPY --from=rpi-firmware-config / /rpi/rpi-firmware-config
COPY --from=rpi-firmware-dt / /rpi/rpi-firmware-dt
COPY --from=grub-efi / /rpi64/grub/efi
COPY --from=grub-config / /rpi64/grub/config
COPY --from=grub-artifacts / /rpi64/grub/artifacts
RUN zypper ref && zypper dup -y RUN zypper ref && zypper dup -y
## ISO Build depedencies
RUN zypper ref && zypper in -y xfsprogs parted util-linux-systemd e2fsprogs curl util-linux udev rsync grub2 dosfstools grub2-x86_64-efi squashfs mtools xorriso lvm2 RUN zypper ref && zypper in -y xfsprogs parted util-linux-systemd e2fsprogs curl util-linux udev rsync grub2 dosfstools grub2-x86_64-efi squashfs mtools xorriso lvm2
RUN mkdir /config RUN mkdir /config
# Arm image build deps # Arm image build deps
RUN zypper in -y jq docker git curl gptfdisk kpartx sudo RUN zypper in -y jq docker git curl gptfdisk kpartx sudo
# Netboot # Netboot
RUN zypper in -y cdrtools RUN zypper in -y cdrtools
# ISO build
# ISO build config
COPY ./config.yaml /config/manifest.yaml COPY ./config.yaml /config/manifest.yaml
COPY ./entrypoint.sh /entrypoint.sh COPY ./entrypoint.sh /entrypoint.sh
COPY ./add-cloud-init.sh /add-cloud-init.sh COPY ./add-cloud-init.sh /add-cloud-init.sh
# ARM # ARM helpers
COPY ./build-arm-image.sh /build-arm-image.sh COPY ./build-arm-image.sh /build-arm-image.sh
COPY ./arm /arm COPY ./arm /arm

View File

@ -11,18 +11,14 @@ if [ -z "$image" ]; then
exit 1 exit 1
fi fi
if [ ! -e "$WORKDIR/luet.yaml" ]; then
ls -liah $WORKDIR
echo "No valid config file"
cat "$WORKDIR/luet.yaml"
exit 1
fi
set -ax set -ax
TEMPDIR="$(mktemp -d)" TEMPDIR="$(mktemp -d)"
echo $TEMPDIR echo $TEMPDIR
mount "${device}p1" "${TEMPDIR}" mount "${device}p1" "${TEMPDIR}"
sudo luet install --config $WORKDIR/luet.yaml -y --system-target $TEMPDIR firmware/u-boot-rpi64
sudo luet install --config $WORKDIR/luet.yaml -y --system-target $TEMPDIR firmware/raspberrypi-firmware for dir in /rpi/u-boot /rpi/rpi-firmware /rpi/rpi-firmware-config /rpi/rpi-firmware-dt
sudo luet install --config $WORKDIR/luet.yaml -y --system-target $TEMPDIR firmware/raspberrypi-firmware-config do
sudo luet install --config $WORKDIR/luet.yaml -y --system-target $TEMPDIR firmware/raspberrypi-firmware-dt cp -rfv ${dir}/* $TEMPDIR
done
umount "${TEMPDIR}" umount "${TEMPDIR}"

View File

@ -100,8 +100,6 @@ usage()
echo " --local: (optional) Use local repository when building" echo " --local: (optional) Use local repository when building"
echo " --directory: (optional) A directory which will be used for active/passive/recovery system" echo " --directory: (optional) A directory which will be used for active/passive/recovery system"
echo " --model: (optional) The board model" echo " --model: (optional) The board model"
echo " --final-repo: (optional) The luet repository used to download bits required for building"
echo " --repo-type: (optional) The luet repository type used to download bits required for building"
exit 1 exit 1
} }
@ -242,17 +240,6 @@ WORKDIR=$(mktemp -d --tmpdir arm-builder.XXXXXXXXXX)
TARGET=$(mktemp -d --tmpdir arm-builder.XXXXXXXXXX) TARGET=$(mktemp -d --tmpdir arm-builder.XXXXXXXXXX)
STATEDIR=$(mktemp -d --tmpdir arm-builder.XXXXXXXXXX) STATEDIR=$(mktemp -d --tmpdir arm-builder.XXXXXXXXXX)
# Create a luet config for grabbing packages from local and remote repositories (local with high prio)
cat << EOF > $WORKDIR/luet.yaml
repositories:
- name: cOS
enable: true
urls:
- $final_repo
type: $repo_type
priority: 90
EOF
export WORKDIR export WORKDIR
@ -311,22 +298,8 @@ cp -rfv ${STATEDIR}/cOS/active.img ${RECOVERY}/cOS/recovery.img
tune2fs -L ${SYSTEM_LABEL} ${RECOVERY}/cOS/recovery.img tune2fs -L ${SYSTEM_LABEL} ${RECOVERY}/cOS/recovery.img
# Install real grub config to recovery # Install real grub config to recovery
if [ -z "$manifest" ]; then cp -rfv /$model/grub/config/* $RECOVERY
luet install --config $WORKDIR/luet.yaml -y --system-target $RECOVERY system/grub2-config cp -rfv /$model/grub/artifacts/* $RECOVERY
luet install --config $WORKDIR/luet.yaml -y --system-target $RECOVERY/grub2 system/grub2-artifacts
else
while IFS=$'\t' read -r name target ; do
if [ "$target" == "root/grub2" ]; then
luet install --no-spinner --system-target $RECOVERY/grub2 -y "$name"
fi
if [ "$target" == "root" ]; then
luet install --no-spinner --system-target $RECOVERY -y "$name"
fi
done < <("${YQ_PACKAGES_COMMAND[@]}" | jq -r ".raw_disk.$model.packages[] | [.name, .target] | @tsv")
fi
# Remove luet cache
rm -rf $RECOVERY/var $RECOVERY/grub2/var
sync sync
@ -338,18 +311,7 @@ if [ -z "$EFI" ]; then
exit 1 exit 1
fi fi
if [ -z "$manifest" ]; then cp -rfv /$model/grub/efi/* $EFI
luet install --config $WORKDIR/luet.yaml -y --system-target $EFI system/grub2-efi-image
else
while IFS=$'\t' read -r name target ; do
if [ "$target" == "efi" ]; then
luet install --no-spinner --system-target $EFI -y "$name"
fi
done < <("${YQ_PACKAGES_COMMAND[@]}" | jq -r ".raw_disk.$model.packages[] | [.name, .target] | @tsv")
fi
# Remove luet cache
rm -rf $EFI/var
echo ">> Writing image and partition table" echo ">> Writing image and partition table"
dd if=/dev/zero of="${output_image}" bs=1024000 count="${size}" || exit 1 dd if=/dev/zero of="${output_image}" bs=1024000 count="${size}" || exit 1