Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
242 changes: 121 additions & 121 deletions .gitlab-ci.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Schutzfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"common": {
"rngseed": 2026051900,
"rngseed": 2026052100,
"dependencies": {
"bootc-image-builder": {
"ref": "quay.io/centos-bootc/bootc-image-builder@sha256:9893e7209e5f449b86ababfd2ee02a58cca2e5990f77b06c3539227531fc8120"
Expand Down
620 changes: 2 additions & 618 deletions test/scripts/boot-image

Large diffs are not rendered by default.

55 changes: 5 additions & 50 deletions test/scripts/build-image
Original file line number Diff line number Diff line change
@@ -1,72 +1,27 @@
#!/usr/bin/env python3
import argparse
import json
import os

import imgtestlib as testlib


def main():
default_arch = os.uname().machine
desc = "Build image for testing with boot-image"
parser = argparse.ArgumentParser(description=desc)
parser.add_argument("distro", type=str, default=None, help="distro for the image to boot test")
parser.add_argument("image_type", type=str, default=None, help="type of the image to boot test")
parser.add_argument("config", type=str, help="config used to build the image")
parser.add_argument("--arch", default="", type=str, help="target arch of the image")
parser.add_argument("--arch", type=str, default=default_arch,
help="architecture for image (defaults to host architecture)")

args = parser.parse_args()
distro = args.distro
image_type = args.image_type
arch = args.arch
config_path = args.config

print(f"👷 Building image {distro}/{image_type} using config {config_path}")

# print the config for logging
with open(config_path, "r", encoding="utf-8") as config_file:
config = json.load(config_file)
print(json.dumps(config, indent=2))
config_name = config["name"]

testlib.runcmd(["go", "build", "-o", "./bin/build", "./cmd/build"])

cmd = ["sudo", "-E", "./bin/build", "--output", "./build",
"--distro", distro, "--type", image_type, "--config", config_path]
arch = os.uname().machine
if args.arch:
arch = args.arch
cmd += ["--arch", args.arch]
testlib.runcmd_nc(cmd, extra_env=testlib.rng_seed_env())

print("✅ Build finished!!")

# Build artifacts are owned by root. Make them world accessible.
testlib.runcmd(["sudo", "chmod", "a+rwX", "-R", "./build"])

build_dir = os.path.join("build", testlib.gen_build_name(distro, arch, image_type, config_name))
manifest_path = os.path.join(build_dir, "manifest.json")
with open(manifest_path, "r", encoding="utf-8") as manifest_fp:
manifest_data = json.load(manifest_fp)
manifest_id = testlib.get_manifest_id(manifest_data)

osbuild_ver, _ = testlib.runcmd(["osbuild", "--version"])

distro_version = testlib.get_host_distro()
osbuild_commit = testlib.get_osbuild_commit(distro_version)
if osbuild_commit is None:
osbuild_commit = "RELEASE"

build_info = {
"distro": distro,
"arch": arch,
"image-type": image_type,
"config": config_name,
"manifest-checksum": manifest_id,
"osbuild-version": osbuild_ver.decode().strip(),
"osbuild-commit": osbuild_commit,
"commit": os.environ.get("CI_COMMIT_SHA", "N/A"),
"runner-distro": distro_version,
}
testlib.write_build_info(build_dir, build_info)
testlib.build_image(distro, arch, image_type, config_path)


if __name__ == "__main__":
Expand Down
3 changes: 2 additions & 1 deletion test/scripts/generate-build-config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ JOB_TEMPLATE = """
build/{distro}/{arch}/{image_type}/{config_name}:
stage: test
script:
- sudo ./test/scripts/setup-osbuild-repo
- sudo -E ./test/scripts/setup-osbuild-repo
- sudo ./test/scripts/install-dependencies
- ./test/scripts/build-image "{distro}" "{image_type}" "{config}"
- ./test/scripts/boot-image "{image_path}" "{config}"
Expand All @@ -25,6 +25,7 @@ build/{distro}/{arch}/{image_type}/{config_name}:
"""


@testlib.log_section("Generating manifests")
def generate_manifests(outputdir, distro, arch):
"""
Generate all manifest using the default config list and return a dictionary mapping each manifest file to the
Expand Down
6 changes: 3 additions & 3 deletions test/scripts/generate-gitlab-ci
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ GEN_TEMPLATE = """
RUNNER: {runner}-{arch}
INTERNAL_NETWORK: "true"
script:
- sudo ./test/scripts/setup-osbuild-repo
- sudo -E ./test/scripts/setup-osbuild-repo
- sudo ./test/scripts/install-dependencies
- ./test/scripts/generate-build-config --distro {distro} --arch {arch} build-config.yml
artifacts:
Expand Down Expand Up @@ -89,7 +89,7 @@ OSTREE_GEN_TEMPLATE = """
RUNNER: {runner}-{arch}
INTERNAL_NETWORK: "true"
script:
- sudo ./test/scripts/setup-osbuild-repo
- sudo -E ./test/scripts/setup-osbuild-repo
- sudo ./test/scripts/install-dependencies
- ./test/scripts/generate-ostree-build-config --distro {distro} --arch {arch} build-config.yml build-configs
artifacts:
Expand Down Expand Up @@ -121,7 +121,7 @@ MANIFEST_GEN_TEMPLATE = """
RUNNER: {runner}-x86_64
INTERNAL_NETWORK: "true"
script: |
sudo ./test/scripts/setup-osbuild-repo
sudo -E ./test/scripts/setup-osbuild-repo
sudo ./test/scripts/install-dependencies
echo "GOPROXY=$GOPROXY"
go run ./cmd/gen-manifests --arches {arch} --distros {distro} --workers 10 --metadata=false --output ./manifests
Expand Down
2 changes: 1 addition & 1 deletion test/scripts/generate-ostree-build-config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ JOB_TEMPLATE = """
build/{distro}/{arch}/{image_type}/{config_name}:
stage: test
script:
- sudo ./test/scripts/setup-osbuild-repo
- sudo -E ./test/scripts/setup-osbuild-repo
- sudo ./test/scripts/install-dependencies
- {dl_container}
- {start_container}
Expand Down
7 changes: 7 additions & 0 deletions test/scripts/imgtestlib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from .boot import *
from .build import *
from .cache import *
from .core import *
from .gitlab import *
from .run import *
from .testenv import *
Loading
Loading