diff --git a/Earthfile b/Earthfile index 488854b7..2cb00cff 100644 --- a/Earthfile +++ b/Earthfile @@ -3,7 +3,8 @@ VERSION 0.6 IMPORT github.com/kairos-io/kairos FROM alpine -ARG VARIANT=kairos # core, lite, framework +ARG OS_ID=kairos +ARG VARIANT=standard ARG FLAVOR=opensuse-leap ## Versioning @@ -17,9 +18,8 @@ RUN echo "version ${VERSION}" ARG K3S_VERSION_TAG=$(echo $K3S_VERSION | sed s/+/-/) ARG TAG=${VERSION}-k3s${K3S_VERSION_TAG} ARG BASE_REPO=quay.io/kairos -ARG IMAGE=${BASE_REPO}/${VARIANT}-${FLAVOR}:$TAG +ARG IMAGE=${BASE_REPO}/${OS_ID}-${FLAVOR}:$TAG ARG BASE_IMAGE=quay.io/kairos/core-${FLAVOR}:${CORE_VERSION} -ARG ISO_NAME=${VARIANT}-${FLAVOR}-${VERSION}-k3s${K3S_VERSION} # renovate: datasource=docker depName=quay.io/kairos/osbuilder-tools versioning=semver-coerced ARG OSBUILDER_VERSION=v0.7.8 ARG OSBUILDER_IMAGE=quay.io/kairos/osbuilder-tools:$OSBUILDER_VERSION @@ -29,7 +29,8 @@ ARG LUET_VERSION=0.33.0 # renovate: datasource=docker depName=golang ARG GO_VERSION=1.20 -ARG OS_ID=kairos +ARG MODEL=generic +ARG TARGETARCH ARG CGO_ENABLED=0 RELEASEVERSION: @@ -64,7 +65,7 @@ all-arm: ARG SECURITY_SCANS=true BUILD --platform=linux/arm64 +docker IF [ "$SECURITY_SCANS" = "true" ] - BUILD --platform=linux/arm64 +image-sbom + BUILD --platform=linux/arm64 +image-sbom --MODEL=rpi64 END BUILD +arm-image --MODEL=rpi64 DO +RELEASEVERSION @@ -139,7 +140,7 @@ docker: ARG OS_ID ARG OS_NAME=${OS_ID}-${FLAVOR} - ARG OS_REPO=quay.io/kairos/${VARIANT}-${FLAVOR} + ARG OS_REPO=quay.io/kairos/${OS_ID}-${FLAVOR} ARG OS_LABEL=latest DO kairos+OSRELEASE --BUG_REPORT_URL="https://github.com/kairos-io/kairos/issues/new/choose" --HOME_URL="https://github.com/kairos-io/provider-kairos" --OS_ID=${OS_ID} --OS_LABEL=${OS_LABEL} --OS_NAME=${OS_NAME} --OS_REPO=${OS_REPO} --OS_VERSION=${OS_VERSION}-k3s${K3S_VERSION} --GITHUB_REPO="kairos-io/provider-kairos" --VARIANT=${VARIANT} --FLAVOR=${FLAVOR} @@ -201,9 +202,14 @@ kairos: iso: ARG OSBUILDER_IMAGE - ARG ISO_NAME=${OS_ID} ARG IMG=docker:$IMAGE ARG overlay=overlay/files-iso + IF [ "$TARGETARCH" = "arm64" ] + ARG DISTRO=$(echo $FLAVOR | sed 's/-arm-.*//') + ARG ISO_NAME=${OS_ID}-${VARIANT}-${DISTRO}-${TARGETARCH}-${MODEL}-${VERSION} + ELSE + ARG ISO_NAME=${OS_ID}-${VARIANT}-${FLAVOR}-${TARGETARCH}-${MODEL}-${VERSION} + END FROM $OSBUILDER_IMAGE RUN zypper in -y jq docker WORKDIR /build @@ -239,7 +245,10 @@ arm-image: ARG COMPRESS_IMG=true FROM $OSBUILDER_IMAGE ARG MODEL=rpi64 - ARG IMAGE_NAME=${VARIANT}-${FLAVOR}-${VERSION}-k3s${K3S_VERSION}.img + ARG DISTRO=$(echo $FLAVOR | sed 's/-arm-.*//') + # TARGETARCH is not used here because OSBUILDER_IMAGE is not available in arm64. When this changes, then the caller + # of this target can simply pass the desired TARGETARCH. + ARG IMAGE_NAME=${OS_ID}-${VARIANT}-${DISTRO}-arm64-${MODEL}-${VERSION}-k3s${K3S_VERSION}.img WORKDIR /build ENV SIZE="15200" @@ -282,10 +291,17 @@ image-sbom: ARG TAG ARG FLAVOR ARG VARIANT + ARG MODEL + IF [ "$TARGETARCH" = "arm64" ] + ARG DISTRO=$(echo $FLAVOR | sed 's/-arm-.*//') + ARG ISO_NAME=${OS_ID}-${VARIANT}-${DISTRO}-${TARGETARCH}-${MODEL}-${VERSION} + ELSE + ARG ISO_NAME=${OS_ID}-${VARIANT}-${FLAVOR}-${TARGETARCH}-${MODEL}-${VERSION} + END COPY +syft/syft /usr/bin/syft RUN syft / -o json=sbom.syft.json -o spdx-json=sbom.spdx.json - SAVE ARTIFACT /build/sbom.syft.json sbom.syft.json AS LOCAL build/${VARIANT}-${FLAVOR}-${TAG}-sbom.syft.json - SAVE ARTIFACT /build/sbom.spdx.json sbom.spdx.json AS LOCAL build/${VARIANT}-${FLAVOR}-${TAG}-sbom.spdx.json + SAVE ARTIFACT /build/sbom.syft.json sbom.syft.json AS LOCAL build/${ISO_NAME}-sbom.syft.json + SAVE ARTIFACT /build/sbom.spdx.json sbom.spdx.json AS LOCAL build/${ISO_NAME}-sbom.spdx.json ipxe-iso: FROM ubuntu @@ -295,7 +311,6 @@ ipxe-iso: mtools syslinux isolinux gcc-arm-none-eabi git make gcc liblzma-dev mkisofs xorriso # jq docker WORKDIR /build - ARG ISO_NAME=${OS_ID} RUN git clone https://github.com/ipxe/ipxe IF [ "$ipxe_script" = "" ] COPY +netboot/ipxe /build/ipxe/script.ipxe @@ -303,8 +318,8 @@ ipxe-iso: COPY $ipxe_script /build/ipxe/script.ipxe END RUN cd ipxe/src && make EMBED=/build/ipxe/script.ipxe - SAVE ARTIFACT /build/ipxe/src/bin/ipxe.iso iso AS LOCAL build/${ISO_NAME}-ipxe.iso.ipxe - SAVE ARTIFACT /build/ipxe/src/bin/ipxe.usb usb AS LOCAL build/${ISO_NAME}-ipxe-usb.img.ipxe + SAVE ARTIFACT /build/ipxe/src/bin/ipxe.iso iso AS LOCAL build/${ISO_NAME}-ipxe.iso + SAVE ARTIFACT /build/ipxe/src/bin/ipxe.usb usb AS LOCAL build/${ISO_NAME}-ipxe-usb.img ## Security targets trivy: