Skip to content

Commit

Permalink
test: adapt testing to RHEL 9.4
Browse files Browse the repository at this point in the history
- Disable downloading of build cache.
- Disable uploading of results to cache.
- Add build tags to exclude the btrfs graphdriver for the container
  dependencies.
- Remove awscli2 and btrfs-progs-devel from the install dependencies
  script (not available on RHEL).
- Remove the check-build-coverage step in gitlab-ci.  It requires
  reading the build cache.
- Disable ostree derivative builds (images and installers), since they
  require the aws cli.
  • Loading branch information
achilleas-k authored and supakeen committed Oct 22, 2024
1 parent 85b573b commit 649fd21
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 170 deletions.
86 changes: 2 additions & 84 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ stages:
- init
- gen
- build
- ostree-gen
- ostree-build
- verify
- finish

variables:
Expand All @@ -21,21 +18,6 @@ init:
script:
- schutzbot/update_github_status.sh start

check-build-coverage:
stage: verify
extends: .terraform
variables:
RUNNER: aws/rhel-9.4-ga-x86_64
INTERNAL_NETWORK: "true"
PYTHONUNBUFFERED: 1
script:
- sudo ./test/scripts/install-dependencies
- ./test/scripts/check-build-coverage ./s3configs/
cache:
key: testcache
paths:
- .cache/osbuild-images

finish:
stage: finish
dependencies: []
Expand Down Expand Up @@ -127,70 +109,6 @@ image-build-trigger-rhel-9.4-x86_64:
needs:
- generate-build-config-rhel-9.4-x86_64

generate-ostree-build-config-rhel-9.4-aarch64:
stage: ostree-gen
extends: .terraform
variables:
RUNNER: aws/rhel-9.4-ga-aarch64
INTERNAL_NETWORK: "true"
script:
- sudo ./test/scripts/setup-osbuild-repo
- sudo ./test/scripts/install-dependencies
- ./test/scripts/generate-ostree-build-config --distro rhel-9.4 --arch aarch64 build-config.yml build-configs
artifacts:
paths:
- build-config.yml
- build-configs
needs:
- image-build-trigger-rhel-9.4-aarch64
cache:
key: testcache
paths:
- .cache/osbuild-images


generate-ostree-build-config-rhel-9.4-x86_64:
stage: ostree-gen
extends: .terraform
variables:
RUNNER: aws/rhel-9.4-ga-x86_64
INTERNAL_NETWORK: "true"
script:
- sudo ./test/scripts/setup-osbuild-repo
- sudo ./test/scripts/install-dependencies
- ./test/scripts/generate-ostree-build-config --distro rhel-9.4 --arch x86_64 build-config.yml build-configs
artifacts:
paths:
- build-config.yml
- build-configs
needs:
- image-build-trigger-rhel-9.4-x86_64
cache:
key: testcache
paths:
- .cache/osbuild-images

image-build-ostree-trigger-rhel-9.4-aarch64:
stage: ostree-build
trigger:
include:
- artifact: build-config.yml
job: generate-ostree-build-config-rhel-9.4-aarch64
strategy: depend
needs:
- generate-ostree-build-config-rhel-9.4-aarch64


image-build-ostree-trigger-rhel-9.4-x86_64:
stage: ostree-build
trigger:
include:
- artifact: build-config.yml
job: generate-ostree-build-config-rhel-9.4-x86_64
strategy: depend
needs:
- generate-ostree-build-config-rhel-9.4-x86_64

generate-manifests-rhel-9.4-ppc64le:
stage: gen
extends: .terraform
Expand All @@ -200,7 +118,7 @@ generate-manifests-rhel-9.4-ppc64le:
script:
- sudo ./test/scripts/setup-osbuild-repo
- sudo ./test/scripts/install-dependencies
- go run ./cmd/gen-manifests --arches ppc64le --distros rhel-9.4 --workers 10 --metadata=false --output ./manifests
- go run -tags=exclude_graphdriver_btrfs ./cmd/gen-manifests --arches ppc64le --distros rhel-9.4 --workers 10 --metadata=false --output ./manifests
- for manifest in ./manifests/*; do
if osbuild --inspect $manifest > output; then
echo "$manifest OK";
Expand All @@ -219,7 +137,7 @@ generate-manifests-rhel-9.4-s390x:
script:
- sudo ./test/scripts/setup-osbuild-repo
- sudo ./test/scripts/install-dependencies
- go run ./cmd/gen-manifests --arches s390x --distros rhel-9.4 --workers 10 --metadata=false --output ./manifests
- go run -tags=exclude_graphdriver_btrfs ./cmd/gen-manifests --arches s390x --distros rhel-9.4 --workers 10 --metadata=false --output ./manifests
- for manifest in ./manifests/*; do
if osbuild --inspect $manifest > output; then
echo "$manifest OK";
Expand Down
18 changes: 6 additions & 12 deletions test/scripts/boot-image
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,12 @@ def main():

print(f"Testing image at {image_path}")
bib_image_id = ""
match image_type:
case "ami" | "ec2" | "ec2-ha" | "ec2-sap" | "edge-ami":
boot_ami(distro, arch, image_type, image_path, build_config_path)
case "iot-bootable-container":
manifest_id = build_info["manifest-checksum"]
boot_container(distro, arch, image_type, image_path, manifest_id)
bib_ref = testlib.get_bib_ref()
bib_image_id = testlib.skopeo_inspect_id(f"docker://{bib_ref}", testlib.host_container_arch())
case _:
# skip
print(f"{image_type} boot tests are not supported yet")
return
if image_type in ("ami", "ec2", "ec2-ha", "ec2-sap", "edge-ami"):
boot_ami(distro, arch, image_type, image_path, build_config_path)
else:
# skip
print(f"{image_type} boot tests are not supported yet")
return

print("✅ Marking boot successful")
# amend build info with boot success
Expand Down
2 changes: 1 addition & 1 deletion test/scripts/build-image
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def main():
print(json.dumps(config, indent=2))
config_name = config["name"]

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

cmd = ["sudo", "-E", "./bin/build", "--output", "./build",
"--distro", distro, "--image", image_type, "--config", config_path]
Expand Down
1 change: 0 additions & 1 deletion test/scripts/generate-build-config
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ build/{distro}/{arch}/{image_type}/{config_name}:
- sudo ./test/scripts/install-dependencies
- ./test/scripts/build-image "{distro}" "{image_type}" "{config}"
- ./test/scripts/boot-image "{distro}" "{arch}" "{image_type}" "{image_path}"
- ./test/scripts/upload-results "{distro}" "{image_type}" "{config}"
extends: .terraform
variables:
RUNNER: aws/rhel-9.4-ga-{arch}
Expand Down
62 changes: 1 addition & 61 deletions test/scripts/generate-gitlab-ci
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ stages:
- init
- gen
- build
- ostree-gen
- ostree-build
- verify
- finish
variables:
Expand All @@ -32,21 +29,6 @@ init:
script:
- schutzbot/update_github_status.sh start
check-build-coverage:
stage: verify
extends: .terraform
variables:
RUNNER: aws/rhel-9.4-ga-x86_64
INTERNAL_NETWORK: "true"
PYTHONUNBUFFERED: 1
script:
- sudo ./test/scripts/install-dependencies
- ./test/scripts/check-build-coverage ./s3configs/
cache:
key: testcache
paths:
- .cache/osbuild-images
finish:
stage: finish
dependencies: []
Expand Down Expand Up @@ -97,42 +79,6 @@ image-build-trigger-{distro}-{arch}:
- generate-build-config-{distro}-{arch}
"""

OSTREE_GEN_TEMPLATE = """
generate-ostree-build-config-{distro}-{arch}:
stage: ostree-gen
extends: .terraform
variables:
RUNNER: aws/rhel-9.4-ga-{arch}
INTERNAL_NETWORK: "true"
script:
- sudo ./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:
paths:
- build-config.yml
- build-configs
needs:
- image-build-trigger-{distro}-{arch}
cache:
key: testcache
paths:
- {cache}
"""

OSTREE_TRIGGER_TEMPLATE = """
image-build-ostree-trigger-{distro}-{arch}:
stage: ostree-build
trigger:
include:
- artifact: build-config.yml
job: generate-ostree-build-config-{distro}-{arch}
strategy: depend
needs:
- generate-ostree-build-config-{distro}-{arch}
"""


MANIFEST_GEN_TEMPLATE = """
generate-manifests-{distro}-{arch}:
stage: gen
Expand All @@ -143,7 +89,7 @@ generate-manifests-{distro}-{arch}:
script:
- sudo ./test/scripts/setup-osbuild-repo
- sudo ./test/scripts/install-dependencies
- go run ./cmd/gen-manifests --arches {arch} --distros {distro} --workers 10 --metadata=false --output ./manifests
- go run -tags=exclude_graphdriver_btrfs ./cmd/gen-manifests --arches {arch} --distros {distro} --workers 10 --metadata=false --output ./manifests
- for manifest in ./manifests/*; do
if osbuild --inspect $manifest > output; then
echo "$manifest OK";
Expand All @@ -167,8 +113,6 @@ def main():

gen_stage = []
trigger_stage = []
ostree_gen_stage = []
ostree_trigger_stage = []
for img in sort_configs(images):
combo = (img["distro"], img["arch"])
if combo in combos:
Expand All @@ -177,8 +121,6 @@ def main():
combos.add(combo)
gen_stage.append(GEN_TEMPLATE.format(distro=img["distro"], arch=img["arch"], cache=cache))
trigger_stage.append(TRIGGER_TEMPLATE.format(distro=img["distro"], arch=img["arch"], cache=cache))
ostree_gen_stage.append(OSTREE_GEN_TEMPLATE.format(distro=img["distro"], arch=img["arch"], cache=cache))
ostree_trigger_stage.append(OSTREE_TRIGGER_TEMPLATE.format(distro=img["distro"], arch=img["arch"], cache=cache))

man_only_images = testlib.list_images(arches=MANIFEST_ONLY_ARCHES)
man_gen_stage = []
Expand All @@ -195,8 +137,6 @@ def main():
config_file.write(testlib.BASE_CONFIG)
config_file.write("\n".join(gen_stage))
config_file.write("\n".join(trigger_stage))
config_file.write("\n".join(ostree_gen_stage))
config_file.write("\n".join(ostree_trigger_stage))
config_file.write("\n".join(man_gen_stage))


Expand Down
1 change: 0 additions & 1 deletion test/scripts/generate-ostree-build-config
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ build/{distro}/{arch}/{image_type}/{config_name}:
- {start_container}
- ./test/scripts/build-image "{distro}" "{image_type}" "{config}"
- ./test/scripts/boot-image "{distro}" "{arch}" "{image_type}" "{image_path}"
- ./test/scripts/upload-results "{distro}" "{image_type}" "{config}"
extends: .terraform
variables:
RUNNER: aws/rhel-9.4-ga-{arch}
Expand Down
14 changes: 6 additions & 8 deletions test/scripts/imgtestlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def list_images(distros=None, arches=None, images=None):
images_arg = "*"
if images:
images_arg = ",".join(images)
out, _ = runcmd(["go", "run", "./cmd/list-images", "--json",
out, _ = runcmd(["go", "run", "-tags=exclude_graphdriver_btrfs", "./cmd/list-images", "--json",
"--distros", distros_arg, "--arches", arches_arg, "--images", images_arg])
return json.loads(out)

Expand Down Expand Up @@ -201,7 +201,9 @@ def check_config_names():
def gen_manifests(outputdir, config_map=None, distros=None, arches=None, images=None,
commits=False, skip_no_config=False):
# pylint: disable=too-many-arguments
cmd = ["go", "run", "./cmd/gen-manifests",
cmd = ["go", "run",
"-tags=exclude_graphdriver_btrfs",
"./cmd/gen-manifests",
"--cache", os.path.join(TEST_CACHE_ROOT, "rpmmd"),
"--output", outputdir,
"--workers", "100"]
Expand Down Expand Up @@ -316,12 +318,8 @@ def filter_builds(manifests, distro=None, arch=None, skip_ostree_pull=True):
os.makedirs(dl_path, exist_ok=True)
build_requests = []

out, dl_ok = dl_build_info(dl_path, distro=distro, arch=arch)
# continue even if the dl failed; will build all configs
if dl_ok:
# print output which includes list of downloaded files for CI job log
print(out)

# NOTE: disabled cache download for RHEL because there no aws-cli, the build matrix is smaller, and we wont be
# making many PRs to the branch.
osbuild_ver = get_osbuild_nevra()

errors: list[str] = []
Expand Down
2 changes: 0 additions & 2 deletions test/scripts/install-dependencies
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env bash

dnf -y install \
awscli2 \
btrfs-progs-devel \
device-mapper-devel \
gcc \
go \
Expand Down

0 comments on commit 649fd21

Please sign in to comment.