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
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