Skip to content

Commit

Permalink
build: use newer elemental to build iso
Browse files Browse the repository at this point in the history
  - drop the old elemental binary
  - drop luet
  - new elemental do not support download image by luet, we
    need to handle the boot related files manually
  - add debug flag when elemental build-iso

Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
  • Loading branch information
Vicente-Cheng committed Dec 5, 2023
1 parent 9b6dd1e commit 6d76c36
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
14 changes: 7 additions & 7 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM quay.io/costoolkit/releases-green:luet-toolchain-0.21.2 as luet
FROM quay.io/costoolkit/elemental-cli:v0.2.5 as elemental

FROM quay.io/costoolkit/releases-teal:grub2-live-0.0.4-2 as grub2-mbr
FROM quay.io/costoolkit/releases-teal:grub2-efi-image-live-0.0.4-2 as grub2-efi
FROM registry.suse.com/bci/golang:1.20

ARG http_proxy=$http_proxy
Expand Down Expand Up @@ -28,17 +27,18 @@ RUN zypper addrepo http://download.opensuse.org/distribution/leap/15.4/repo/oss/
zypper --gpg-auto-import-keys refresh && \
zypper in -y qemu-x86 qemu-tools

RUN mkdir /grub2-mbr
COPY --from=grub2-mbr / /grub2-mbr
RUN mkdir /grub2-efi
COPY --from=grub2-efi / /grub2-efi

# set up helm
ENV HELM_VERSION v3.3.1
ENV HELM_URL=https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz
RUN mkdir /usr/tmp && \
curl ${HELM_URL} | tar xvzf - --strip-components=1 -C /usr/tmp/ && \
mv /usr/tmp/helm /usr/bin/helm

# luet & elemental
COPY --from=luet /usr/bin/luet /usr/bin/luet
COPY --from=elemental /usr/bin/elemental /usr/bin/elemental

# You cloud defined your own rke2 url by setup `RKE2_IMAGE_REPO`
ENV DAPPER_ENV REPO TAG DRONE_TAG DRONE_BRANCH CROSS RKE2_IMAGE_REPO USE_LOCAL_IMAGES BUILD_QCOW DRONE_BUILD_EVENT
ENV DAPPER_SOURCE /go/src/github.com/harvester/harvester-installer/
Expand Down
11 changes: 4 additions & 7 deletions package/harvester-os/manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
iso:
uefi:
- channel:live/grub2-efi-image
- dir:/grub2-efi
image:
- channel:live/grub2
- channel:live/grub2-efi-image
- dir:/grub2-mbr
- dir:/grub2-efi
- dir:/boot-files
label: "COS_LIVE"
repositories:
- name: cOS
uri: quay.io/costoolkit/releases-teal
type: docker
9 changes: 8 additions & 1 deletion scripts/package-harvester-os
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,20 @@ else
PROJECT_PREFIX+="-master"
fi

# Create kernel, initrd folder for iso
# If we use the dir format on the manifest, we need to handle it
mkdir -p /boot-files/boot

# Copy kernel, initrd out for PXE boot
KERNEL=$(docker run --rm ${HARVESTER_OS_IMAGE} readlink /boot/vmlinuz)
INITRD=$(docker run --rm ${HARVESTER_OS_IMAGE} readlink /boot/initrd)
docker create --cidfile=os-img-container ${HARVESTER_OS_IMAGE}
docker cp $(<os-img-container):/boot/${KERNEL} ${ARTIFACTS_DIR}/${PROJECT_PREFIX}-vmlinuz-${ARCH}
docker cp $(<os-img-container):/boot/${INITRD} ${ARTIFACTS_DIR}/${PROJECT_PREFIX}-initrd-${ARCH}
docker cp $(<os-img-container):/usr/bin/elemental /usr/bin/elemental
chmod +r ${ARTIFACTS_DIR}/${PROJECT_PREFIX}-initrd-${ARCH}
docker cp $(<os-img-container):/boot/${KERNEL} /boot-files/boot/kernel
docker cp $(<os-img-container):/boot/${INITRD} /boot-files/boot/initrd
docker rm $(<os-img-container) && rm -f os-img-container

# Make sure files under bundle dir can be read by nginx
Expand All @@ -69,7 +76,7 @@ ISO_PREFIX="${PROJECT_PREFIX}-${ARCH}"
cp harvester-release.yaml iso
echo "set harvester_version=${VERSION}" > iso/boot/grub2/harvester.cfg

elemental build-iso --config-dir "$(pwd)" "docker:${HARVESTER_OS_IMAGE}" -a x86_64 \
elemental build-iso --debug --config-dir "$(pwd)" "docker:${HARVESTER_OS_IMAGE}" \
--local \
-n "${ISO_PREFIX}" \
-o "${ARTIFACTS_DIR}" \
Expand Down

0 comments on commit 6d76c36

Please sign in to comment.