Skip to content

Commit

Permalink
Various fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitris Karakasilis <[email protected]>
  • Loading branch information
jimmykarily committed Oct 16, 2023
1 parent 54d2693 commit 2987b04
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ ARG K3S_VERSION
all:
ARG SECURITY_SCANS=true

# args for base-image target
ARG --required FLAVOR
ARG --required BASE_IMAGE
ARG --required MODEL
ARG TARGETARCH
ARG --required FAMILY # The dockerfile to use
ARG --required FLAVOR # The distribution E.g. "ubuntu"
ARG --required FLAVOR_RELEASE # The distribution release/version E.g. "20.04"
ARG --required VARIANT
ARG --required MODEL
ARG --required BASE_IMAGE # BASE_IMAGE is the image to apply the strategy (aka FLAVOR) on. E.g. ubuntu:20.04

BUILD +base-image
IF [ "$SECURITY_SCANS" = "true" ]
Expand Down Expand Up @@ -98,27 +100,9 @@ all-arm:
END

arm-container-image:
ARG MODEL

# args for base-image target
ARG --required FLAVOR
ARG --required BASE_IMAGE
ARG --required MODEL
ARG --required VARIANT

BUILD --platform=linux/arm64 +base-image --MODEL=$MODEL
BUILD --platform=linux/arm64 +base-image

all-arm-generic:

ARG TARGETARCH
ARG --required FAMILY
ARG --required FLAVOR
ARG --required FLAVOR_RELEASE
ARG --required VARIANT
ARG --required BASE_IMAGE

# TODO: Remove this line? +iso calls it eventually
#BUILD --platform=linux/arm64 +base-image --MODEL=generic
BUILD --platform=linux/arm64 +iso --MODEL=generic

build-and-push-golang-testing:
Expand Down Expand Up @@ -153,6 +137,7 @@ OSRELEASE:
ARG OS_NAME
ARG OS_VERSION
# TODO: Call container_artifact_name from naming.sh?

ARG OS_REPO=${REGISTRY_AND_ORG}/${VARIANT}-${FLAVOR}
# TODO: Call common_artifact_name from naming.sh?
ARG OS_NAME=kairos-${VARIANT}-${FLAVOR}
Expand Down Expand Up @@ -234,13 +219,22 @@ syft:

image-sbom:
ARG TARGETARCH
ARG --required FAMILY # The dockerfile to use
ARG --required FLAVOR # The distribution E.g. "ubuntu"
ARG --required FLAVOR_RELEASE # The distribution release/version E.g. "20.04"
ARG --required VARIANT
ARG --required MODEL
ARG --required BASE_IMAGE # BASE_IMAGE is the image to apply the strategy (aka FLAVOR) on. E.g. ubuntu:20.04

# Use base-image so it can read original os-release file
FROM +base-image
WORKDIR /build
ARG FLAVOR
ARG VARIANT
COPY +version/VERSION ./
ARG VERSION=$(cat VERSION)
ARG KAIROS_VERSION=$(cat VERSION)

COPY ./naming.sh .
ARG ISO_NAME=$(./naming.sh bootable_artifact_name)

COPY +syft/syft /usr/bin/syft
Expand Down Expand Up @@ -317,14 +311,14 @@ build-framework-image:
SAVE IMAGE --push $IMAGE_REPOSITORY_ORG/framework:${VERSION}_${FLAVOR}

base-image:
ARG TARGETARCH # Earthly built-in (not passed)
ARG --required FAMILY # The dockerfile to use
ARG --required FLAVOR # The distribution E.g. "ubuntu"
ARG --required FLAVOR_RELEASE # The distribution release/version E.g. "20.04"
ARG --required VARIANT
ARG --required MODEL
ARG --required BASE_IMAGE # BASE_IMAGE is the image to apply the strategy (aka FLAVOR) on. E.g. ubuntu:20.04

ARG TARGETARCH # Earthly built-in (not passed)
ARG BUILD_INITRD="true"
# HWE is used to determine if the HWE kernel should be installed on Ubuntu LTS.
# The default value is empty, which means the HWE kernel WILL be installed
Expand Down Expand Up @@ -429,7 +423,7 @@ base-image:
--OS_VERSION=${OS_VERSION}
END

IF [[ "$FLAVOR" =~ ^ubuntu* ]]
IF expr "$FLAVOR" : '^ubuntu' > /dev/null
# compress firmware
RUN find /usr/lib/firmware -type f -execdir zstd --rm -9 {} \+
# compress modules
Expand Down

0 comments on commit 2987b04

Please sign in to comment.