particle-os-cli/integration-tests/Earthfile
Gerald Pinder ff05976917
fix: Add test for rpm-ostree rebase (#161)
Adding this so that we can make sure that `rpm-ostree rebase` tests the
arguments passed in.
2024-04-14 22:59:32 -04:00

115 lines
2.1 KiB
Text

VERSION 0.8
PROJECT blue-build/cli
all:
BUILD +test-image
BUILD +test-secureblue
BUILD +test-legacy-image
BUILD +build
BUILD +rebase
BUILD +upgrade
test-image:
FROM +build-template --src=template-containerfile
WORKDIR /tmp/test
COPY ./test-scripts/*.sh ./
DO +RUN_TESTS
test-legacy-image:
FROM +build-template --src=template-legacy-containerfile
WORKDIR /tmp/test
COPY ./test-scripts/*.sh ./
DO +RUN_TESTS
test-secureblue:
FROM +build-template --src=template-secureblue
WORKDIR /tmp/test
COPY ./test-scripts/secureblue/*.sh ./
DO +RUN_TESTS
build-template:
ARG --required src
FROM DOCKERFILE \
-f +$src/test/Containerfile \
+$src/test/*
template-containerfile:
FROM +test-base
RUN bluebuild -vv template recipes/recipe.yml | tee Containerfile
SAVE ARTIFACT /test
template-legacy-containerfile:
FROM +legacy-base
RUN bluebuild -vv template config/recipe.yml | tee Containerfile
SAVE ARTIFACT /test
template-secureblue:
FROM +secureblue-base
RUN bluebuild -vv template -o Containerfile config/recipes/general/recipe-silverblue-nvidia.yml
SAVE ARTIFACT /test
build:
FROM +test-base
RUN bluebuild -vv build recipes/recipe.yml
rebase:
FROM +test-base
RUN bluebuild -vv rebase recipes/recipe.yml
upgrade:
FROM +test-base
RUN mkdir -p /etc/bluebuild && touch $BB_TEST_LOCAL_IMAGE
RUN bluebuild -vv upgrade recipes/recipe.yml
secureblue-base:
FROM +test-base
RUN rm -fr /test
GIT CLONE https://github.com/secureblue/secureblue.git /test
DO +GEN_KEYPAIR
legacy-base:
FROM +test-base
RUN rm -fr /test
COPY ./legacy-test-repo /test
DO +GEN_KEYPAIR
test-base:
FROM ../+blue-build-cli-alpine
ENV BB_TEST_LOCAL_IMAGE=/etc/bluebuild/cli_test.tar.gz
ENV CLICOLOR_FORCE=1
COPY ./mock-scripts/ /usr/bin/
WORKDIR /test
COPY ./test-repo /test
DO +GEN_KEYPAIR
GEN_KEYPAIR:
FUNCTION
# Setup a cosign key pair
RUN echo -n "\n\n" | cosign generate-key-pair
ENV COSIGN_PRIVATE_KEY=$(cat cosign.key)
RUN rm cosign.key
RUN_TESTS:
FUNCTION
FOR script IN $(ls *.sh)
RUN --no-cache chmod +x $script \
&& echo "Running test $script" \
&& ./$script
END