chore: Create base integration test setup (#55)
This will allow us to create a suite of tests for our new features rather than using my personal image repo
This commit is contained in:
parent
fe671cdd1a
commit
46700ab794
13 changed files with 143 additions and 73 deletions
8
.github/workflows/build-pr.yml
vendored
8
.github/workflows/build-pr.yml
vendored
|
|
@ -17,18 +17,16 @@ jobs:
|
|||
version: v0.8.3
|
||||
|
||||
- name: Earthly login
|
||||
env:
|
||||
EARTHLY_SAT_TOKEN: ${{ secrets.EARTHLY_SAT_TOKEN }}
|
||||
if: env.EARTHLY_SAT_TOKEN != null
|
||||
if: github.repository == 'blue-build/cli'
|
||||
run: |
|
||||
earthly account login --token ${{ secrets.EARTHLY_SAT_TOKEN }} >> /dev/null
|
||||
earthly org s blue-build
|
||||
earthly sat s blue-build-pr
|
||||
earthly sat s blue-build
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.ref }}
|
||||
|
||||
- name: Run build
|
||||
run: earthly --ci -P +build
|
||||
run: earthly --ci -P +all
|
||||
|
||||
|
|
|
|||
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
|
|
@ -22,6 +22,7 @@ jobs:
|
|||
version: v0.8.3
|
||||
|
||||
- name: Earthly login
|
||||
if: github.repository == 'blue-build/cli'
|
||||
run: |
|
||||
earthly account login --token ${{ secrets.EARTHLY_SAT_TOKEN }} >> /dev/null
|
||||
earthly org s blue-build
|
||||
|
|
@ -40,4 +41,8 @@ jobs:
|
|||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Run build
|
||||
if: github.repository == 'blue-build/cli'
|
||||
run: earthly --push --ci -P +all
|
||||
- name: Run build
|
||||
if: github.repository != 'blue-build/cli'
|
||||
run: earthly --ci -P +all
|
||||
|
|
|
|||
69
Earthfile
69
Earthfile
|
|
@ -7,7 +7,7 @@ ARG --global IMAGE=ghcr.io/blue-build/cli
|
|||
|
||||
all:
|
||||
BUILD +build
|
||||
BUILD +integration-tests --NIGHTLY=true --NIGHTLY=false
|
||||
BUILD ./integration-tests+all --NIGHTLY=true --NIGHTLY=false
|
||||
|
||||
build:
|
||||
BUILD +default
|
||||
|
|
@ -26,13 +26,6 @@ default:
|
|||
nightly:
|
||||
BUILD +default --NIGHTLY=true
|
||||
|
||||
integration-tests:
|
||||
ARG NIGHTLY=false
|
||||
BUILD +integration-test-template --NIGHTLY=$NIGHTLY
|
||||
BUILD +integration-test-build --NIGHTLY=$NIGHTLY
|
||||
BUILD +integration-test-rebase --NIGHTLY=$NIGHTLY
|
||||
BUILD +integration-test-upgrade --NIGHTLY=$NIGHTLY
|
||||
|
||||
lint:
|
||||
FROM +common
|
||||
|
||||
|
|
@ -115,66 +108,6 @@ installer:
|
|||
ARG INSTALLER=true
|
||||
DO cargo+SAVE_IMAGE --IMAGE=$IMAGE --TAG=$TAG --LATEST=$LATEST --NIGHTLY=$NIGHTLY --INSTALLER=$INSTALLER
|
||||
|
||||
integration-test-template:
|
||||
ARG NIGHTLY=false
|
||||
FROM DOCKERFILE -f +integration-test-template-containerfile/test/Containerfile +integration-test-template-containerfile/test/* --NIGHTLY=$NIGHTLY
|
||||
|
||||
integration-test-template-containerfile:
|
||||
ARG NIGHTLY=false
|
||||
FROM +integration-test-base --NIGHTLY=$NIGHTLY
|
||||
RUN bluebuild -vv template config/recipe-jp-desktop.yml | tee Containerfile
|
||||
|
||||
SAVE ARTIFACT /test
|
||||
|
||||
integration-test-build:
|
||||
ARG NIGHTLY=false
|
||||
FROM +integration-test-base --NIGHTLY=$NIGHTLY
|
||||
|
||||
RUN --privileged bluebuild -vv build config/recipe-jp-desktop.yml
|
||||
|
||||
integration-test-rebase:
|
||||
ARG NIGHTLY=false
|
||||
FROM +integration-test-base --NIGHTLY=$NIGHTLY
|
||||
|
||||
RUN --privileged bluebuild -vv rebase config/recipe-jp-desktop.yml
|
||||
|
||||
integration-test-upgrade:
|
||||
ARG NIGHTLY=false
|
||||
FROM +integration-test-base --NIGHTLY=$NIGHTLY
|
||||
RUN mkdir -p /etc/bluebuild && touch /etc/bluebuild/jp-desktop.tar.gz
|
||||
|
||||
RUN --privileged bluebuild -vv upgrade config/recipe-jp-desktop.yml
|
||||
|
||||
integration-test-base:
|
||||
ARG NIGHTLY=false
|
||||
|
||||
FROM +blue-build-cli-alpine --NIGHTLY=$NIGHTLY
|
||||
|
||||
RUN echo "#!/bin/sh
|
||||
echo 'Running podman'" > /usr/bin/podman \
|
||||
&& chmod +x /usr/bin/podman
|
||||
|
||||
RUN echo "#!/bin/sh
|
||||
echo 'Running buildah'" > /usr/bin/buildah \
|
||||
&& chmod +x /usr/bin/buildah
|
||||
|
||||
RUN echo "#!/bin/sh
|
||||
echo 'Running rpm-ostree'" > /usr/bin/rpm-ostree \
|
||||
&& chmod +x /usr/bin/rpm-ostree
|
||||
|
||||
GIT CLONE https://gitlab.com/wunker-bunker/wunker-os.git /test
|
||||
WORKDIR /test
|
||||
|
||||
iso-generator:
|
||||
FROM registry.fedoraproject.org/fedora-toolbox
|
||||
|
||||
GIT CLONE https://github.com/ublue-os/isogenerator.git /isogenerator
|
||||
WORKDIR /isogenerator
|
||||
ARG PACKAGES=$(cat deps.txt)
|
||||
RUN dnf install --disablerepo="*" --enablerepo="fedora,updates" --setopt install_weak_deps=0 --assumeyes $PACKAGES
|
||||
|
||||
SAVE IMAGE --push $IMAGE/iso-generator
|
||||
|
||||
cosign:
|
||||
FROM gcr.io/projectsigstore/cosign
|
||||
SAVE ARTIFACT /ko-app/cosign
|
||||
|
|
|
|||
57
integration-tests/Earthfile
Normal file
57
integration-tests/Earthfile
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
VERSION 0.8
|
||||
PROJECT blue-build/cli
|
||||
|
||||
all:
|
||||
ARG NIGHTLY=false
|
||||
BUILD +build-template --NIGHTLY=$NIGHTLY
|
||||
BUILD +build --NIGHTLY=$NIGHTLY
|
||||
BUILD +rebase --NIGHTLY=$NIGHTLY
|
||||
BUILD +upgrade --NIGHTLY=$NIGHTLY
|
||||
|
||||
build-template:
|
||||
ARG NIGHTLY=false
|
||||
FROM DOCKERFILE \
|
||||
-f +template-containerfile/test/Containerfile \
|
||||
+template-containerfile/test/* --NIGHTLY=$NIGHTLY
|
||||
RUN [ -f /usr/test-file ]
|
||||
|
||||
template-containerfile:
|
||||
ARG NIGHTLY=false
|
||||
FROM +test-base --NIGHTLY=$NIGHTLY
|
||||
RUN bluebuild -vv template config/recipe.yml | tee Containerfile
|
||||
|
||||
SAVE ARTIFACT /test
|
||||
|
||||
build:
|
||||
ARG NIGHTLY=false
|
||||
FROM +test-base --NIGHTLY=$NIGHTLY
|
||||
|
||||
RUN --privileged bluebuild -vv build config/recipe.yml
|
||||
|
||||
rebase:
|
||||
ARG NIGHTLY=false
|
||||
FROM +test-base --NIGHTLY=$NIGHTLY
|
||||
|
||||
RUN --privileged bluebuild -vv rebase config/recipe.yml
|
||||
|
||||
upgrade:
|
||||
ARG NIGHTLY=false
|
||||
FROM +test-base --NIGHTLY=$NIGHTLY
|
||||
RUN mkdir -p /etc/bluebuild && touch /etc/bluebuild/template.tar.gz
|
||||
|
||||
RUN --privileged bluebuild -vv upgrade config/recipe.yml
|
||||
|
||||
test-base:
|
||||
ARG NIGHTLY=false
|
||||
|
||||
FROM ../+blue-build-cli-alpine --NIGHTLY=$NIGHTLY
|
||||
|
||||
COPY ./mock-scripts/ /usr/bin/
|
||||
|
||||
WORKDIR /test
|
||||
COPY ./test-repo /test
|
||||
|
||||
# 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
|
||||
3
integration-tests/mock-scripts/buildah
Executable file
3
integration-tests/mock-scripts/buildah
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo 'Running buildah'
|
||||
3
integration-tests/mock-scripts/podman
Executable file
3
integration-tests/mock-scripts/podman
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo 'Running podman'
|
||||
3
integration-tests/mock-scripts/rpm-ostree
Executable file
3
integration-tests/mock-scripts/rpm-ostree
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo 'Running rpm-ostree'
|
||||
0
integration-tests/test-repo/config/files/usr/.gitkeep
Normal file
0
integration-tests/test-repo/config/files/usr/.gitkeep
Normal file
1
integration-tests/test-repo/config/files/usr/test-file
Normal file
1
integration-tests/test-repo/config/files/usr/test-file
Normal file
|
|
@ -0,0 +1 @@
|
|||
|
||||
52
integration-tests/test-repo/config/recipe.yml
Normal file
52
integration-tests/test-repo/config/recipe.yml
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
# image will be published to ghcr.io/<user>/<name>
|
||||
name: template
|
||||
# description will be included in the image's metadata
|
||||
description: This is my personal OS image.
|
||||
|
||||
# the base image to build on top of (FROM) and the version tag to use
|
||||
base-image: ghcr.io/ublue-os/silverblue-main
|
||||
image-version: 39 # latest is also supported if you want new updates ASAP
|
||||
|
||||
# module configuration, executed in order
|
||||
# you can include multiple instances of the same module
|
||||
modules:
|
||||
- type: files
|
||||
files:
|
||||
- usr: /usr # copies config/files/usr into your image's /usr.
|
||||
# put configuration files you want in /etc/ on a booted system
|
||||
# in /usr/etc/ in the image. read more in files module reference.
|
||||
|
||||
- type: script
|
||||
scripts:
|
||||
- example.sh
|
||||
|
||||
- type: rpm-ostree
|
||||
repos:
|
||||
- https://copr.fedorainfracloud.org/coprs/atim/starship/repo/fedora-%OS_VERSION%/atim-starship-fedora-%OS_VERSION%.repo
|
||||
install:
|
||||
- micro
|
||||
- starship
|
||||
remove:
|
||||
- firefox # default firefox removed in favor of flatpak
|
||||
- firefox-langpacks # langpacks needs to also be removed to prevent dependency problems
|
||||
|
||||
- type: default-flatpaks
|
||||
notify: true # Send notification after install/uninstall is finished (true/false)
|
||||
system:
|
||||
# If no repo information is specified, Flathub will be used by default
|
||||
# repo-url: https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
# repo-name: flathub
|
||||
# repo-title: "Flathub (system-wide)" # Optional; this sets the remote's user-facing name in graphical frontends like GNOME Software
|
||||
install:
|
||||
- org.mozilla.firefox
|
||||
- org.gnome.Loupe
|
||||
- one.ablaze.floorp//lightning # This is an example of flatpak which has multiple branches in selection (flatpak//branch).
|
||||
# Flatpak runtimes are not supported (like org.winehq.Wine//stable-23.08),
|
||||
# only normal flatpak applications are (like Floorp Lightning web browser in this example).
|
||||
# Installing different branches of the same Flatpak is not supported.
|
||||
remove:
|
||||
- org.gnome.eog
|
||||
|
||||
- type: signing # this sets up the proper policy & signing files for signed images to work fully
|
||||
- type: test-module
|
||||
|
||||
10
integration-tests/test-repo/config/scripts/example.sh
Normal file
10
integration-tests/test-repo/config/scripts/example.sh
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Tell this script to exit if there are any errors.
|
||||
# You should have this in every custom script, to ensure that your completed
|
||||
# builds actually ran successfully without any errors!
|
||||
set -oue pipefail
|
||||
|
||||
# Your code goes here.
|
||||
echo 'This is an example shell script'
|
||||
echo 'Scripts here will run during build if specified in recipe.yml'
|
||||
0
integration-tests/test-repo/modules/.gitkeep
Normal file
0
integration-tests/test-repo/modules/.gitkeep
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "This is a test module"
|
||||
Loading…
Add table
Add a link
Reference in a new issue