diff --git a/tests/images/azl-installer/installer-iso.yaml b/tests/images/azl-installer/installer-iso.yaml deleted file mode 100644 index a5f63a0a17..0000000000 --- a/tests/images/azl-installer/installer-iso.yaml +++ /dev/null @@ -1,95 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - maxSize: 4G - partitions: - - id: esp - type: esp - size: 8M - - - id: rootfs - size: grow - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: rootfs - type: ext4 - mountPoint: - path: / - -os: - hostname: azl-installer - bootloader: - resetType: hard-reset - - selinux: - mode: disabled - - kernelCommandLine: - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.info - - log_buf_len=1M - - packages: - install: - - curl - - device-mapper - - dnf - - dosfstools - - efibootmgr - - iproute - - iptables - - jq - - lsof - - mdadm - - nano - - netplan - - openssh-server - - squashfs-tools - - tar - - tpm2-tools - - trident-provisioning - - vim - - veritysetup - # Accessibility packages - - pcaudiolib - - additionalFiles: - # Getty service files for root autologin - - source: mos/files/getty@.service - destination: /usr/lib/systemd/system/getty@.service - - source: mos/files/serial-getty@.service - destination: /usr/lib/systemd/system/serial-getty@.service - - source: mos/scripts/installation.sh - destination: /root/installer/installation.sh - -iso: - initramfsType: full-os - - additionalFiles: - - source: iso/images/trident-testimage.cosi - destination: /images/azure-linux-core.cosi - - source: iso/bin/liveinstaller - destination: /installer/liveinstaller - - source: iso/files/config-placeholder.yaml - destination: /installer/trident-config.yaml.tmpl - - kernelCommandLine: - extraCommandLine: - - console=tty0 - - console=tty1 - - console=ttyS0 - - loglevel=6 - -scripts: - postCustomization: - - path: mos/scripts/startup-command.sh diff --git a/tests/images/azl-installer/iso/.gitignore b/tests/images/azl-installer/iso/.gitignore deleted file mode 100644 index 6fda09c27e..0000000000 --- a/tests/images/azl-installer/iso/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/images/ -/bin/ \ No newline at end of file diff --git a/tests/images/azl-installer/iso/files/config-placeholder.yaml b/tests/images/azl-installer/iso/files/config-placeholder.yaml deleted file mode 100644 index 135e8d6d57..0000000000 --- a/tests/images/azl-installer/iso/files/config-placeholder.yaml +++ /dev/null @@ -1 +0,0 @@ -#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/installer/trident-config.yaml.tmpl:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################## diff --git a/tests/images/azl-installer/mos/files/getty@.service b/tests/images/azl-installer/mos/files/getty@.service deleted file mode 100644 index 10d3131812..0000000000 --- a/tests/images/azl-installer/mos/files/getty@.service +++ /dev/null @@ -1,58 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Getty on %I -Documentation=man:agetty(8) man:systemd-getty-generator(8) -Documentation=http://0pointer.de/blog/projects/serial-console.html -After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target -After=rc-local.service - -# If additional gettys are spawned during boot then we should make -# sure that this is synchronized before getty.target, even though -# getty.target didn't actually pull it in. -Before=getty.target -IgnoreOnIsolate=yes - -# IgnoreOnIsolate causes issues with sulogin, if someone isolates -# rescue.target or starts rescue.service from multi-user.target or -# graphical.target. -Conflicts=rescue.service -Before=rescue.service - -# On systems without virtual consoles, don't start any getty. Note -# that serial gettys are covered by serial-getty@.service, not this -# unit. -ConditionPathExists=/dev/tty0 - -[Service] -# the VT is cleared by TTYVTDisallocate -# The '-o' option value tells agetty to replace 'login' arguments with an -# option to preserve environment (-p), followed by '--' for safety, and then -# the entered username. -ExecStart=-/sbin/agetty --autologin root --noclear %I linux -Type=idle -Restart=always -RestartSec=0 -UtmpIdentifier=%I -TTYPath=/dev/%I -TTYReset=yes -TTYVHangup=yes -TTYVTDisallocate=yes -KillMode=process -IgnoreSIGPIPE=no -SendSIGHUP=yes - -# Unset locale for the console getty since the console has problems -# displaying some internationalized messages. -UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION - -[Install] -WantedBy=getty.target -DefaultInstance=tty1 diff --git a/tests/images/azl-installer/mos/files/serial-getty@.service b/tests/images/azl-installer/mos/files/serial-getty@.service deleted file mode 100644 index 2f65391a8e..0000000000 --- a/tests/images/azl-installer/mos/files/serial-getty@.service +++ /dev/null @@ -1,46 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Serial Getty on %I -Documentation=man:agetty(8) man:systemd-getty-generator(8) -Documentation=http://0pointer.de/blog/projects/serial-console.html -BindsTo=dev-%i.device -After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target -After=rc-local.service - -# If additional gettys are spawned during boot then we should make -# sure that this is synchronized before getty.target, even though -# getty.target didn't actually pull it in. -Before=getty.target -IgnoreOnIsolate=yes - -# IgnoreOnIsolate causes issues with sulogin, if someone isolates -# rescue.target or starts rescue.service from multi-user.target or -# graphical.target. -Conflicts=rescue.service -Before=rescue.service - -[Service] -# The '-o' option value tells agetty to replace 'login' arguments with an -# option to preserve environment (-p), followed by '--' for safety, and then -# the entered username. -ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I screen -Type=idle -Restart=always -UtmpIdentifier=%I -TTYPath=/dev/%I -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -SendSIGHUP=yes - -[Install] -WantedBy=getty.target diff --git a/tests/images/azl-installer/mos/scripts/installation.sh b/tests/images/azl-installer/mos/scripts/installation.sh deleted file mode 100644 index 79289b519b..0000000000 --- a/tests/images/azl-installer/mos/scripts/installation.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -set -ex -trap '/bin/bash' ERR - -CDROM_MOUNT="/mnt/cdrom" -WORKING_DIR="/root/installer" -MAGIC_PLACEHOLDER="8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d" - -# Mount CD-ROM using symlink -mkdir -p "$CDROM_MOUNT" -mount /dev/cdrom "$CDROM_MOUNT" - -# CD-ROM paths -LIVEINSTALLER_PATH="$CDROM_MOUNT/installer/liveinstaller" -POSSIBLE_HC_TEMPLATE="$CDROM_MOUNT/installer/trident-config.yaml.tmpl" -IMAGES_DIR="$CDROM_MOUNT/images/" - -# WORKING_DIR paths -LIVEINSTALLER_BIN="$WORKING_DIR/liveinstaller" -TRIDENT_CONFIG_DESTINATION="/etc/trident/config.yaml" -LOG_FILE="$WORKING_DIR/liveinstaller.log" -OUTPUT_LOG="$WORKING_DIR/output_liveinstaller.log" - -# Copy to WORKING_DIR to execute liveinstaller -cp "$LIVEINSTALLER_PATH" "$LIVEINSTALLER_BIN" - -# Check if placeholder magic string is present (ISO not patched) -if grep -q "^#${MAGIC_PLACEHOLDER}:" "$POSSIBLE_HC_TEMPLATE"; then - # Placeholder found - execute attended installation (interactive UI) - cd "$WORKING_DIR" - "$LIVEINSTALLER_BIN" \ - --images-dir="$IMAGES_DIR" \ - --host-config-output="$TRIDENT_CONFIG_DESTINATION" \ - --log-level=trace \ - --log-file="$LOG_FILE" 2>&1 | tee "$OUTPUT_LOG" -else - # Placeholder was replaced by a Host Configuration - execute unattended installation - echo "Pre-configured Host Configuration found. Starting unattended installation..." - # Save template in WORKING_DIR in case of failure - TEMPLATE_FILE="$WORKING_DIR/template.yaml" - cp "$POSSIBLE_HC_TEMPLATE" "$TEMPLATE_FILE" - # Execute liveinstaller (unattended) - cd "$WORKING_DIR" - "$LIVEINSTALLER_BIN" \ - --unattended \ - --template-file="$TEMPLATE_FILE" \ - --log-level=trace \ - --log-file="$LOG_FILE" 2>&1 | tee "$OUTPUT_LOG" -fi - -/bin/bash \ No newline at end of file diff --git a/tests/images/azl-installer/mos/scripts/startup-command.sh b/tests/images/azl-installer/mos/scripts/startup-command.sh deleted file mode 100755 index 7502521001..0000000000 --- a/tests/images/azl-installer/mos/scripts/startup-command.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -INSTALLATION="/root/installer/installation.sh" -chmod +x "$INSTALLATION" - -chsh -s "$INSTALLATION" root diff --git a/tests/images/azurelinux-direct-streaming-testimage/base/baseimg.yaml b/tests/images/azurelinux-direct-streaming-testimage/base/baseimg.yaml deleted file mode 100644 index 88a8d7b972..0000000000 --- a/tests/images/azurelinux-direct-streaming-testimage/base/baseimg.yaml +++ /dev/null @@ -1,80 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - maxSize: 15G - partitions: - - id: esp - type: esp - size: 50M - label: esp - - id: root-a - size: 4G - type: root - label: root-a - - id: root-b - size: 4G - type: root - label: root-b - - id: swap - size: 2G - type: swap - label: swap - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: root-a - type: ext4 - mountPoint: - path: / - -os: - bootloader: - resetType: hard-reset - hostname: trident-rawcosi-testimage - - selinux: - mode: permissive - - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.info - - log_buf_len=1M - - packages: - install: - - curl - - dnf - - efibootmgr - - iproute - - iptables - - lsof - - mdadm - - netplan - - openssh-server - - tpm2-tools - - vim - - audit - # Packages required for functional tests, which currently use this image: - - device-mapper - - dosfstools - - lvm2 - - veritysetup - # Optional dependencies for NTFS - - ntfs-3g - - ntfsprogs - # selinux - - selinux-policy - - services: - enable: - - sshd diff --git a/tests/images/azurelinux-direct-streaming-testimage/base/post-install.sh b/tests/images/azurelinux-direct-streaming-testimage/base/post-install.sh deleted file mode 100755 index 79da025b3b..0000000000 --- a/tests/images/azurelinux-direct-streaming-testimage/base/post-install.sh +++ /dev/null @@ -1,2 +0,0 @@ -# Add the necessary directories for the audit logs so that auditd can start -mkdir -p /var/log/audit diff --git a/tests/images/builder/README.md b/tests/images/builder/README.md deleted file mode 100644 index 0fafbd66a9..0000000000 --- a/tests/images/builder/README.md +++ /dev/null @@ -1,130 +0,0 @@ -# Builder - -Builder is a Python tool to declare, customize, and build images with AZL Image Customizer locally and in the pipelines. - -## Overview - -Builder is a builder system designed around declarative image definitions that wraps around the AZL Image Customizer concepts and API. - -`testimages.py` script in the top-level directory contains declarative definitions of all images and artifacts, such as the Image Customizer container. It is a convenient entry point for building an image locally or in the pipelines. To learn more about the supported commands, run: - -```bash -python3 ./testimages.py --help -``` - -## Directory Structure - -```md -builder/ -├── __init__.py # Definitions of wrappers around Image Customizer concepts -├── builder.py # High-level logic for building image clones -├── cli.py # Command-line interface and command execution -├── context_managers.py # Utilities for resource cleanup -├── customize.py # Image Customizer API wrapper -├── download.py # Utilities for image download -├── README.md # README -├── run.py # Core build functions and orchestration -└── sign.py # Utilities for image signing -``` - -## Key Components - -### `__init__.py` - -Defines foundational data structures and enums used throughout Builder. Specifically, defines `ImageConfig`, which represents an Image Customizer config, and `ArtifactManifest`, which describes the Image Cuztomizer container to be used for building images. - -Also, contains a series of other definitions that represent the base image type, output format, system architecture, etc. - -### `cli.py` - -Implements Builder's command-line interface and executes commands such as `build()`. Most of the high-level logic happens in `cli.init()`, which orchestrates the entire build process. - -### `run.py` - -Contains the implementations of the core functions supported by Builder, such as `build()` or `generate_matrix()`. - -### `builder.py` - -This is where the high-level logic around building images, signed and unsigned, lives. This file calls into Image Customizer APIs inside `customize.py` to build images, using cloning and parallel processing. - -### `customize.py` - -Wrapper around the AZL Image Customizer API. Only container-based execution is now supported since running IC as a raw binary is no longer supported. - -Specifically, provides APIs for (1) building an image and (2) injecting signed boot artifacts into an image via the preview feature `inject-files`. - -### Utility Files - -#### `sign.py` - -Utility functions needed for signing an image built via Image Customizer. This is needed for enabling `SecureBoot` in a host. - -#### `download.py` - -Utility functions for downloading images as AZ artifacts. - -#### `context_managers.py` - -Utility functions for resource cleanup. - -## Key Concepts - -### Image Cloning - -The builder supports creating multiple clones of the same image with different UUIDs. This is essential for testing updates where you need identical images with unique identifiers: - -### Parallel Processing - -The system uses Python's `multiprocessing` package to build image clones in parallel, significantly reducing build times. Each clone is built in its own process with a deep copy of the `ImageConfig` object to avoid race conditions. - -### Resource Management - -The builder uses `ExitStack()` context managers to ensure proper cleanup of temporary resources. - -## Running Builder - -Builder can be run locally as a stand-alone tool: - -```bash - python3 ./testimages.py -``` - -The following commands are supported: - -```bash - # List images available for building - python3 ./testimages.py list - # Download a base image: baremetal, core_selinux, qemu_guest, or minimal - python3 ./testimages.py download-image - # List required dependencies for an image - python3 ./testimages.py dependencies - # Build an image locally - python3 ./testimages.py build - # Show key info about the image, such as name, source, config path, etc. - python3 ./testimages.py show-image - # Show info on key artifacts, such as the Image Customizer version or container image - python3 ./testimages.py show-artifact - # List images that have been built and are available to be used - python3 ./testimages.py list-files -``` - -To build an image with Builder or test your changes to Builder, follow these steps: - -1. If necessary, make changes to the Builder source code. -1. Download the base image: - -```bash - ./testimages.py download-image -``` - -1. If necessary, update the Image Customizer config for the image you want to build, by modifying the corresponding YAML in `test-images/platform-integration-images`. You can also find the relevant YAML by running: - -```bash - python3 ./testimages.py show-image config-file -``` - -1. Build the image: - -```bash - python3 ./testimages.py build --output-dir --no-download --clones -``` diff --git a/tests/images/builder/__init__.py b/tests/images/builder/__init__.py deleted file mode 100644 index ca82f58db9..0000000000 --- a/tests/images/builder/__init__.py +++ /dev/null @@ -1,272 +0,0 @@ -import yaml - -from dataclasses import dataclass, field, fields -from enum import Enum -from pathlib import Path -from typing import List, Optional - - -@dataclass -class BaseImageData: - name: str - path: Path - - -class BaseImage(Enum): - BAREMETAL = BaseImageData("baremetal", Path("artifacts/baremetal.vhdx")) - CORE_SELINUX = BaseImageData("core_selinux", Path("artifacts/core_selinux.vhdx")) - QEMU_GUEST = BaseImageData("qemu_guest", Path("artifacts/qemu_guest.vhdx")) - CORE_ARM64 = BaseImageData("core_arm64", Path("artifacts/core_arm64.vhdx")) - MINIMAL = BaseImageData("minimal", Path("artifacts/minimal.vhdx")) - MINIMAL_AARCH64 = BaseImageData( - "minimal_aarch64", Path("artifacts/minimal_aarch64.vhdx") - ) - UBUNTU_2204_AMD64 = BaseImageData( - "ubuntu_2204_amd64", Path("artifacts/ubuntu_2204_amd64.vhdx") - ) - UBUNTU_2204_ARM64 = BaseImageData( - "ubuntu_2204_arm64", Path("artifacts/ubuntu_2204_arm64.vhdx") - ) - UBUNTU_2404_AMD64 = BaseImageData( - "ubuntu_2404_amd64", Path("artifacts/ubuntu_2404_amd64.vhdx") - ) - UBUNTU_2404_ARM64 = BaseImageData( - "ubuntu_2404_arm64", Path("artifacts/ubuntu_2404_arm64.vhdx") - ) - GB200_2404_ARM64 = BaseImageData( - "gb200_2404_arm64", Path("artifacts/gb200_2404_arm64.vhdx") - ) - - @property - def path(self) -> Path: - return self.value.path - - @property - def name(self) -> str: - return self.value.name - - def __str__(self) -> str: - return self.value.name - - -@dataclass -class BaseImageManifest: - image: BaseImage - package_name: str - version: str - org: str = "https://dev.azure.com/mariner-org/" - project: str = "36d030d6-1d99-4ebd-878b-09af1f4f722f" - feed: str = "AzureLinuxArtifacts" - glob: str = "*.vhdx" - - -class OutputFormat(Enum): - BAREMETAL_IMAGE = "baremetal-image" - COSI = "cosi" - VHDX = "vhdx" - RAW = "raw" - QCOW2 = "qcow2" - ISO = "iso" - VHD = "vhd" - VHD_FIXED = "vhd-fixed" - - def ic_name(self): - """Return the Image Customizer name for this format.""" - return self.value - - def ext(self) -> str: - """Return the file extension for this format.""" - if self == OutputFormat.VHD_FIXED: - return "vhd" - elif self == OutputFormat.BAREMETAL_IMAGE: - return "cosi" - return self.value - - -class RpmSources(Enum): - TRIDENT = Path("bin/RPMS") - DHCP = Path("artifacts/dhcp") - RPM_OVERRIDES = Path("artifacts/rpm-overrides") - - def path(self) -> Path: - return self.value - - -class SystemArchitecture(Enum): - AMD64 = "amd64" - ARM64 = "arm64" - - def __str__(self) -> str: - return self.value - - -@dataclass -class ImageConfig: - # Friendly name of the image - name: str - - # Top level config dir - source: str = "tests/images" - - # Second-level dir, generally same as name - config: str = None - - # YAML config file inside the config dir - config_file: Path = Path("base/baseimg.yaml") - - # The base image to use - base_image: BaseImage = BaseImage.BAREMETAL - - # Whether the image requires Trident RPMs - requires_trident: bool = True - - # Whether the image requires DHCP RPMs - requires_dhcp: bool = False - - # Desired output format for this image - output_format: OutputFormat = OutputFormat.COSI - - # Extra dependencies for this image - extra_dependencies: List[Path] = field(default_factory=list) - - # Requires ukify to be present on the host - requires_ukify: bool = False - - # When present, path to write a public SSH key to for customizer to consume - # into the image. Both keys will be written to the output directory. - ssh_key: Optional[Path] = None - - # Architecture of the image - architecture: SystemArchitecture = SystemArchitecture.AMD64 - - # Use ImageCustomizer convert command rather than customize - image_customizer_convert: bool = False - - @classmethod - def kebab_fields(cls) -> List[str]: - """Return a list of fields in kebab-case.""" - return [f.name.replace("_", "-") for f in fields(cls)] - - def __post_init__(self): - self.suffix = None - if not self.config: - self.config = self.name - - # Update the ssh key to be a Path object if it's a string - if isinstance(self.ssh_key, str): - self.ssh_key = Path(self.ssh_key) - - # Update config_file to be a Path object if it's a string - if isinstance(self.config_file, str): - self.config_file = Path(self.config_file) - - # Automatically set the architecture to arm64 if the base image is ARM64 - if self.base_image == BaseImage.CORE_ARM64: - self.architecture = SystemArchitecture.ARM64 - - # Placeholder for the loaded base Image Customizer config - self.__base_ic_config = None - - @property - def base_ic_config(self) -> dict: - """Lazy-load and return the base Image Customizer config as a dict.""" - if self.__base_ic_config is None: - try: - with open(self.full_yaml_path(), "r") as f: - self.__base_ic_config = yaml.safe_load(f) - except Exception as e: - raise RuntimeError( - f"Error loading image config '{self.full_yaml_path()}': {e}" - ) from e - return self.__base_ic_config - - def base_dir(self) -> Path: - return Path(self.source) / self.config - - def full_yaml_path(self) -> Path: - return self.base_dir() / self.config_file - - def dependencies(self) -> List[Path]: - deps = [self.base_image.path] - if not self.image_customizer_convert: - deps.append(self.full_yaml_path()) - for file in self.base_dir().rglob("*"): - if file.is_file(): - deps.append(file) - self.base_dir().glob - if self.requires_trident: - deps.append(RpmSources.TRIDENT.path()) - deps.extend(RpmSources.TRIDENT.path().rglob("*.rpm")) - if self.requires_dhcp: - deps.append(RpmSources.DHCP.path()) - deps.extend(RpmSources.DHCP.path().rglob("*.rpm")) - deps.extend(self.extra_dependencies) - return deps - - def file_name(self) -> str: - """ - Returns the file name for the image. - """ - return f"{self.id}.{self.output_format.ext()}" - - def file_name_unsigned_raw(self) -> str: - """Returns the file name for the unsigned raw image.""" - return f"{self.id}-unsigned.{OutputFormat.RAW.ext()}" - - def set_suffix(self, suffix: str) -> None: - self.suffix = suffix - - @property - def id(self) -> str: - """Return the image ID.""" - if self.suffix is None: - return self.name - return f"{self.name}_{self.suffix}" - - def get_output_artifacts_dir(self) -> Optional[str]: - """ - Return the output.artifacts.path from the image configuration YAML. - - Throws: - ValueError if the path is present but empty. - """ - path = self.base_ic_config.get("output", {}).get("artifacts", {}).get("path") - if path is not None and not path: - raise ValueError("output.artifacts.path cannot be empty") - return path - - def get_items_to_sign(self) -> List[str]: - """Return the list of items to sign from the image configuration YAML.""" - return ( - self.base_ic_config.get("output", {}).get("artifacts", {}).get("items", []) - ) - - -# IMPORTANT: THESE NAMES ARE EXPOSED IN THE CLI, MAKE SURE TO UPDATE ALL -# REFERENCES IF YOU CHANGE THEM! -@dataclass -class ArtifactManifest: - customizer_version: str - customizer_container: str - customizer_container_full: str = None - base_images: List[BaseImageManifest] = field(default_factory=list) - - def __post_init__(self): - if self.customizer_container_full is None: - self.customizer_container_full = self.customizer_container - if ":" not in self.customizer_container_full: - self.customizer_container_full = ( - f"{self.customizer_container}:{self.customizer_version}" - ) - - @classmethod - def kebab_fields(cls) -> List[str]: - """Return a list of fields in kebab-case.""" - return [f.name.replace("_", "-") for f in fields(cls)] - - def find_base_image(self, img: BaseImage) -> Optional[BaseImageManifest]: - """Find a base image by its name.""" - for base_image in self.base_images: - if base_image.image == img: - return base_image - return None diff --git a/tests/images/builder/builder.py b/tests/images/builder/builder.py deleted file mode 100644 index 3c066d0216..0000000000 --- a/tests/images/builder/builder.py +++ /dev/null @@ -1,501 +0,0 @@ -import copy -import logging -import multiprocessing -import multiprocessing.dummy -import re -import shutil -import yaml -import threading -import tempfile - -from contextlib import ExitStack -from cryptography.hazmat.backends import default_backend as crypto_default_backend -from cryptography.hazmat.primitives import serialization as crypto_serialization -from cryptography.hazmat.primitives.asymmetric import rsa, ed25519 -from pathlib import Path -from typing import List, Optional, Tuple - -from builder import ( - ArtifactManifest, - ImageConfig, - OutputFormat, - convert, - customize, - sign, -) -from builder.context_managers import temp_dir, temp_file - -logging.basicConfig(level=logging.INFO) -log = logging.getLogger(__name__) - -# Name of helper configuration file generated by Image Customizer under the same directory as -# output artifacts, when output.artifacts feature is used. This file is used to inject signed -# artifacts back into an image. Docs: -# https://microsoft.github.io/azure-linux-image-tools/imagecustomizer/api/configuration/injectFilesConfig.html. -INJECT_FILES_YAML = "inject-files.yaml" - - -def build_image( - *, - container_image: str, - image: ImageConfig, - output_dir: Path, - artifacts: ArtifactManifest, - clones: int = 1, - rpm_sources: List[Path] = [], - image_architecture: Optional[str] = None, - dry_run: bool = False, - force: bool = False, -): - """Build the image using the specified Image Customizer container.""" - - if not dry_run: - # Create the output directory if it doesn't exist - output_dir.mkdir(parents=True, exist_ok=True) - log.info(f"Output directory: {output_dir}") - - ssh_file = generate_ssh_keys( - output_dir, - image, - dry_run=dry_run, - ) - - # If image needs signing, generate a CA certificate - ca_tmp_dir, ca_nss_key_db = None, None - if image.get_output_artifacts_dir(): - ca_tmp_dir = Path(tempfile.mkdtemp(prefix="ca_")) - ca_nss_key_db = sign.generate_ca_certificate(ca_tmp_dir) - - try: - if clones == 1: - build_one( - container_image, - image, - output_dir, - rpm_sources, - image_architecture, - dry_run, - force, - ca_nss_key_db=ca_nss_key_db, - ) - else: - # Parallel execution - build_with_clones( - container_image, - image, - output_dir, - clones, - rpm_sources, - image_architecture, - dry_run, - force, - ca_nss_key_db=ca_nss_key_db, - ) - - # Publish the CA certificate to the output dir - if ca_nss_key_db and not dry_run: - sign.publish_ca_certificate(ca_nss_key_db, output_dir) - - finally: - if ssh_file: - # Clean up the SSH key file - ssh_file.unlink(missing_ok=True) - log.info(f"SSH key file {ssh_file} removed.") - - # Clean up the CA temporary directory - if ca_tmp_dir: - shutil.rmtree(ca_tmp_dir, ignore_errors=True) - log.info(f"CA temporary directory {ca_tmp_dir} removed.") - - -def build_one( - container_image: str, - image: ImageConfig, - output_dir: Path, - rpm_sources: List[Path] = [], - image_architecture: Optional[str] = None, - dry_run: bool = False, - force: bool = False, - ca_nss_key_db: Optional[Path] = None, -): - for dep in image.dependencies(): - if not dep.exists(): - raise FileNotFoundError(f"Dependency '{dep}' does not exist.") - - # Check if final image output exists, to see if building is necessary - output_file = output_dir / image.file_name() - if output_file.exists(): - log.info(f"Output file {output_file} already exists.") - if force: - log.info(f"Force build requested for '{image.id}', rebuilding.") - else: - dest_mod_time = output_file.stat().st_mtime - for dep in image.dependencies(): - if dep.is_dir(): - # Ignore directories - continue - if dep.stat().st_mtime > dest_mod_time: - log.info(f"Dependency '{dep}' is newer than output file.") - break - else: - log.info(f"Output file {output_file} is up to date.") - return output_file - - if image.image_customizer_convert: - # If 'convert' is requested, run Image Customizer convert subcommand - convert.convert_image( - container_image, - image.id, - image.base_image.path, - image.output_format.ic_name(), - output_file, - image_architecture, - dry_run, - ) - else: - # Copy RPM sources to standalone temporary directories - with ExitStack() as stack: - tmp_rpm_sources = [] - for rpm_src in rpm_sources: - # Create a temporary directory for each RPM source, delete with sudo because - # createrepo is run as root. - tmp = stack.enter_context( - temp_dir(prefix=f"rpm-{rpm_src.stem}-", sudo=True) - ) - tmp_rpm_sources.append(tmp) - log.debug(f"Copying RPM source {rpm_src} to {tmp}") - shutil.copytree(rpm_src, tmp, dirs_exist_ok=True) - - if image.get_output_artifacts_dir(): - # If config YAML contains output.artifacts, then need to output signed image. First, build - # an unsigned image; then, sign boot artifacts, and inject the signed copies back, to build - # a signed image as final output. - build_signed_image( - stack, - container_image, - image, - tmp_rpm_sources, - output_dir, - output_file, - ca_nss_key_db, - image_architecture, - dry_run, - ) - else: - # Otherwise, only build an unsigned image - customize.build_config( - container_image, - image.id, - image.full_yaml_path(), - image.base_image.path, - image.output_format.ic_name(), - output_file, - tmp_rpm_sources, - image_architecture, - dry_run, - ) - - output_file = output_dir / image.file_name() - log.info(f"Image '{image.id}' built successfully in {output_file}") - - -def build_with_clones( - container_image: str, - image: ImageConfig, - output_dir: Path, - clones: int, - rpm_sources: List[Path] = [], - image_architecture: Optional[str] = None, - dry_run: bool = False, - force: bool = False, - ca_nss_key_db: Optional[Path] = None, -): - # Build all the clones in parallel - build_clones( - container_image, - image, - output_dir, - clones, - rpm_sources, - image_architecture, - dry_run, - force, - ca_nss_key_db=ca_nss_key_db, - ) - - # In the future, when enabled by Prism, we want to build an intermediate - # image and then build the clones from that image. Leaving that code here - # for future reference. - - # # Extract kernel command line config - # with open(yaml_path, "r") as f: - # config = yaml.load(f, Loader=yaml.Loader) - # kernel_cmdline = ( - # config.get("os", {}).get("kernelCommandLine", {}).get("extraCommandLine", []) - # ) - - # # Run the build process once for the intermediate image. - # intermediate_img = build_one( - # build_runtime, - # f"{config_name}-intermediate", - # yaml_path, - # base_image, - # OutputFormat.RAW, - # output_dir, - # rpm_sources, - # dry_run, - # ) - - # log.info(f"Intermediate image created: {intermediate_img}") - - # cfg = tempfile.NamedTemporaryFile(mode="w", encoding="utf-8", suffix=".yaml") - # try: - # final_yaml = yaml.dump( - # { - # "storage": { - # "resetPartitionsUuidsType": "reset-all", - # }, - # "os": { - # "bootloader": { - # "resetType": "hard-reset", - # }, - # # Preserve the kernel command line from the original config - # "kernelCommandLine": { - # "extraCommandLine": kernel_cmdline, - # }, - # }, - # }, - # Dumper=yaml.Dumper, - # ) - # log.debug(f"Final YAML:\n{final_yaml}") - # cfg.write(final_yaml) - # cfg.flush() - # cfg.seek(0) - - # build_clones( - # build_runtime, - # config_name, - # Path(cfg.name), - # intermediate_img, - # img_format, - # output_dir, - # clones, - # rpm_sources, - # dry_run, - # ) - # finally: - # # Clean up the temporary files - # cfg.close() - # intermediate_img.unlink(missing_ok=True) - - -def build_clones( - container_image: str, - image: ImageConfig, - output_dir: Path, - clones: int, - rpm_sources: List[Path] = [], - image_architecture: Optional[str] = None, - dry_run: bool = False, - force: bool = False, - ca_nss_key_db: Optional[Path] = None, -): - def clone_image(image: ImageConfig, clone_index: int) -> ImageConfig: - img = copy.deepcopy(image) - img.set_suffix(str(clone_index)) - return img - - pool = multiprocessing.dummy.Pool(clones) - try: - log.info(f"Building {clones} clones of {image.name}") - results = pool.starmap( - build_one, - [ - ( - container_image, - clone_image(image, i), - output_dir, - rpm_sources, - image_architecture, - dry_run, - force, - ca_nss_key_db, - ) - for i in range(clones) - ], - ) - return results - finally: - pool.close() - pool.join() - - -def generate_ssh_keys( - output_dir: Path, - image: ImageConfig, - dry_run: bool = False, -) -> Optional[Path]: - """Generate SSH keys for the image.""" - if not image.ssh_key: - return - - # the artifact path is relative to the image's YAML file - artifact_path = image.full_yaml_path().parent / image.ssh_key - - if artifact_path.exists(): - log.warning( - f"SSH key file {artifact_path} already exists, not generating a new key!" - ) - return artifact_path - - filename = image.ssh_key.name - m = re.match(r"^id_(rsa|ed25519).pub$", filename) - if not m: - raise ValueError(f"Invalid SSH key name: {filename}") - - key_type = m.group(1) - - if key_type == "rsa": - key = rsa.generate_private_key( - backend=crypto_default_backend(), public_exponent=65537, key_size=2048 - ) - elif key_type == "ed25519": - key = ed25519.Ed25519PrivateKey.generate() - else: - raise ValueError(f"Unsupported SSH key type: {key_type}") - - private_key = key.private_bytes( - crypto_serialization.Encoding.PEM, - crypto_serialization.PrivateFormat.TraditionalOpenSSL, - crypto_serialization.NoEncryption(), - ) - - public_key = key.public_key().public_bytes( - crypto_serialization.Encoding.OpenSSH, crypto_serialization.PublicFormat.OpenSSH - ) - - if dry_run: - print(f"Dry run: would generate SSH keys for {image.name}") - print(f"Private key: {private_key.decode()}") - print(f"Public key: {public_key.decode()}") - return - - # Write the private key to a file - private_key_path = output_dir / f"key_{image.name}_private.pem" - public_key_path = output_dir / f"key_{image.name}_public.pub" - with open(private_key_path, "wb") as f: - f.write(private_key) - with open(public_key_path, "wb") as f: - f.write(public_key) - - with open(artifact_path, "wb") as f: - f.write(public_key) - log.info(f"SSH keys generated for {image.name}") - - return artifact_path - - -def build_signed_image( - stack: ExitStack, - container_image: str, - image: ImageConfig, - tmp_rpm_sources: List[Path], - output_dir: Path, - output_file: Path, - ca_nss_key_db: Path, - image_architecture: Optional[str] = None, - dry_run: bool = False, -): - - # Set up thread-specific YAML and output artifacts directory - working_yaml_path, output_artifacts_dir = setup_temp_yaml_and_dir(stack, image) - - # Construct the path to the unsigned image - unsigned_output_file = output_artifacts_dir / image.file_name_unsigned_raw() - log.debug( - f"Process with PID {threading.get_ident()} will write unsigned image and output artifacts to {output_artifacts_dir.absolute()}" - ) - - # Build the unsigned image - customize.build_config( - container_image, - image.id, - working_yaml_path, - image.base_image.path, - # Set output format of unsigned image to raw file since that's the format used - # internally by Image Customizer for file injection - OutputFormat.RAW.ic_name(), - unsigned_output_file, - tmp_rpm_sources, - image_architecture, - dry_run, - ) - - log.info(f"Building signed image: {output_file}") - - # Generate a leaf certificate for this clone using the CA certificate. The leaf certificate - # must be generated in the same NSS key database as the CA certificate. - leaf_key_name = sign.generate_leaf_certificate(ca_nss_key_db, image.id) - - # Construct full path of inject-files.yaml - inject_files_yaml_path = output_artifacts_dir / INJECT_FILES_YAML - # Sign boot artifacts that Image Customizer output when building the unsigned image - sign.sign_boot_artifacts( - ca_nss_key_db, - leaf_key_name, - inject_files_yaml_path, - output_artifacts_dir, - ) - - # Run inject-files via Image Customizer to inject the signed UKI back into the image - log.info( - f"Running imagecustomizer inject-files using YAML: {inject_files_yaml_path}" - ) - log.debug( - f"Contents of output artifacts directory: {output_artifacts_dir}:\n" - + "\n".join([str(p) for p in output_artifacts_dir.rglob("*") if p.is_file()]) - ) - customize.inject_files( - container_image, - inject_files_yaml_path, - unsigned_output_file, - image.output_format.ic_name(), - output_file, - dry_run, - ) - - -def setup_temp_yaml_and_dir( - stack: ExitStack, - image: ImageConfig, -) -> Tuple[Path, Path]: - """ - Sets up a temporary YAML file and output artifacts directory for building a signed image. - Returns the path to the temporary YAML file and the output artifacts directory. - """ - - # Figure out the directory of the main YAML file - yaml_dir = image.full_yaml_path().parent.absolute() - - # Create a temp dir inside yaml_dir to store the unsigned image and output artifacts - output_artifacts_dir = stack.enter_context( - temp_dir(prefix=f".{image.id}-", dir=yaml_dir, sudo=True) - ) - - # Now figure out the relative path from yaml_dir to output_artifacts_dir - tmp_rel_path = output_artifacts_dir.absolute().relative_to(yaml_dir) - - # Update the in-memory config, this is safe because every thread has its own copy of the YAML. - # We use the relative path because the path should be relative to the YAML location. - image.base_ic_config["output"]["artifacts"]["path"] = f"./{tmp_rel_path}" - - # Create a thread-specific copy of YAML in the same dir as main YAML - working_yaml_path = yaml_dir / f".config_{image.id}.yaml" - - with open(working_yaml_path, "w") as f: - yaml.safe_dump(image.base_ic_config, f) - - # Ensure the temp YAML file is deleted at the end - stack.enter_context(temp_file(working_yaml_path)) - - return working_yaml_path, output_artifacts_dir diff --git a/tests/images/builder/cli.py b/tests/images/builder/cli.py deleted file mode 100644 index 741f0c2396..0000000000 --- a/tests/images/builder/cli.py +++ /dev/null @@ -1,303 +0,0 @@ -import argparse -from enum import Enum -import logging -from pathlib import Path - -from typing import List - -from builder import ( - ImageConfig, - ArtifactManifest, - SystemArchitecture, - run, -) - - -logging.basicConfig(level=logging.INFO) -log = logging.getLogger("trident-testimages") - - -def positive_int(value) -> int: - ivalue = int(value) - if ivalue < 1: - raise argparse.ArgumentTypeError(f"{value} is an invalid positive int value") - return ivalue - - -class SubCommand(Enum): - LIST = "list" - DEPENDENCIES = "dependencies" - BUILD = "build" - LIST_FILES = "list-files" - SHOW_ARTIFACT = "show-artifact" - SHOW_IMAGE = "show-image" - DOWNLOAD_IMAGE = "download-image" - MATRIX = "matrix" - - -def init(configs: List[ImageConfig], artifacts: ArtifactManifest) -> None: - parser = argparse.ArgumentParser( - description="Get dependency list for specific image" - ) - subparsers = parser.add_subparsers( - help="Thing to do", dest="command", required=True, metavar="COMMAND" - ) - - setup_parser_list(subparsers) - setup_parser_show(subparsers, artifacts) - setup_subparser_dependencies(subparsers) - setup_parser_build(subparsers, configs, artifacts) - setup_parser_list_files(subparsers) - setup_parser_download_image(subparsers, artifacts) - setup_parser_matrix(subparsers) - setup_parser_image_info(subparsers, configs) - - args = parser.parse_args() - subcommand = SubCommand(args.command) - - run_cmd(configs, artifacts, subcommand, args) - - -def positive_int(value) -> int: - ivalue = int(value) - if ivalue < 1: - raise argparse.ArgumentTypeError(f"{value} is an invalid positive int value") - return ivalue - - -def setup_parser_list(subparsers: argparse._SubParsersAction) -> None: - parser_list = subparsers.add_parser( - SubCommand.LIST.value, help="List all image definitions" - ) - parser_list.add_argument( - "--filter-type", - default=None, - type=str, - help="Filter images by type", - ) - - -def setup_parser_show( - subparsers: argparse._SubParsersAction, - artifacts: ArtifactManifest, -) -> None: - parser_show = subparsers.add_parser( - SubCommand.SHOW_ARTIFACT.value, - help="Show default artifact configuration.", - ) - parser_show.set_defaults(artifacts=artifacts) - parser_show.add_argument( - "item", - choices=ArtifactManifest.kebab_fields(), - help="The item to show", - ) - - -def setup_subparser_dependencies( - subparsers: argparse._SubParsersAction, -) -> None: - parser_dependencies = subparsers.add_parser( - SubCommand.DEPENDENCIES.value, - help="List all dependencies for a specific image", - ) - parser_dependencies.add_argument("image", help="The image to get dependencies for") - - -def setup_parser_build( - subparsers: argparse._SubParsersAction, - configs: List[ImageConfig], - artifacts: ArtifactManifest, -) -> None: - parser_build = subparsers.add_parser( - SubCommand.BUILD.value, help="Build a specific image" - ) - - parser_build.set_defaults(artifacts=artifacts) - - parser_build.add_argument( - "image", help="The image to build", choices=[c.name for c in configs] - ) - parser_build.add_argument( - "--output-dir", - help="Where to write the output image.", - default=Path.cwd() / "artifacts", - type=Path, - ) - parser_build.add_argument( - "--dry-run", action="store_true", help="Do not run the command" - ) - parser_build.add_argument( - "--container", - default=artifacts.customizer_container_full, - type=str, - help="Configure Prism container image", - ) - parser_build.add_argument( - "--image-architecture", - default=None, - type=str, - help="Provide image architecture override for cross-compile", - ) - parser_build.add_argument( - "--clones", - type=positive_int, - default=1, - help="Number of clones of this image to create. " - "The default is 1, which means no cloning will be done. When more than 1 is requested, " - "the image file names will be suffixed with `_` for each clone, starting with 0." - " Clones are built in parallel, requesting multiple clones will become very resource " - "intensive.", - ) - parser_build.add_argument( - "-f", - "--force", - action="store_true", - help="Force the build even if the image already exists and it is up to date", - ) - parser_build.add_argument( - "--no-download", - action="store_false", - dest="download", - help="By default, the builder will try to download any missing artifacts, " - "this flag will disable that behavior.", - ) - - -def setup_parser_list_files( - subparsers: argparse._SubParsersAction, -) -> None: - parser_targets = subparsers.add_parser( - SubCommand.LIST_FILES.value, help="List all images as file targets" - ) - parser_targets.add_argument( - "--output-dir", - help="Where to write the output image.", - default=Path("build"), - type=Path, - ) - - -def setup_parser_download_image( - subparsers: argparse._SubParsersAction, - artifacts: ArtifactManifest, -) -> None: - parser_download_img = subparsers.add_parser( - SubCommand.DOWNLOAD_IMAGE.value, - help="Download a base image from the Azure DevOps feed", - ) - parser_download_img.set_defaults(artifacts=artifacts) - parser_download_img.add_argument( - "image", - help="The image to download", - choices=[c.image.name for c in artifacts.base_images], - ) - - -def setup_parser_matrix( - subparsers: argparse._SubParsersAction, -) -> None: - parser_matrix = subparsers.add_parser( - SubCommand.MATRIX.value, - help="Generate ADO Pipeline matrix for all images", - ) - parser_matrix.add_argument( - "-a", - "--arch", - help=f"Architecture to build for. '{SystemArchitecture.AMD64.value}' or " - f"'{SystemArchitecture.ARM64.value}'", - default=SystemArchitecture.AMD64.value, - type=SystemArchitecture, - ) - parser_matrix.add_argument( - "--indent", - help="Indentation for the matrix", - default=None, - type=int, - ) - - -def setup_parser_image_info( - subparsers: argparse._SubParsersAction, - configs: List[ImageConfig], -) -> None: - parser_image_info = subparsers.add_parser( - SubCommand.SHOW_IMAGE.value, - help="Show image information", - ) - parser_image_info.add_argument( - "image", - help="The image to show", - choices=[c.name for c in configs], - ) - parser_image_info.add_argument( - "field", - help="The field to show", - choices=ImageConfig.kebab_fields(), - ) - parser_image_info.add_argument( - "--devops-var", - help="Output the field as a DevOps variable with the given name", - default=None, - type=str, - ) - - -def run_cmd( - configs: List[ImageConfig], - artifacts: ArtifactManifest, - subcommand: SubCommand, - args: argparse.Namespace, -): - if subcommand == SubCommand.LIST: - run.list_configs( - configs=configs, - filter_type=args.filter_type, - ) - elif subcommand == SubCommand.DEPENDENCIES: - run.list_dependencies( - configs=configs, - name=args.image, - ) - elif subcommand == SubCommand.BUILD: - run.build( - artifacts=args.artifacts, - configs=configs, - name=args.image, - container_name=args.container, - output_dir=args.output_dir, - clones=args.clones, - image_architecture=args.image_architecture, - dry_run=args.dry_run, - force=args.force, - download=args.download, - ) - elif subcommand == SubCommand.LIST_FILES: - run.list_files( - configs=configs, - output_dir=args.output_dir, - ) - elif subcommand == SubCommand.SHOW_ARTIFACT: - run.show_artifact( - artifacts=args.artifacts, - item=args.item, - ) - elif subcommand == SubCommand.DOWNLOAD_IMAGE: - run.download_base_image( - artifacts=args.artifacts, - name=args.image, - ) - elif subcommand == SubCommand.MATRIX: - run.generate_matrix( - configs=configs, - arch=args.arch, - indent=args.indent, - ) - elif subcommand == SubCommand.SHOW_IMAGE: - run.show_image( - configs=configs, - name=args.image, - field_name=args.field, - devops_var=args.devops_var, - ) - else: - raise ValueError(f"Unknown subcommand: {subcommand}") diff --git a/tests/images/builder/context_managers.py b/tests/images/builder/context_managers.py deleted file mode 100644 index 8b957653f7..0000000000 --- a/tests/images/builder/context_managers.py +++ /dev/null @@ -1,63 +0,0 @@ -import logging -import os -import shutil -import subprocess -import tempfile -from typing import Optional - -from contextlib import contextmanager -from pathlib import Path - -logging.basicConfig(level=logging.DEBUG) -log = logging.getLogger(__name__) - - -@contextmanager -def temp_dir( - prefix: Optional[str] = None, dir: Optional[Path] = None, sudo: bool = False -): - """ - Context manager for temporary directory cleanup. - - Args: - prefix: Prefix for the temp directory name - dir: Parent directory in which to create the temp dir (default None, system temp dir) - sudo: Whether to use sudo for cleanup - - Yields: - Path: Path of temp dir - """ - parent = str(dir) if dir is not None else None - build_dir = tempfile.mkdtemp(prefix=prefix, dir=parent) - try: - yield Path(build_dir) - finally: - log.debug(f"Cleaning up build dir: {build_dir}") - if sudo: - log.debug(f"Removing build dir as root: {build_dir}") - subprocess.run(["sudo", "rm", "-rf", build_dir], check=True) - else: - shutil.rmtree(build_dir) - - -@contextmanager -def temp_file(path: Path, sudo: bool = False): - """ - Context manager that deletes the specified file upon exit. - - Args: - path: Path of the temporary file to remove - sudo: Whether to use sudo for cleanup - - Yields: - Path: Path of the temp file (optional, you can just yield) - """ - try: - yield path - finally: - if path.exists(): - log.debug(f"Cleaning up temp file: {path}") - if sudo: - subprocess.run(["sudo", "rm", "-f", str(path)], check=True) - else: - os.remove(path) diff --git a/tests/images/builder/convert.py b/tests/images/builder/convert.py deleted file mode 100644 index 20f2cc9e55..0000000000 --- a/tests/images/builder/convert.py +++ /dev/null @@ -1,87 +0,0 @@ -import logging -from pathlib import Path -import subprocess -import sys -from typing import Optional - -from builder import utils - -logging.basicConfig(level=logging.DEBUG) -log = logging.getLogger(__name__ if __name__ != "__main__" else "convert-image") - - -def convert_image( - container_image: str, - config_name: str, - base_image: Path, - img_format: str, - output_file: Path, - image_architecture: Optional[str] = None, - dry_run: bool = False, -): - """ - Convert an image to a `baremetal-image` using AZL Image Customizer `convert` via Docker container. - - Args: - container_image: Docker container image for Image Customizer - config_name: Name of Image Customizer config - base_image: Path to the base image file to customize - img_format: Output image format - output_file: Path where the customized image will be saved - dry_run: If True, only log the command without executing it - - Raises: - Exception: If the Image Customizer container execution fails - """ - log.info(f"Building '{config_name}'") - - base_cmd = [ - "docker", - "run", - "--rm", - "--privileged", - "-v", - f"/:{utils.HOST_PATH}", - "-v", - "/dev:/dev", - ] - - if image_architecture: - base_cmd.append("--platform") - base_cmd.append(image_architecture) - - base_cmd.extend( - [ - container_image, - "convert", - "--log-level", - "debug", - "--build-dir", - utils.BUILD_DIR, - "--image-file", - utils.build_path(base_image), - "--output-image-format", - img_format, - "--output-image-file", - utils.build_path(output_file), - ] - ) - - # Stringify all the args - base_cmd = [str(x) for x in base_cmd] - - cmd = " \\\n ".join(base_cmd) - - log.debug(f"Running:\n {cmd}") - - if dry_run: - log.info("Dry run, not executing command") - return - - # Run the command - try: - result = subprocess.run(base_cmd, stdout=sys.stdout, stderr=sys.stderr) - result.check_returncode() - except Exception as e: - log.error(f"Error building config '{config_name}': {e}") - raise e diff --git a/tests/images/builder/customize.py b/tests/images/builder/customize.py deleted file mode 100644 index 7fd4d00004..0000000000 --- a/tests/images/builder/customize.py +++ /dev/null @@ -1,169 +0,0 @@ -import logging -from pathlib import Path -import subprocess -import sys -from typing import List, Optional - -from builder import utils - -logging.basicConfig(level=logging.DEBUG) -log = logging.getLogger(__name__ if __name__ != "__main__" else "customize-image") - - -def build_config( - container_image: str, - config_name: str, - yaml_path: Path, - base_image: Path, - img_format: str, - output_file: Path, - rpm_sources: List[Path] = [], - image_architecture: Optional[str] = None, - dry_run: bool = False, -): - """ - Build a custom image using AZL Image Customizer via Docker container. - - Note: Image Customizer no longer supports running as a raw binary and must be - executed within a Docker container. This function orchestrates the containerized - build process. - - Args: - container_image: Docker container image for Image Customizer - config_name: Name of Image Customizer config - yaml_path: Path to the Image Customizer YAML configuration file - base_image: Path to the base image file to customize - img_format: Output image format - output_file: Path where the customized image will be saved - rpm_sources: List of paths to additional RPM source directories - dry_run: If True, only log the command without executing it - - Raises: - Exception: If the Image Customizer container execution fails - """ - log.info(f"Building '{config_name}'") - log.info(f"Using YAML: {yaml_path}") - - base_cmd = [ - "docker", - "run", - "--rm", - "--privileged", - "-v", - f"/:{utils.HOST_PATH}", - "-v", - "/dev:/dev", - ] - - if image_architecture: - base_cmd.append("--platform") - base_cmd.append(image_architecture) - - base_cmd.extend( - [ - container_image, - "--config-file", - utils.build_path(yaml_path), - "--log-level", - "debug", - "--build-dir", - utils.BUILD_DIR, - "--image-file", - utils.build_path(base_image), - "--output-image-format", - img_format, - "--output-image-file", - utils.build_path(output_file), - ] - ) - - for _, rpm in enumerate(rpm_sources): - base_cmd.append("--rpm-source") - base_cmd.append(utils.build_path(rpm)) - - # Stringify all the args - base_cmd = [str(x) for x in base_cmd] - - cmd = " \\\n ".join(base_cmd) - - log.debug(f"Running:\n {cmd}") - - if dry_run: - log.info("Dry run, not executing command") - return - - # Run the command - try: - result = subprocess.run(base_cmd, stdout=sys.stdout, stderr=sys.stderr) - result.check_returncode() - except Exception as e: - log.error(f"Error building config '{config_name}': {e}") - raise e - - -def inject_files( - container_image: str, - inject_files_yaml_path: Path, - unsigned_image_file: Path, - img_format: str, - output_image_file: Path, - dry_run: bool = False, -): - """ - Run the imagecustomizer inject-files command to inject files into the image. - - Args: - container_image: Image Customizer container image to run the command in - inject_files_yaml_path: Path to the inject-files YAML configuration file listing the signed - and unsigned sources - unsigned_image_file: Path to the unsigned image - img_format: Format of the output image - output_image_file: Path to the signed output image - dry_run: If True, do not run the command - - Raises: - Exception: If docker command fails. - """ - base_cmd = [ - "docker", - "run", - "--rm", - "--privileged", - "-v", - f"/:{utils.HOST_PATH}", - "-v", - "/dev:/dev", - container_image, - "inject-files", - "--config-file", - utils.build_path(inject_files_yaml_path), - "--log-level", - "debug", - "--build-dir", - utils.BUILD_DIR, - "--image-file", - utils.build_path(unsigned_image_file), - "--output-image-format", - img_format, - "--output-image-file", - utils.build_path(output_image_file), - ] - - # Stringify all the args - base_cmd = [str(x) for x in base_cmd] - - cmd = " \\\n ".join(base_cmd) - - log.debug(f"Running:\n {cmd}") - - if dry_run: - log.info("Dry run, not executing command") - return - - # Run the command - try: - result = subprocess.run(base_cmd, stdout=sys.stdout, stderr=sys.stderr) - result.check_returncode() - except Exception as e: - log.error(f"Error running inject-files using YAML: {inject_files_yaml_path}") - raise e diff --git a/tests/images/builder/download.py b/tests/images/builder/download.py deleted file mode 100644 index 6f9db4c9f0..0000000000 --- a/tests/images/builder/download.py +++ /dev/null @@ -1,41 +0,0 @@ -from pathlib import Path -import shutil -import subprocess -import tempfile - -from builder import BaseImageManifest - - -def download_base_image(image: BaseImageManifest) -> None: - """Download the base image from MCR.""" - with tempfile.TemporaryDirectory() as tempdir: - subprocess.run( - [ - "oras", - "pull", - f"mcr.microsoft.com/azurelinux/3.0/image/{image.image.name}:latest", - "--output", - tempdir, - "--platform", - "linux/amd64", - ], - check=True, - ) - - # Find and copy the .vhdx file to the target location - tempdir_path = Path(tempdir) - vhdx_files = list(tempdir_path.glob("*.vhdx")) - if not vhdx_files: - raise RuntimeError( - f"No .vhdx file found in downloaded image for {image.image.name}" - ) - if len(vhdx_files) > 1: - raise RuntimeError( - f"Multiple .vhdx files found in downloaded image for {image.image.name}" - ) - - # Ensure the parent directory exists - image.image.path.parent.mkdir(parents=True, exist_ok=True) - - # Copy the .vhdx file to the target location - shutil.copy2(vhdx_files[0], image.image.path) diff --git a/tests/images/builder/run.py b/tests/images/builder/run.py deleted file mode 100644 index d465beb2f2..0000000000 --- a/tests/images/builder/run.py +++ /dev/null @@ -1,175 +0,0 @@ -import logging -from pathlib import Path -import json -from typing import List, Optional - -from builder import ImageConfig, RpmSources, ArtifactManifest -from .builder import build_image -from .convert import convert_image -from . import download - -log = logging.getLogger(__name__) - - -def find_image(configs: List[ImageConfig], name: str) -> ImageConfig: - for config in configs: - if config.name == name: - return config - raise ValueError(f"Image '{name}' is not defined") - - -def list_configs( - *, configs: List[ImageConfig], filter_type: Optional[str] = None -) -> None: - for config in configs: - if filter_type is None or config.output_format.ext() == filter_type: - print(config.name) - - -def list_files(*, configs: List[ImageConfig], output_dir: Path) -> None: - for config in configs: - print(output_dir / config.file_name()) - - -def list_dependencies(*, configs: List[ImageConfig], name: str) -> None: - image = find_image(configs, name) - for dep in image.dependencies(): - print(dep) - - -def show_artifact(*, artifacts: ArtifactManifest, item: str) -> None: - item = getattr(artifacts, item.replace("-", "_")) - if isinstance(item, str): - print(item) - elif isinstance(item, list): - for i in item: - print(i) - else: - raise ValueError(f"Unknown item type: {type(item)}") - - -def show_image( - *, - configs: List[ImageConfig], - name: str, - field_name: str, - devops_var: Optional[str] = None, -) -> None: - image = find_image(configs, name) - field = getattr(image, field_name.replace("-", "_"), None) - - out: str = None - - if field is None: - raise ValueError(f"Field '{field_name}' not found in image '{name}'") - if isinstance(field, str): - out = field - elif isinstance(field, list): - out = "\n".join([str(i) for i in field]) - elif hasattr(field, "__str__") and callable(field.__str__): - out = str(field) - else: - raise ValueError(f"Unknown field type: {type(field)}") - - if devops_var: - print(f"##vso[task.setvariable variable={devops_var}]{out}") - else: - print(out) - - -def build( - *, - artifacts: ArtifactManifest, - configs: List[ImageConfig], - name: str, - container_name: str, - output_dir: Path, - clones: int, - dry_run: bool, - force: bool, - image_architecture: Optional[str] = None, - download: bool = True, -) -> None: - image = find_image(configs, name) - log.info(f"Building image '{image.name}'") - - container_image: Optional[str] = container_name - if container_image is None: - log.error("Image Customizer container image is required") - exit(1) - - if image.image_customizer_convert: - # If 'convert' is requested, run Image Customizer convert subcommand - convert_image( - container_image, - image.id, - image.base_image.path, - image.output_format.ic_name(), - output_dir / image.file_name(), - image_architecture, - dry_run, - ) - else: - rpm_sources: List[Path] = [] - if image.requires_trident: - rpm_sources.append(RpmSources.TRIDENT.path()) - if image.requires_dhcp: - rpm_sources.append(RpmSources.DHCP.path()) - - rpm_overrides_path = RpmSources.RPM_OVERRIDES.path() - if rpm_overrides_path.exists(): - rpm_sources.append(rpm_overrides_path) - - if not image.base_image.path.exists(): - if download: - log.info( - f"Downloading base image to '{image.base_image.path}'" - " (use --no-download to skip this step)" - ) - - else: - log.error(f"Base image '{image.base_image.path}' does not exist.") - exit(1) - - build_image( - container_image=container_image, - image=image, - output_dir=output_dir, - artifacts=artifacts, - clones=clones, - rpm_sources=rpm_sources, - image_architecture=image_architecture, - dry_run=dry_run, - force=force, - ) - - -def download_base_image( - *, - artifacts: ArtifactManifest, - name: str, -) -> None: - image_manifest = next( - (img for img in artifacts.base_images if img.image.name == name), None - ) - if image_manifest is None: - raise ValueError(f"Image '{name}' not found in artifacts") - log.info(f"Downloading base image '{name}' to '{image_manifest.image.path}'") - download.download_base_image(image_manifest) - - -def generate_matrix( - *, - configs: List[ImageConfig], - arch: str, - indent: Optional[int] = None, -) -> None: - matrix = {} - for config in configs: - if config.architecture == arch: - matrix[config.name] = { - "image_name": config.name, - "base_image": config.base_image.name, - "img_file": str(config.base_image.path), - } - print(json.dumps(matrix, indent=indent)) diff --git a/tests/images/builder/sign.py b/tests/images/builder/sign.py deleted file mode 100644 index 0045feef8e..0000000000 --- a/tests/images/builder/sign.py +++ /dev/null @@ -1,474 +0,0 @@ -import logging -import os -import re -import subprocess -import yaml -import threading - -from pathlib import Path -from typing import Optional - -from builder.context_managers import temp_dir - - -logging.basicConfig(level=logging.DEBUG) -log = logging.getLogger(__name__) - -# Common name of CA (Certificate Authority) certificate -CA_CN = "Trident Testing CA" - -# Name of CA certificate -CA_NAME = "trident_ca" - -# Common name of signing key -KEY_CN = "Trident Testing Signing Key" - -# Name of signing key -KEY_NAME = "trident_signing_key" - -# Directory for the NSS key database -NSS_KEY_DB = "db" - -# Name of PKCS#12 archive file that contains private key and signing certificate -PKCS12_ARCH_FILE = "signer.p12" - -# IMAGE CUSTOMIZER ARTIFACT NAMES -IC_ARTIFACT_NAME_UKIS = "ukis" -IC_ARTIFACT_NAME_SHIM = "shim" -IC_ARTIFACT_NAME_SYSTEMD_BOOT = "systemd-boot" -IC_ARTIFACT_NAME_VERITY_HASH = "verity-hash" - -_KERNEL_FLAG_SUPPORTED = None -_PESIGN_CERT_ARG = None - - -def _efikeygen_supports_kernel_flag() -> bool: - global _KERNEL_FLAG_SUPPORTED - - if _KERNEL_FLAG_SUPPORTED is None: - result = subprocess.run( - ["efikeygen", "--help"], capture_output=True, text=True, check=False - ) - help_output = f"{result.stdout}\n{result.stderr}" - _KERNEL_FLAG_SUPPORTED = "--kernel" in help_output - log.debug(f"efikeygen --kernel support: {_KERNEL_FLAG_SUPPORTED}") - - return _KERNEL_FLAG_SUPPORTED - - -def _get_pesign_certificate_arg() -> str: - global _PESIGN_CERT_ARG - - if _PESIGN_CERT_ARG is None: - result = subprocess.run( - ["pesign", "--help"], capture_output=True, text=True, check=False - ) - help_output = f"{result.stdout}\n{result.stderr}" - _PESIGN_CERT_ARG = ( - "--certficate" if "--certficate" in help_output else "--certificate" - ) - log.debug(f"Using pesign certificate argument: {_PESIGN_CERT_ARG}") - - return _PESIGN_CERT_ARG - - -def generate_ca_certificate(tmp_dir: Path): - """ - Generates a single CA certificate and key that will be used to sign all leaf certificates. - This should be called once per build process. - - Args: - tmp_dir: Path to the temporary directory where the CA key is stored - - Returns: - ca_nss_key_db: Full path to the NSS key database - - Raises: - Exception: If certutil or efikeygen fails. - """ - ca_nss_key_db = tmp_dir / NSS_KEY_DB - os.makedirs(ca_nss_key_db, exist_ok=True) - log.debug(f"Initializing CA NSS key database in {ca_nss_key_db}") - - # Initialize a NSS key database for CA - subprocess.run( - ["certutil", "-N", "-d", str(ca_nss_key_db), "--empty-password"], check=True - ) - - # Generate CA certificate - subprocess.run( - [ - "efikeygen", - "-C", - "-S", - "-n", - CA_NAME, - "-c", - f"CN={CA_CN}", - "-d", - str(ca_nss_key_db), - ], - check=True, - ) - - log.info(f"Generated CA certificate {CA_NAME} at {ca_nss_key_db}") - return ca_nss_key_db - - -def generate_leaf_certificate(ca_nss_key_db: Path, id: str): - """ - Generates a leaf certificate signed by the CA for a specific image clone. - - Args: - ca_nss_key_db: Path to the CA's NSS key database - id: ID of the signing key for this image clone - - Returns: - leaf_key_name: Name of the leaf key that was generated - - Raises: - Exception: If certificate generation fails. - """ - # Generate unique leaf key name - leaf_key_name = f"{KEY_NAME}_{id}" - - cmd = [ - "efikeygen", - "-n", - leaf_key_name, - "-c", - f"CN={KEY_CN} {id}", - "--signer", - CA_NAME, - "-d", - str(ca_nss_key_db), - ] - - if _efikeygen_supports_kernel_flag(): - cmd.append("--kernel") - - # Generate signing key/cert, signed by CA in the shared DB - subprocess.run(cmd, check=True) - - log.debug( - f"Process with PID {threading.get_ident()} generated leaf key {leaf_key_name} in {ca_nss_key_db}" - ) - return leaf_key_name - - -def publish_ca_certificate(ca_nss_key_db: Path, output_dir: Path): - """ - Extract and publish the CA certificate that can validate all leaf certificates. - - Args: - ca_nss_key_db: Path to the CA's NSS key database - output_dir: Directory where the CA certificate will be published - - Raises: - Exception: If any shell command fails. - """ - # Export PKCS#12 from NSS DB - key_path = ca_nss_key_db / PKCS12_ARCH_FILE - subprocess.run( - [ - "pk12util", - "-d", - str(ca_nss_key_db), - "-n", - CA_NAME, - "-o", - str(key_path), - "-W", - "", - ], - check=True, - ) - - # Extract certificate from PKCS#12 file, no private key - ca_cert_path = output_dir / "ca_cert.pem" - subprocess.run( - [ - "openssl", - "pkcs12", - "-in", - str(key_path), - "-out", - str(ca_cert_path), - "-nokeys", - "-passin", - "pass:", - ], - check=True, - ) - - log.info(f"CA Certificate published to {ca_cert_path}") - - -def sign_boot_artifacts( - ca_nss_key_db: Path, - leaf_key_name: str, - inject_files_yaml_path: Path, - output_artifacts_dir: Path, -): - """ - Signs unsigned boot artifacts listed in inject-files.yaml and produces signed boot artifacts. - - Args: - ca_nss_key_db: Path to the NSS key database for the CA certificate - leaf_key_name: Name of the leaf certificate - inject_files_yaml_path: Full path to inject-files.yaml - output_artifacts_dir: Dir where artifacts are output by Image Customizer - """ - with open(inject_files_yaml_path, "r") as f: - data = f.read() - - log.debug(f"Contents of {inject_files_yaml_path}:\n{data}") - inject_files_config = yaml.safe_load(data) - - for entry in inject_files_config.get("injectFiles", []): - artifact_type = entry.get("type", "") - signed_path_str = entry.get("source") - unsigned_path_str = entry.get("unsignedSource", "") - - if not signed_path_str: - raise RuntimeError(f"Missing source in inject-files entry: {entry}") - - if not unsigned_path_str: - # MIC v1.1+ uses the same path for unsigned and signed files. - unsigned_path_str = signed_path_str - - signed_rel_path = ( - signed_path_str[2:] if signed_path_str.startswith("./") else signed_path_str - ) - unsigned_rel_path = ( - unsigned_path_str[2:] - if unsigned_path_str.startswith("./") - else unsigned_path_str - ) - signed_path = output_artifacts_dir.absolute() / signed_rel_path - unsigned_path = output_artifacts_dir.absolute() / unsigned_rel_path - - if not artifact_type: - artifact_type = get_artifact_type_from_name(unsigned_path.name) - - log.info( - f"Signing file of type '{artifact_type}' at {unsigned_path} to {signed_path}" - ) - if artifact_type == IC_ARTIFACT_NAME_VERITY_HASH: - sign_verity_hash( - ca_nss_key_db, - leaf_key_name, - unsigned_path, - signed_path, - ) - else: - sign_pe_artifact( - ca_nss_key_db, - leaf_key_name, - unsigned_path, - signed_path, - ) - - -def get_artifact_type_from_name(name: str) -> Optional[str]: - if re.match(r"vmlinuz.*\.efi", name): - return IC_ARTIFACT_NAME_UKIS - if re.match(r"bootx64\.efi", name): - return IC_ARTIFACT_NAME_SHIM - if re.match(r"systemd-bootx64\.efi", name): - return IC_ARTIFACT_NAME_SYSTEMD_BOOT - if re.match(r".*hash.*", name): - return IC_ARTIFACT_NAME_VERITY_HASH - - return None - - -def sign_verity_hash( - ca_nss_key_db: Path, - leaf_key_name: str, - unsigned_verity_hash_path: Path, - signed_verity_hash_path: Path, -): - """ - Sign the verity hash file using the signing key. - - Args: - ca_nss_key_db: Path to the NSS key database for the CA certificate - leaf_key_name: Name of the leaf certificate - unsigned_verity_hash_path: Path to the unsigned verity hash file - signed_verity_hash_path: Path to the signed verity hash file - - Raises: - Exception: If pesign fails. - """ - log.debug( - f"Process with PID {threading.get_ident()} is signing {unsigned_verity_hash_path}" - ) - - signed_verity_hash_path.parent.mkdir(parents=True, exist_ok=True) - signed_verity_hash_path.parent.chmod(0o700) - - with temp_dir(sudo=True) as tmpdir: - tmp_signed_artifact = ( - tmpdir - / f"{unsigned_verity_hash_path.stem}.signed{unsigned_verity_hash_path.suffix}" - ) - tmp_unsigned_artifact = ( - tmpdir - / f"{unsigned_verity_hash_path.stem}.unsigned{unsigned_verity_hash_path.suffix}" - ) - key_path = tmpdir / "key.p12" - key_crt_path = tmpdir / "key.crt" - - subprocess.run( - ["sudo", "cp", str(unsigned_verity_hash_path), str(tmp_unsigned_artifact)], - check=True, - ) - - log.debug(f"Exporting PKCS12 key to {key_path}") - subprocess.run( - [ - "pk12util", - "-d", - str(ca_nss_key_db), - "-n", - leaf_key_name, - "-o", - str(key_path), - "-W", - "", - ], - check=True, - ) - - log.debug(f"Extracting cert from PKCS12 key to {key_crt_path}") - subprocess.run( - [ - "openssl", - "pkcs12", - "-in", - str(key_path), - "-out", - str(key_crt_path), - "-clcerts", - "-nodes", - "-passin", - "pass:", - ], - check=True, - ) - - log.debug( - f"Signing verity hash file at {tmp_unsigned_artifact} using openssl smime" - ) - subprocess.run( - [ - "openssl", - "smime", - "-sign", - "-noattr", - "-binary", - "-in", - str(tmp_unsigned_artifact), - "-signer", - str(key_crt_path), - "-passin", - "pass:", - "-outform", - "der", - "-out", - str(tmp_signed_artifact), - ], - check=True, - ) - - try: - result = subprocess.run( - [ - "openssl", - "pkcs7", - "-inform", - "DER", - "-in", - str(tmp_signed_artifact), - "-print_certs", - "-text", - ], - check=True, - capture_output=True, - text=True, - ) - log.debug(f"Certs for {unsigned_verity_hash_path}:\n{result.stdout}") - except subprocess.CalledProcessError as e: - log.error(f"Failed to print certs for {unsigned_verity_hash_path}: {e}") - - subprocess.run( - ["sudo", "cp", str(tmp_signed_artifact), str(signed_verity_hash_path)], - check=True, - ) - - log.debug(f"Signed verity-hash artifact generated at {signed_verity_hash_path}") - - -def sign_pe_artifact( - ca_nss_key_db: Path, - leaf_key_name: str, - unsigned_artifact_path: Path, - signed_artifact_path: Path, -): - """ - Sign the artifact using the signing key. - - Args: - ca_nss_key_db: Path to the NSS key database for the CA certificate - leaf_key_name: Name of the leaf certificate - unsigned_artifact_path: Path to the unsigned artifact - signed_artifact_path: Path to the signed artifact - - Raises: - Exception: If pesign fails. - """ - log.debug( - f"Process with PID {threading.get_ident()} is signing {unsigned_artifact_path} to {signed_artifact_path}" - ) - - with temp_dir(sudo=True) as tmpdir: - tmp_signed_artifact = ( - tmpdir - / f"{unsigned_artifact_path.stem}.signed{unsigned_artifact_path.suffix}" - ) - tmp_unsigned_artifact = ( - tmpdir - / f"{unsigned_artifact_path.stem}.unsigned{unsigned_artifact_path.suffix}" - ) - - subprocess.run( - ["sudo", "cp", str(unsigned_artifact_path), str(tmp_unsigned_artifact)], - check=True, - ) - - cert_arg = _get_pesign_certificate_arg() - - subprocess.run( - [ - "pesign", - "--certdir", - str(ca_nss_key_db), - cert_arg, - leaf_key_name, - "--sign", - "--in", - str(tmp_unsigned_artifact), - "--out", - str(tmp_signed_artifact), - "--force", - ], - check=True, - ) - - subprocess.run( - ["sudo", "cp", str(tmp_signed_artifact), str(signed_artifact_path)], - check=True, - ) - - log.debug(f"Artifact signed to {signed_artifact_path}") diff --git a/tests/images/builder/utils.py b/tests/images/builder/utils.py deleted file mode 100644 index 33692361ee..0000000000 --- a/tests/images/builder/utils.py +++ /dev/null @@ -1,24 +0,0 @@ -from pathlib import Path - -BUILD_DIR = "/tmp" -HOST_PATH = Path("/host") - - -def build_path(path: Path) -> Path: - """ - Convert a host filesystem path to its corresponding path inside the Docker container. - - The Docker container mounts the host's root filesystem at /host, so this function - transforms absolute host paths like '/home/user/file.txt' to container paths - like '/host/home/user/file.txt'. - - Args: - path: Absolute or relative path on the host filesystem - - Returns: - Path that can be used inside the Docker container to access the same file - - Example: - build_path(Path("/home/user/config.yaml")) -> Path("/host/home/user/config.yaml") - """ - return HOST_PATH / path.absolute().relative_to(Path("/")) diff --git a/tests/images/testimages.py b/tests/images/testimages.py deleted file mode 100755 index a5137a2114..0000000000 --- a/tests/images/testimages.py +++ /dev/null @@ -1,267 +0,0 @@ -#!/usr/bin/env python3 - -from pathlib import Path -from typing import List - -from builder import ( - ArtifactManifest, - BaseImage, - BaseImageManifest, - ImageConfig, - OutputFormat, - SystemArchitecture, - cli, -) - -# # # # # # # # # # # # # # # # # # # -# DEFAULT CUSTOMIZER VERSION # -# # -# The version of Image Customizer # -# to use by default when building # -# images. # -# # # # # # # # # # # # # # # # # # # -DEFAULT_IMAGE_CUSTOMIZER_VERSION = "latest" - - -DEFINED_IMAGES: List[ImageConfig] = [ - # Installer images - ImageConfig( - "trident-installer", - config="trident-installer", - output_format=OutputFormat.ISO, - ), - ImageConfig( - "trident-split-installer", - config="trident-installer", - config_file="base/baseimg-split.yaml", - output_format=OutputFormat.ISO, - ), - ImageConfig( - "trident-installer-arm64", - config="trident-installer", - output_format=OutputFormat.ISO, - base_image=BaseImage.CORE_ARM64, - architecture=SystemArchitecture.ARM64, - ), - ImageConfig( - "trident-container-installer", - config="trident-container-installer", - output_format=OutputFormat.ISO, - requires_trident=False, - ), - ImageConfig( - "trident-direct-streaming-installer-amd64", - config="trident-installer", - config_file="base/baseimg-direct-streaming.yaml", - output_format=OutputFormat.ISO, - ), - ImageConfig( - "trident-direct-streaming-installer-arm64", - config="trident-installer", - config_file="base/baseimg-direct-streaming.yaml", - output_format=OutputFormat.ISO, - base_image=BaseImage.CORE_ARM64, - architecture=SystemArchitecture.ARM64, - ), - # Test images - ImageConfig( - "trident-functest", - output_format=OutputFormat.QCOW2, - requires_trident=False, - ), - ImageConfig("trident-testimage"), - ImageConfig( - "trident-testimage-arm64", - config="trident-testimage", - base_image=BaseImage.CORE_ARM64, - architecture=SystemArchitecture.ARM64, - ), - ImageConfig("trident-verity-testimage"), - ImageConfig( - "trident-usrverity-testimage", - config="trident-verity-testimage", - config_file="usr/host.yaml", - requires_ukify=True, - ), - ImageConfig( - "trident-container-verity-testimage", - config="trident-verity-testimage", - config_file="base/baseimg-container.yaml", - requires_trident=False, - ), - ImageConfig( - "trident-container-usrverity-testimage", - config="trident-verity-testimage", - config_file="usr/container.yaml", - requires_ukify=True, - requires_trident=False, - ), - ImageConfig( - "trident-container-testimage", - requires_trident=False, - ), - # Direct streaming images - ImageConfig( - "azurelinux-direct-streaming-testimage-amd64", - config="azurelinux-direct-streaming-testimage", - output_format=OutputFormat.BAREMETAL_IMAGE, - ), - ImageConfig( - "azurelinux-direct-streaming-testimage-arm64", - config="azurelinux-direct-streaming-testimage", - output_format=OutputFormat.BAREMETAL_IMAGE, - base_image=BaseImage.CORE_ARM64, - architecture=SystemArchitecture.ARM64, - ), - # AZL installer - ImageConfig( - "azl-installer", - config_file=Path("installer-iso.yaml"), - output_format=OutputFormat.ISO, - requires_trident=True, - extra_dependencies=[ - Path("tests/images/azl-installer/iso/bin/liveinstaller"), - Path("tests/images/azl-installer/iso/images/trident-testimage.cosi"), - ], - ), - # VM test images - ImageConfig( - "trident-vm-grub-testimage", - base_image=BaseImage.QEMU_GUEST, - config="trident-vm-testimage", - config_file="base/updateimg-grub.yaml", - ssh_key="files/id_rsa.pub", - ), - ImageConfig( - "trident-vm-grub-verity-testimage", - base_image=BaseImage.QEMU_GUEST, - config="trident-vm-testimage", - config_file="base/updateimg-grub-verity.yaml", - ssh_key="files/id_rsa.pub", - ), - ImageConfig( - "trident-vm-root-verity-testimage", - base_image=BaseImage.QEMU_GUEST, - config="trident-vm-testimage", - config_file="base/baseimg-root-verity.yaml", - requires_ukify=True, - ssh_key="files/id_rsa.pub", - ), - ImageConfig( - "trident-vm-usr-verity-testimage", - base_image=BaseImage.QEMU_GUEST, - config="trident-vm-testimage", - config_file="base/baseimg-usr-verity.yaml", - requires_ukify=True, - ssh_key="files/id_rsa.pub", - ), - ImageConfig( - "trident-vm-acl-agent-update-testimage", - base_image=BaseImage.QEMU_GUEST, - config="trident-vm-testimage", - config_file="base/updateimg-acl-agent.yaml", - requires_ukify=True, - ssh_key="files/id_rsa.pub", - ), - ImageConfig( - "trident-vm-grub-verity-azure-testimage", - base_image=BaseImage.CORE_SELINUX, - config="trident-vm-testimage", - config_file="base/updateimg-grub-verity-azure.yaml", - ), - ImageConfig( - "trident-vm-grub-testimage-arm64", - base_image=BaseImage.CORE_ARM64, - config="trident-vm-testimage", - config_file="base/updateimg-grub.yaml", - ssh_key="files/id_rsa.pub", - architecture=SystemArchitecture.ARM64, - ), - ImageConfig( - "trident-vm-grub-verity-testimage-arm64", - base_image=BaseImage.CORE_ARM64, - config="trident-vm-testimage", - config_file="base/updateimg-grub-verity.yaml", - ssh_key="files/id_rsa.pub", - architecture=SystemArchitecture.ARM64, - ), - ImageConfig( - "ubuntu-direct-streaming-testimage-2204-amd64", - base_image=BaseImage.UBUNTU_2204_AMD64, - output_format=OutputFormat.BAREMETAL_IMAGE, - image_customizer_convert=True, - requires_trident=False, - ), - ImageConfig( - "ubuntu-direct-streaming-testimage-2204-arm64", - base_image=BaseImage.UBUNTU_2204_ARM64, - output_format=OutputFormat.BAREMETAL_IMAGE, - architecture=SystemArchitecture.ARM64, - image_customizer_convert=True, - requires_trident=False, - ), - ImageConfig( - "ubuntu-direct-streaming-testimage-2404-amd64", - base_image=BaseImage.UBUNTU_2404_AMD64, - output_format=OutputFormat.BAREMETAL_IMAGE, - image_customizer_convert=True, - requires_trident=False, - ), - ImageConfig( - "ubuntu-direct-streaming-testimage-2404-arm64", - base_image=BaseImage.UBUNTU_2404_ARM64, - output_format=OutputFormat.BAREMETAL_IMAGE, - architecture=SystemArchitecture.ARM64, - image_customizer_convert=True, - requires_trident=False, - ), - ImageConfig( - "gb200-direct-streaming-testimage-2404-arm64", - base_image=BaseImage.GB200_2404_ARM64, - output_format=OutputFormat.BAREMETAL_IMAGE, - architecture=SystemArchitecture.ARM64, - image_customizer_convert=True, - requires_trident=False, - ), -] - -ARTIFACTS = ArtifactManifest( - customizer_version=DEFAULT_IMAGE_CUSTOMIZER_VERSION, - customizer_container="mcr.microsoft.com/azurelinux/imagecustomizer", - base_images=[ - BaseImageManifest( - image=BaseImage.BAREMETAL, - package_name="baremetal_vhdx-3.0-stable", - version="*", - ), - BaseImageManifest( - image=BaseImage.CORE_ARM64, - package_name="core_vhdx-arm64-3.0-stable", - version="*", - ), - BaseImageManifest( - image=BaseImage.CORE_SELINUX, - package_name="core_selinux_vhdx-3.0-stable", - version="*", - ), - BaseImageManifest( - image=BaseImage.QEMU_GUEST, - package_name="qemu_guest_vhdx-3.0-stable", - version="*", - ), - BaseImageManifest( - image=BaseImage.MINIMAL, - package_name="minimal_vhdx-3.0-stable", - version="*", - ), - ], -) - -if __name__ == "__main__": - import os - - # Change to the base directory in the trident repo - os.chdir(Path(__file__).parent.parent.parent) - - # Run the CLI - cli.init(DEFINED_IMAGES, ARTIFACTS) diff --git a/tests/images/trident-container-installer/README.md b/tests/images/trident-container-installer/README.md deleted file mode 100644 index 19ebcd492c..0000000000 --- a/tests/images/trident-container-installer/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# Trident Container Installer ISO Test Image - -This image is used in the Trident test pipelines. At startup, it loads a -specified version of a container, which must be provided. Trident runs from -this container. The configuration for Trident can be patched into the ISO by -replacing it with the placeholder file (config-placeholder). - -This image does **not** include Trident RPMs — Trident is loaded from a -container at boot. - -## Building - -From the repo root, run: - -```bash -python3 tests/images/testimages.py build trident-container-installer -``` - -Output is written to `artifacts/trident-container-installer.iso` by default. -Use `--output-dir ` to change the output location. diff --git a/tests/images/trident-container-installer/base/baseimg.yaml b/tests/images/trident-container-installer/base/baseimg.yaml deleted file mode 100644 index 1e1dfded5a..0000000000 --- a/tests/images/trident-container-installer/base/baseimg.yaml +++ /dev/null @@ -1,81 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - maxSize: 4G - partitions: - - id: esp - type: esp - size: 8M - - - id: rootfs - size: grow - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: rootfs - type: ext4 - mountPoint: - path: / - -os: - bootloader: - resetType: hard-reset - hostname: trident-container-mos-testimg - - packages: - install: - - curl - - device-mapper - - dnf - - docker-cli - - iproute - - iptables - - mdadm - - moby-engine - - openssh-server - - selinux-policy - - squashfs-tools - - tar - - vim - - additionalFiles: - - source: files/getty@.service - destination: /usr/lib/systemd/system/getty@.service - - source: files/serial-getty@.service - destination: /usr/lib/systemd/system/serial-getty@.service - - source: files/root.profile - destination: /root/.profile - - source: files/trident-container.service - destination: /usr/lib/systemd/system/trident-container.service - - source: files/containerd-mmap-fix.cil - destination: /usr/share/selinux/packages/containerd-mmap-fix.cil - - services: - enable: - - trident-container - - sshd - -scripts: - postCustomization: - - path: scripts/post-install.sh - - path: scripts/load-containerd-selinux-fix.sh - -iso: - additionalFiles: - - source: files/config-placeholder.yaml - destination: /trident-config.yaml - - source: files/override-placeholder.conf - destination: /trident-override.conf - kernelCommandLine: - extraCommandLine: - - enforcing=0 - - console=tty0 - - console=ttyS0 - - rd.luks=0 diff --git a/tests/images/trident-container-installer/base/files/config-placeholder.yaml b/tests/images/trident-container-installer/base/files/config-placeholder.yaml deleted file mode 100644 index 88bb0938cb..0000000000 --- a/tests/images/trident-container-installer/base/files/config-placeholder.yaml +++ /dev/null @@ -1 +0,0 @@ -#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/etc/trident/config.yaml:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/images/trident-container-installer/base/files/containerd-mmap-fix.cil b/tests/images/trident-container-installer/base/files/containerd-mmap-fix.cil deleted file mode 100644 index f9951716e1..0000000000 --- a/tests/images/trident-container-installer/base/files/containerd-mmap-fix.cil +++ /dev/null @@ -1,7 +0,0 @@ -; Fix for containerd 2.2+ MountManager plugin SELinux denial. -; containerd 2.2 introduces a MountManager that opens a bbolt DB under -; /run/containerd/ using mmap(). The base refpolicy (RELEASE_2_20240226) -; grants manage_file_perms on container_runtime_t:file but that set does -; not include 'map'. Upstream fixed this in commit 7876e51510 (May 2024). -; This module backports the missing permission. -(allow container_engine_system_domain container_runtime_t (file (map))) diff --git a/tests/images/trident-container-installer/base/files/getty@.service b/tests/images/trident-container-installer/base/files/getty@.service deleted file mode 100644 index 10d3131812..0000000000 --- a/tests/images/trident-container-installer/base/files/getty@.service +++ /dev/null @@ -1,58 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Getty on %I -Documentation=man:agetty(8) man:systemd-getty-generator(8) -Documentation=http://0pointer.de/blog/projects/serial-console.html -After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target -After=rc-local.service - -# If additional gettys are spawned during boot then we should make -# sure that this is synchronized before getty.target, even though -# getty.target didn't actually pull it in. -Before=getty.target -IgnoreOnIsolate=yes - -# IgnoreOnIsolate causes issues with sulogin, if someone isolates -# rescue.target or starts rescue.service from multi-user.target or -# graphical.target. -Conflicts=rescue.service -Before=rescue.service - -# On systems without virtual consoles, don't start any getty. Note -# that serial gettys are covered by serial-getty@.service, not this -# unit. -ConditionPathExists=/dev/tty0 - -[Service] -# the VT is cleared by TTYVTDisallocate -# The '-o' option value tells agetty to replace 'login' arguments with an -# option to preserve environment (-p), followed by '--' for safety, and then -# the entered username. -ExecStart=-/sbin/agetty --autologin root --noclear %I linux -Type=idle -Restart=always -RestartSec=0 -UtmpIdentifier=%I -TTYPath=/dev/%I -TTYReset=yes -TTYVHangup=yes -TTYVTDisallocate=yes -KillMode=process -IgnoreSIGPIPE=no -SendSIGHUP=yes - -# Unset locale for the console getty since the console has problems -# displaying some internationalized messages. -UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION - -[Install] -WantedBy=getty.target -DefaultInstance=tty1 diff --git a/tests/images/trident-container-installer/base/files/override-placeholder.conf b/tests/images/trident-container-installer/base/files/override-placeholder.conf deleted file mode 100644 index 438677498c..0000000000 --- a/tests/images/trident-container-installer/base/files/override-placeholder.conf +++ /dev/null @@ -1 +0,0 @@ -#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/trident_cdrom/trident-override.conf:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/images/trident-container-installer/base/files/root.profile b/tests/images/trident-container-installer/base/files/root.profile deleted file mode 100644 index 14baf5c9e2..0000000000 --- a/tests/images/trident-container-installer/base/files/root.profile +++ /dev/null @@ -1,2 +0,0 @@ -# Open journalctl immediately after autologin -journalctl -f --no-tail -u trident-container \ No newline at end of file diff --git a/tests/images/trident-container-installer/base/files/serial-getty@.service b/tests/images/trident-container-installer/base/files/serial-getty@.service deleted file mode 100644 index 2f65391a8e..0000000000 --- a/tests/images/trident-container-installer/base/files/serial-getty@.service +++ /dev/null @@ -1,46 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Serial Getty on %I -Documentation=man:agetty(8) man:systemd-getty-generator(8) -Documentation=http://0pointer.de/blog/projects/serial-console.html -BindsTo=dev-%i.device -After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target -After=rc-local.service - -# If additional gettys are spawned during boot then we should make -# sure that this is synchronized before getty.target, even though -# getty.target didn't actually pull it in. -Before=getty.target -IgnoreOnIsolate=yes - -# IgnoreOnIsolate causes issues with sulogin, if someone isolates -# rescue.target or starts rescue.service from multi-user.target or -# graphical.target. -Conflicts=rescue.service -Before=rescue.service - -[Service] -# The '-o' option value tells agetty to replace 'login' arguments with an -# option to preserve environment (-p), followed by '--' for safety, and then -# the entered username. -ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I screen -Type=idle -Restart=always -UtmpIdentifier=%I -TTYPath=/dev/%I -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -SendSIGHUP=yes - -[Install] -WantedBy=getty.target diff --git a/tests/images/trident-container-installer/base/files/trident-container.service b/tests/images/trident-container-installer/base/files/trident-container.service deleted file mode 100644 index 2c93c93962..0000000000 --- a/tests/images/trident-container-installer/base/files/trident-container.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Trident Agent -Requires=docker.service -After=network.target network-online.target systemd-udev-settle.service docker.service - -[Service] -Type=oneshot -ExecStartPre=/bin/bash -c "set -e; mkdir -p /var/lib/trident" -ExecStartPre=/bin/bash -c "set -e; if ! docker image ls | grep -q 'trident/trident'; then curl $(grep -oP '^\s*phonehome: \\K.*(?=phonehome)' /etc/trident/config.yaml)files/trident-container.tar.gz -o /var/lib/trident/trident-container.tar.gz -f; fi" -ExecStartPre=/bin/bash -c "set -e; if ! docker image ls | grep -q 'trident/trident'; then docker load --input /var/lib/trident/trident-container.tar.gz; fi" -ExecStart=docker run --name trident_container --pull=never --rm --privileged -v /etc/trident:/etc/trident -v /etc/pki:/etc/pki:ro -v /run/initramfs/live:/trident_cdrom -v /var/lib/trident:/var/lib/trident -v /var/log:/var/log -v /:/host -v /dev:/dev -v /run:/run -v /sys:/sys --pid host --ipc host trident/trident:latest install --verbosity TRACE -StandardOutput=journal+console -StandardError=journal+console - -[Install] -WantedBy=multi-user.target diff --git a/tests/images/trident-container-installer/base/scripts/load-containerd-selinux-fix.sh b/tests/images/trident-container-installer/base/scripts/load-containerd-selinux-fix.sh deleted file mode 100644 index f908b04698..0000000000 --- a/tests/images/trident-container-installer/base/scripts/load-containerd-selinux-fix.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# Load SELinux policy module that grants the 'map' permission on -# container_runtime_t:file for container engines. This fixes containerd -# 2.2+ MountManager bbolt mmap() denials under enforcing mode. -semodule -i /usr/share/selinux/packages/containerd-mmap-fix.cil diff --git a/tests/images/trident-container-installer/base/scripts/post-install.sh b/tests/images/trident-container-installer/base/scripts/post-install.sh deleted file mode 100755 index 5b2f4f7ca8..0000000000 --- a/tests/images/trident-container-installer/base/scripts/post-install.sh +++ /dev/null @@ -1,15 +0,0 @@ -# Add the necessary directories for the audit logs so that auditd can start -mkdir -p /var/log/audit -# Use more intuitive path for the ISO mount -ln -s -T /run/initramfs/live /trident_cdrom - -# Load the config from the CDROM so that the user can patch it -if [ ! -d /etc/trident ]; then - mkdir /etc/trident -fi -ln -s -T /trident_cdrom/trident-config.yaml /etc/trident/config.yaml - -if [ ! -d /etc/systemd/system/trident-container.service.d ]; then - mkdir /etc/systemd/system/trident-container.service.d -fi -ln -s -T /trident_cdrom/trident-override.conf /etc/systemd/system/trident-container.service.d/override.conf \ No newline at end of file diff --git a/tests/images/trident-container-testimage/README.md b/tests/images/trident-container-testimage/README.md deleted file mode 100644 index e8feada25c..0000000000 --- a/tests/images/trident-container-testimage/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Trident Container Test Image - -This image is an extension of the base baremetal image and includes various -helper utilities along with Docker runtime. It also adds openssh-server to -allow for remote access. - -This image does **not** include Trident RPMs — Trident runs from a container -loaded at runtime. - -## Building - -From the repo root, run: - -```bash -python3 tests/images/testimages.py build trident-container-testimage -``` - -Output is written to `artifacts/trident-container-testimage.cosi` by default. -Use `--output-dir ` to change the output location. diff --git a/tests/images/trident-container-testimage/base/baseimg.yaml b/tests/images/trident-container-testimage/base/baseimg.yaml deleted file mode 100644 index 53f3eff715..0000000000 --- a/tests/images/trident-container-testimage/base/baseimg.yaml +++ /dev/null @@ -1,87 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - maxSize: 4G - partitions: - - id: esp - type: esp - size: 8M - - - id: rootfs - size: grow - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: rootfs - type: ext4 - mountPoint: - path: / - -os: - bootloader: - resetType: hard-reset - hostname: trident-container-testimg - - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.info - - log_buf_len=1M - - packages: - remove: - - grub2-efi-binary - - install: - # replace grub2-efi-binary with grub2-efi-binary-noprefix - - grub2-efi-binary-noprefix - - curl - - dnf - - efibootmgr - - iproute - - iptables - - lsof - - mdadm - - netplan - - openssh-server - - tpm2-tools - - vim - # Packages required for functional tests, which currently use this image: - - device-mapper - - dosfstools - - lvm2 - - veritysetup - # Optional dependencies for NTFS - - ntfs-3g - - ntfsprogs - - - docker-cli - - moby-engine - - selinux-policy - - squashfs-tools - - tar - - additionalFiles: - - source: files/trident-container.service - destination: /usr/lib/systemd/system/trident-container.service - - source: files/containerd-mmap-fix.cil - destination: /usr/share/selinux/packages/containerd-mmap-fix.cil - - services: - enable: - - trident-container - - sshd - -scripts: - postCustomization: - - path: scripts/post-install.sh - - path: scripts/load-containerd-selinux-fix.sh diff --git a/tests/images/trident-container-testimage/base/files/containerd-mmap-fix.cil b/tests/images/trident-container-testimage/base/files/containerd-mmap-fix.cil deleted file mode 100644 index f9951716e1..0000000000 --- a/tests/images/trident-container-testimage/base/files/containerd-mmap-fix.cil +++ /dev/null @@ -1,7 +0,0 @@ -; Fix for containerd 2.2+ MountManager plugin SELinux denial. -; containerd 2.2 introduces a MountManager that opens a bbolt DB under -; /run/containerd/ using mmap(). The base refpolicy (RELEASE_2_20240226) -; grants manage_file_perms on container_runtime_t:file but that set does -; not include 'map'. Upstream fixed this in commit 7876e51510 (May 2024). -; This module backports the missing permission. -(allow container_engine_system_domain container_runtime_t (file (map))) diff --git a/tests/images/trident-container-testimage/base/files/trident-container.service b/tests/images/trident-container-testimage/base/files/trident-container.service deleted file mode 100644 index bba22a9650..0000000000 --- a/tests/images/trident-container-testimage/base/files/trident-container.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Trident Agent -Requires=docker.service -After=network.target network-online.target systemd-udev-settle.service docker.service - -[Service] -Type=oneshot -ExecStartPre=/bin/bash -c "set -e; if ! docker image ls | grep -q 'trident/trident'; then docker load --input /var/lib/trident/trident-container.tar.gz; fi" -# TODO: Remove line to enable SELinux, when bug #9508 is fixed. -ExecStartPre=/bin/bash -c "sudo setenforce 0" -ExecStart=docker run --name trident_container --pull=never --rm --privileged -v /etc/trident:/etc/trident -v /var/lib/trident:/var/lib/trident -v /var/log:/var/log -v /:/host -v /dev:/dev -v /run:/run -v /sys:/sys --pid host --ipc host trident/trident:latest commit --verbosity DEBUG -StandardOutput=journal+console -StandardError=journal+console - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/tests/images/trident-container-testimage/base/scripts/load-containerd-selinux-fix.sh b/tests/images/trident-container-testimage/base/scripts/load-containerd-selinux-fix.sh deleted file mode 100644 index f908b04698..0000000000 --- a/tests/images/trident-container-testimage/base/scripts/load-containerd-selinux-fix.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -# Load SELinux policy module that grants the 'map' permission on -# container_runtime_t:file for container engines. This fixes containerd -# 2.2+ MountManager bbolt mmap() denials under enforcing mode. -semodule -i /usr/share/selinux/packages/containerd-mmap-fix.cil diff --git a/tests/images/trident-container-testimage/base/scripts/post-install.sh b/tests/images/trident-container-testimage/base/scripts/post-install.sh deleted file mode 100755 index 79da025b3b..0000000000 --- a/tests/images/trident-container-testimage/base/scripts/post-install.sh +++ /dev/null @@ -1,2 +0,0 @@ -# Add the necessary directories for the audit logs so that auditd can start -mkdir -p /var/log/audit diff --git a/tests/images/trident-functest/base/baseimg.yaml b/tests/images/trident-functest/base/baseimg.yaml deleted file mode 100644 index 874463b5eb..0000000000 --- a/tests/images/trident-functest/base/baseimg.yaml +++ /dev/null @@ -1,87 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - maxSize: 15G - partitions: - - id: esp - type: esp - size: 50M - label: esp - - id: root-a - size: 4G - type: root - label: root-a - - id: root-b - size: 4G - type: root - label: root-b - - id: swap - size: 2G - type: swap - label: swap - - id: trident - size: 100M - type: linux-generic - label: trident - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: root-a - type: ext4 - mountPoint: - path: / - - - deviceId: trident - type: ext4 - mountPoint: - path: /var/lib/trident - -os: - bootloader: - resetType: hard-reset - hostname: trident-functest - - selinux: - mode: permissive - - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.info - - log_buf_len=1M - - packages: - install: - - curl - - dnf - - efibootmgr - - iproute - - iptables - - lsof - - mdadm - - netplan - - openssh-server - - tpm2-tools - - vim - - audit - # Packages required for functional tests, which currently use this image: - - device-mapper - - dosfstools - - lvm2 - - veritysetup - # Optional dependencies for NTFS - - ntfs-3g - - ntfsprogs - - services: - enable: - - sshd diff --git a/tests/images/trident-installer/README.md b/tests/images/trident-installer/README.md deleted file mode 100644 index b3f1e2d7c8..0000000000 --- a/tests/images/trident-installer/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Trident Installer ISO Test Image - -This image is used by the Trident test pipelines. It contains a copy of Trident that launches at -startup and reads a configuration that can be patched into the ISO. \ No newline at end of file diff --git a/tests/images/trident-installer/base/baseimg-direct-streaming.yaml b/tests/images/trident-installer/base/baseimg-direct-streaming.yaml deleted file mode 100644 index 3ace14fbda..0000000000 --- a/tests/images/trident-installer/base/baseimg-direct-streaming.yaml +++ /dev/null @@ -1,113 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - maxSize: 4G - partitions: - - id: esp - type: esp - size: 8M - - - id: rootfs - size: grow - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: rootfs - type: ext4 - mountPoint: - path: / - -os: - bootloader: - resetType: hard-reset - hostname: trident-direct-streaming-mos-testimage - - packages: - update: - - systemd - - install: - - binutils - - curl - - device-mapper - - dnf - - dosfstools - - efibootmgr - - iproute - - iptables - - lsof - - mdadm - - netplan - # Support for mounting NTFS filesystems - - ntfs-3g - # Support for creating NTFS filesystems - - ntfsprogs - - openssh-server - - squashfs-tools - - tar - - tpm2-tools - - veritysetup - - vim - # Support for building SELinux module and debugging - - selinux-policy-devel - - setools-console - # Add trident and tridentd - - trident - # Add trident selinux policy files - - trident-selinux - # Add trident-install.service - - trident-install-service - - services: - enable: - - sshd - - rcp-agent - - tridentd.socket - disable: - - trident-install - - additionalFiles: - - source: files/getty@.service - destination: /usr/lib/systemd/system/getty@.service - - source: files/serial-getty@.service - destination: /usr/lib/systemd/system/serial-getty@.service - - source: files/root.profile - destination: /root/.profile - - # Netlaunch RCP files - - source: ../../../../bin/rcp-agent - destination: /usr/bin/rcp-agent - - source: ../../../../tools/cmd/rcp-agent/rcp-agent.service - destination: /usr/lib/systemd/system/rcp-agent.service - - selinux: - mode: enforcing - -scripts: - postCustomization: - - path: post-install.sh - arguments: - - "stream-image-test" - -iso: - additionalFiles: - # Add pre-trident script to be run early by rcp-agent - - source: files/pre-trident-script.sh - destination: /pre-trident-script.sh - # Add overridable default config for rcp-agent - - source: files/rcp-agent.yaml - destination: /rcp-agent.yaml - - kernelCommandLine: - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.luks=0 - - selinux=1 diff --git a/tests/images/trident-installer/base/baseimg-split.yaml b/tests/images/trident-installer/base/baseimg-split.yaml deleted file mode 100644 index 6c5867d8a7..0000000000 --- a/tests/images/trident-installer/base/baseimg-split.yaml +++ /dev/null @@ -1,86 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - maxSize: 4G - partitions: - - id: esp - type: esp - size: 8M - - - id: rootfs - size: grow - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: rootfs - type: ext4 - mountPoint: - path: / - -os: - bootloader: - resetType: hard-reset - hostname: trident-mos-testimage - - packages: - install: - - curl - - device-mapper - - dnf - - dosfstools - - efibootmgr - - iproute - - iptables - - lsof - - mdadm - - netplan - # Optional dependencies for NTFS - - ntfs-3g - - ntfsprogs - - openssh-server - - squashfs-tools - - tar - - tpm2-tools - - trident - - vim - - veritysetup - - services: - enable: - - sshd - - trident-install - - tridentd.socket - - selinux: - mode: enforcing - - additionalFiles: - - source: files/getty@.service - destination: /usr/lib/systemd/system/getty@.service - - source: files/serial-getty@.service - destination: /usr/lib/systemd/system/serial-getty@.service - - source: files/root.profile - destination: /root/.profile - - source: files/trident-split-install.service - destination: /usr/lib/systemd/system/trident-install.service - -scripts: - postCustomization: - - path: post-install.sh - -iso: - additionalFiles: - - source: files/config-placeholder.yaml - destination: /trident-config.yaml - kernelCommandLine: - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.luks=0 diff --git a/tests/images/trident-installer/base/baseimg.yaml b/tests/images/trident-installer/base/baseimg.yaml deleted file mode 100644 index 7f6bf691bb..0000000000 --- a/tests/images/trident-installer/base/baseimg.yaml +++ /dev/null @@ -1,96 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - maxSize: 4G - partitions: - - id: esp - type: esp - size: 8M - - - id: rootfs - size: grow - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: rootfs - type: ext4 - mountPoint: - path: / - -os: - bootloader: - resetType: hard-reset - hostname: trident-mos-testimage - - packages: - install: - - binutils - - curl - - device-mapper - - dnf - - dosfstools - - efibootmgr - - iproute - - iptables - - lsof - - mdadm - - netplan - # Optional dependencies for NTFS - - ntfs-3g - - ntfsprogs - - openssh-server - # Package required for systemd-pcrlock & PCR-based encryption; can be removed once AZL 4.0 - # merges a fix to provide statically defined files inside the same package as the - # systemd-pcrlock binary, i.e. systemd-udev. - - trident-static-pcrlock-files - - squashfs-tools - - tar - - tpm2-tools - - trident - - vim - - veritysetup - - selinux-policy - - selinux-policy-devel - - audit - - services: - enable: - - sshd - - trident-install - - tridentd.socket - - additionalFiles: - - source: files/getty@.service - destination: /usr/lib/systemd/system/getty@.service - - source: files/serial-getty@.service - destination: /usr/lib/systemd/system/serial-getty@.service - - source: files/root.profile - destination: /root/.profile - - source: files/trident-install.service - destination: /usr/lib/systemd/system/trident-install.service - - selinux: - mode: enforcing - -scripts: - postCustomization: - - path: post-install.sh - -iso: - additionalFiles: - - source: files/config-placeholder.yaml - destination: /trident-config.yaml - - source: files/override-placeholder.conf - destination: /trident-override.conf - kernelCommandLine: - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.luks=0 diff --git a/tests/images/trident-installer/base/files/config-placeholder.yaml b/tests/images/trident-installer/base/files/config-placeholder.yaml deleted file mode 100644 index 88bb0938cb..0000000000 --- a/tests/images/trident-installer/base/files/config-placeholder.yaml +++ /dev/null @@ -1 +0,0 @@ -#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/etc/trident/config.yaml:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/images/trident-installer/base/files/direct-streaming-placeholder.conf b/tests/images/trident-installer/base/files/direct-streaming-placeholder.conf deleted file mode 100644 index a215248819..0000000000 --- a/tests/images/trident-installer/base/files/direct-streaming-placeholder.conf +++ /dev/null @@ -1 +0,0 @@ -#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/trident_cdrom/direct-streaming.conf:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/images/trident-installer/base/files/getty@.service b/tests/images/trident-installer/base/files/getty@.service deleted file mode 100644 index 10d3131812..0000000000 --- a/tests/images/trident-installer/base/files/getty@.service +++ /dev/null @@ -1,58 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Getty on %I -Documentation=man:agetty(8) man:systemd-getty-generator(8) -Documentation=http://0pointer.de/blog/projects/serial-console.html -After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target -After=rc-local.service - -# If additional gettys are spawned during boot then we should make -# sure that this is synchronized before getty.target, even though -# getty.target didn't actually pull it in. -Before=getty.target -IgnoreOnIsolate=yes - -# IgnoreOnIsolate causes issues with sulogin, if someone isolates -# rescue.target or starts rescue.service from multi-user.target or -# graphical.target. -Conflicts=rescue.service -Before=rescue.service - -# On systems without virtual consoles, don't start any getty. Note -# that serial gettys are covered by serial-getty@.service, not this -# unit. -ConditionPathExists=/dev/tty0 - -[Service] -# the VT is cleared by TTYVTDisallocate -# The '-o' option value tells agetty to replace 'login' arguments with an -# option to preserve environment (-p), followed by '--' for safety, and then -# the entered username. -ExecStart=-/sbin/agetty --autologin root --noclear %I linux -Type=idle -Restart=always -RestartSec=0 -UtmpIdentifier=%I -TTYPath=/dev/%I -TTYReset=yes -TTYVHangup=yes -TTYVTDisallocate=yes -KillMode=process -IgnoreSIGPIPE=no -SendSIGHUP=yes - -# Unset locale for the console getty since the console has problems -# displaying some internationalized messages. -UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION - -[Install] -WantedBy=getty.target -DefaultInstance=tty1 diff --git a/tests/images/trident-installer/base/files/override-placeholder.conf b/tests/images/trident-installer/base/files/override-placeholder.conf deleted file mode 100644 index 438677498c..0000000000 --- a/tests/images/trident-installer/base/files/override-placeholder.conf +++ /dev/null @@ -1 +0,0 @@ -#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/trident_cdrom/trident-override.conf:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/images/trident-installer/base/files/pre-trident-script.sh b/tests/images/trident-installer/base/files/pre-trident-script.sh deleted file mode 100644 index 2f58380523..0000000000 --- a/tests/images/trident-installer/base/files/pre-trident-script.sh +++ /dev/null @@ -1 +0,0 @@ -#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/trident_cdrom/pre-trident-script.sh:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/images/trident-installer/base/files/rcp-agent.yaml b/tests/images/trident-installer/base/files/rcp-agent.yaml deleted file mode 100644 index f67f224a79..0000000000 --- a/tests/images/trident-installer/base/files/rcp-agent.yaml +++ /dev/null @@ -1 +0,0 @@ -#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/trident_cdrom/rcp-agent.yaml:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/images/trident-installer/base/files/root.profile b/tests/images/trident-installer/base/files/root.profile deleted file mode 100644 index 0042af12a5..0000000000 --- a/tests/images/trident-installer/base/files/root.profile +++ /dev/null @@ -1,5 +0,0 @@ -# Add short alias to see trident's logs -alias tridentlog="journalctl -u trident -u trident-network" - -# Open journalctl immediately after autologin -journalctl -f --no-tail -u trident -u trident-network \ No newline at end of file diff --git a/tests/images/trident-installer/base/files/serial-getty@.service b/tests/images/trident-installer/base/files/serial-getty@.service deleted file mode 100644 index 2f65391a8e..0000000000 --- a/tests/images/trident-installer/base/files/serial-getty@.service +++ /dev/null @@ -1,46 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Serial Getty on %I -Documentation=man:agetty(8) man:systemd-getty-generator(8) -Documentation=http://0pointer.de/blog/projects/serial-console.html -BindsTo=dev-%i.device -After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target -After=rc-local.service - -# If additional gettys are spawned during boot then we should make -# sure that this is synchronized before getty.target, even though -# getty.target didn't actually pull it in. -Before=getty.target -IgnoreOnIsolate=yes - -# IgnoreOnIsolate causes issues with sulogin, if someone isolates -# rescue.target or starts rescue.service from multi-user.target or -# graphical.target. -Conflicts=rescue.service -Before=rescue.service - -[Service] -# The '-o' option value tells agetty to replace 'login' arguments with an -# option to preserve environment (-p), followed by '--' for safety, and then -# the entered username. -ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I screen -Type=idle -Restart=always -UtmpIdentifier=%I -TTYPath=/dev/%I -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -SendSIGHUP=yes - -[Install] -WantedBy=getty.target diff --git a/tests/images/trident-installer/base/files/trident-install.service b/tests/images/trident-installer/base/files/trident-install.service deleted file mode 100644 index 2057d49dd2..0000000000 --- a/tests/images/trident-installer/base/files/trident-install.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Trident Install Service -After=network.target network-online.target systemd-udev-settle.service - -[Service] -ExecStart=trident install --verbosity DEBUG -Type=oneshot - -[Install] -WantedBy=multi-user.target diff --git a/tests/images/trident-installer/base/files/trident-split-install.service b/tests/images/trident-installer/base/files/trident-split-install.service deleted file mode 100644 index bfb868b857..0000000000 --- a/tests/images/trident-installer/base/files/trident-split-install.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Trident Install Service -After=network.target network-online.target systemd-udev-settle.service - -[Service] -ExecStart=echo stage -ExecStart=trident install --verbosity DEBUG --allowed-operations stage -ExecStart=echo finalize -ExecStart=trident install --verbosity DEBUG --allowed-operations finalize -Type=oneshot - -[Install] -WantedBy=multi-user.target diff --git a/tests/images/trident-installer/base/post-install.sh b/tests/images/trident-installer/base/post-install.sh deleted file mode 100755 index 1bfa85174a..0000000000 --- a/tests/images/trident-installer/base/post-install.sh +++ /dev/null @@ -1,31 +0,0 @@ -# Add the necessary directories for the audit logs so that auditd can start -mkdir -p /var/log/audit - -# Use more intuitive path for the ISO mount -ln -s -T /run/initramfs/live /trident_cdrom - -# Load the config from the CDROM so that the user can patch it -if [ ! -d /etc/trident ]; then - mkdir -p /etc/trident -fi - -if [ "$1" != "stream-image-test" ]; then - ln -s -T /trident_cdrom/trident-config.yaml /etc/trident/config.yaml - - if [ ! -d /etc/systemd/system/trident-install.service.d ]; then - mkdir -p /etc/systemd/system/trident-install.service.d - fi - ln -s -T /trident_cdrom/trident-override.conf /etc/systemd/system/trident-install.service.d/override.conf -else - # The stream image test purposefully does not have /etc/trident/config.yaml, so remove - # this condition from the systemd service to avoid it failing to start - sed -i 's|ConditionPathExists=/etc/trident/config.yaml||' /usr/lib/systemd/system/trident-install.service -fi - -# Ensure /etc/rcp-agent/ exists -if [ ! -d /etc/rcp-agent ]; then - mkdir -p /etc/rcp-agent -fi - -# Link rcp-agent config from the ISO -ln -s -T /trident_cdrom/rcp-agent.yaml /etc/rcp-agent/config.yaml \ No newline at end of file diff --git a/tests/images/trident-mos/containerhost-iso.yaml b/tests/images/trident-mos/containerhost-iso.yaml deleted file mode 100644 index 586bb5ac9b..0000000000 --- a/tests/images/trident-mos/containerhost-iso.yaml +++ /dev/null @@ -1,73 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - maxSize: 4G - partitions: - - id: esp - type: esp - start: 1M - end: 9M - - - id: rootfs - start: 9M - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: rootfs - type: ext4 - mountPoint: - path: / - -os: - bootloader: - resetType: hard-reset - hostname: trident-containerhost-mos-testimage - - packages: - install: - - curl - - device-mapper - - dnf - - moby-engine - - moby-cli - - openssh-server - - squashfs-tools - - tar - - vim - - additionalFiles: - - source: files/getty@.service - destination: /usr/lib/systemd/system/getty@.service - - source: files/serial-getty@.service - destination: /usr/lib/systemd/system/serial-getty@.service - - source: files/root.profile - destination: /root/.profile - - source: files/download-trident-container.service - destination: /usr/lib/systemd/system/download-trident-container.service - - services: - enable: - - download-trident-container - -scripts: - postCustomization: - - path: post-install.sh - -iso: - additionalFiles: - - source: files/config-placeholder.yaml - destination: /trident-config.yaml - - source: files/pre-trident-script.sh - destination: /pre-trident-script.sh - kernelCommandLine: - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.luks=0 - - selinux=0 diff --git a/tests/images/trident-mos/files/.gitignore b/tests/images/trident-mos/files/.gitignore deleted file mode 100644 index 0247caea4e..0000000000 --- a/tests/images/trident-mos/files/.gitignore +++ /dev/null @@ -1 +0,0 @@ -trident-container.service \ No newline at end of file diff --git a/tests/images/trident-mos/files/config-placeholder.yaml b/tests/images/trident-mos/files/config-placeholder.yaml deleted file mode 100644 index 88bb0938cb..0000000000 --- a/tests/images/trident-mos/files/config-placeholder.yaml +++ /dev/null @@ -1 +0,0 @@ -#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/etc/trident/config.yaml:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/images/trident-mos/files/download-trident-container.service b/tests/images/trident-mos/files/download-trident-container.service deleted file mode 100644 index 85269a0d9a..0000000000 --- a/tests/images/trident-mos/files/download-trident-container.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Trident Agent -After=network.target network-online.target systemd-udev-settle.service docker.service -Requires=docker.service - -[Service] -ExecStartPre=/bin/bash /trident_cdrom/pre-trident-script.sh -ExecStartPre=/bin/bash -c "set -e; if ! docker image ls | grep -q 'trident/trident'; then curl $(grep -oP '^\s*phonehome: \\K.*(?=phonehome)' /etc/trident/config.yaml)files/trident-container.tar.gz -o /trident-container.tar.gz -f; fi" -ExecStartPre=/bin/bash -c "set -e; if ! docker image ls | grep -q 'trident/trident'; then docker load --input /trident-container.tar.gz; fi" -ExecStart=docker run --privileged -v /etc/trident:/etc/trident -v /run/initramfs/live:/trident_cdrom -v /var/lib/trident:/var/lib/trident -v /:/host -v /dev:/dev -v /run:/run -v /sys:/sys --pid host trident/trident:latest run -Type=oneshot - -[Install] -WantedBy=multi-user.target diff --git a/tests/images/trident-mos/files/getty@.service b/tests/images/trident-mos/files/getty@.service deleted file mode 100644 index 10d3131812..0000000000 --- a/tests/images/trident-mos/files/getty@.service +++ /dev/null @@ -1,58 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Getty on %I -Documentation=man:agetty(8) man:systemd-getty-generator(8) -Documentation=http://0pointer.de/blog/projects/serial-console.html -After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target -After=rc-local.service - -# If additional gettys are spawned during boot then we should make -# sure that this is synchronized before getty.target, even though -# getty.target didn't actually pull it in. -Before=getty.target -IgnoreOnIsolate=yes - -# IgnoreOnIsolate causes issues with sulogin, if someone isolates -# rescue.target or starts rescue.service from multi-user.target or -# graphical.target. -Conflicts=rescue.service -Before=rescue.service - -# On systems without virtual consoles, don't start any getty. Note -# that serial gettys are covered by serial-getty@.service, not this -# unit. -ConditionPathExists=/dev/tty0 - -[Service] -# the VT is cleared by TTYVTDisallocate -# The '-o' option value tells agetty to replace 'login' arguments with an -# option to preserve environment (-p), followed by '--' for safety, and then -# the entered username. -ExecStart=-/sbin/agetty --autologin root --noclear %I linux -Type=idle -Restart=always -RestartSec=0 -UtmpIdentifier=%I -TTYPath=/dev/%I -TTYReset=yes -TTYVHangup=yes -TTYVTDisallocate=yes -KillMode=process -IgnoreSIGPIPE=no -SendSIGHUP=yes - -# Unset locale for the console getty since the console has problems -# displaying some internationalized messages. -UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION - -[Install] -WantedBy=getty.target -DefaultInstance=tty1 diff --git a/tests/images/trident-mos/files/pre-trident-script.sh b/tests/images/trident-mos/files/pre-trident-script.sh deleted file mode 100644 index 2f58380523..0000000000 --- a/tests/images/trident-mos/files/pre-trident-script.sh +++ /dev/null @@ -1 +0,0 @@ -#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/trident_cdrom/pre-trident-script.sh:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/images/trident-mos/files/rcp-agent.yaml b/tests/images/trident-mos/files/rcp-agent.yaml deleted file mode 100644 index f67f224a79..0000000000 --- a/tests/images/trident-mos/files/rcp-agent.yaml +++ /dev/null @@ -1 +0,0 @@ -#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/trident_cdrom/rcp-agent.yaml:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/images/trident-mos/files/root.profile b/tests/images/trident-mos/files/root.profile deleted file mode 100644 index 0e0a03dc66..0000000000 --- a/tests/images/trident-mos/files/root.profile +++ /dev/null @@ -1,2 +0,0 @@ -# Open journalctl immediately after autologin -journalctl -f --no-tail -u trident-install.service -p emerg..info \ No newline at end of file diff --git a/tests/images/trident-mos/files/serial-getty@.service b/tests/images/trident-mos/files/serial-getty@.service deleted file mode 100644 index 2f65391a8e..0000000000 --- a/tests/images/trident-mos/files/serial-getty@.service +++ /dev/null @@ -1,46 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Serial Getty on %I -Documentation=man:agetty(8) man:systemd-getty-generator(8) -Documentation=http://0pointer.de/blog/projects/serial-console.html -BindsTo=dev-%i.device -After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target -After=rc-local.service - -# If additional gettys are spawned during boot then we should make -# sure that this is synchronized before getty.target, even though -# getty.target didn't actually pull it in. -Before=getty.target -IgnoreOnIsolate=yes - -# IgnoreOnIsolate causes issues with sulogin, if someone isolates -# rescue.target or starts rescue.service from multi-user.target or -# graphical.target. -Conflicts=rescue.service -Before=rescue.service - -[Service] -# The '-o' option value tells agetty to replace 'login' arguments with an -# option to preserve environment (-p), followed by '--' for safety, and then -# the entered username. -ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I screen -Type=idle -Restart=always -UtmpIdentifier=%I -TTYPath=/dev/%I -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -SendSIGHUP=yes - -[Install] -WantedBy=getty.target diff --git a/tests/images/trident-mos/iso.yaml b/tests/images/trident-mos/iso.yaml deleted file mode 100644 index 00b235a021..0000000000 --- a/tests/images/trident-mos/iso.yaml +++ /dev/null @@ -1,126 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - maxSize: 4G - partitions: - - id: esp - type: esp - start: 1M - end: 9M - - - id: rootfs - start: 9M - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: rootfs - type: ext4 - mountPoint: - path: / - -os: - bootloader: - resetType: hard-reset - hostname: trident-mos-testimage - - packages: - update: - - systemd - - install: - - binutils - - curl - - device-mapper - - dnf - - dosfstools - - efibootmgr - - iproute - - iptables - - lsof - - mdadm - - netplan - # Support for mounting NTFS filesystems - - ntfs-3g - # Support for creating NTFS filesystems - - ntfsprogs - - openssh-server - - squashfs-tools - - tar - - tpm2-tools - - veritysetup - - vim - # Support for building SELinux module and debugging - - selinux-policy-devel - - setools-console - - additionalDirs: - # Required for systemd-pcrlock & PCR-based encryption; can be removed once - # AZL 4.0 merges a fix to provide statically defined files inside the same - # package as the systemd-pcrlock binary, i.e. systemd-udev. - - source: "../../../packaging/static-pcrlock-files/" - destination: "/var/lib/pcrlock.d/" - - additionalFiles: - - source: files/getty@.service - destination: /usr/lib/systemd/system/getty@.service - - source: files/serial-getty@.service - destination: /usr/lib/systemd/system/serial-getty@.service - - source: files/root.profile - destination: /root/.profile - - source: ../../../packaging/systemd/trident-install.service - destination: /usr/lib/systemd/system/trident-install.service - - source: ../../../packaging/selinux-policy-trident/trident.if - destination: /usr/share/selinux/packages/trident/trident.if - - source: ../../../packaging/selinux-policy-trident/trident.fc - destination: /usr/share/selinux/packages/trident/trident.fc - - source: ../../../packaging/selinux-policy-trident/trident.te - destination: /usr/share/selinux/packages/trident/trident.te - - # Trident daemon service files - - source: ../../../packaging/systemd/tridentd.socket - destination: /usr/lib/systemd/system/tridentd.socket - - source: ../../../packaging/systemd/tridentd.service - destination: /usr/lib/systemd/system/tridentd.service - - # Netlaunch RCP files - - source: ../../../bin/rcp-agent - destination: /usr/bin/rcp-agent - - source: ../../../tools/cmd/rcp-agent/rcp-agent.service - destination: /usr/lib/systemd/system/rcp-agent.service - - services: - enable: - - rcp-agent - - tridentd.socket - disable: - - trident-install - -scripts: - postCustomization: - - path: post-install.sh - -iso: - additionalFiles: - # Add placeholder config for Trident - - source: files/config-placeholder.yaml - destination: /trident-config.yaml - # Add pre-trident script to be run early by rcp-agent - - source: files/pre-trident-script.sh - destination: /pre-trident-script.sh - # Add overridable default config for rcp-agent - - source: files/rcp-agent.yaml - destination: /rcp-agent.yaml - - kernelCommandLine: - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.luks=0 - - selinux=1 - - enforcing=0 diff --git a/tests/images/trident-mos/post-install.sh b/tests/images/trident-mos/post-install.sh deleted file mode 100755 index 927f9e3cbe..0000000000 --- a/tests/images/trident-mos/post-install.sh +++ /dev/null @@ -1,21 +0,0 @@ -# Use more intuitive path for the ISO mount -ln -s /run/initramfs/live /trident_cdrom - -# Load the config from the CDROM so that the user can patch it -if [ ! -d /etc/trident ]; then - mkdir -p /etc/trident -fi -ln -s /trident_cdrom/trident-config.yaml /etc/trident/config.yaml - -# Ensure /etc/rcp-agent/ exists -if [ ! -d /etc/rcp-agent ]; then - mkdir -p /etc/rcp-agent -fi - -# Link rcp-agent config from the ISO -ln -s /trident_cdrom/rcp-agent.yaml /etc/rcp-agent/config.yaml - -# Compile and load Trident SELinux module (this is otherwise handled in trident.spec) -cd /usr/share/selinux/packages/trident -make -f /usr/share/selinux/devel/Makefile trident.pp -semodule -i trident.pp \ No newline at end of file diff --git a/tests/images/trident-testimage/README.md b/tests/images/trident-testimage/README.md deleted file mode 100644 index 108ab80e11..0000000000 --- a/tests/images/trident-testimage/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# Trident Test Image - -This image is used for testing Trident on Azure Linux. For AMD64, the image -is based on the baremetal image, and for ARM64, it is based on the ARM64 core -image. In both cases, the configuration adds Trident as well as its dependencies. -It also includes openssh-server to allow for remote access. - -## Prerequisites - -- **Trident RPMs** in `bin/RPMS/`. Build them with: - ```bash - make bin/trident-rpms.tar.gz - ``` - -## Building - -From the repo root, run: - -```bash -python3 tests/images/testimages.py build trident-testimage -``` - -Output is written to `artifacts/trident-testimage.cosi` by default. Use -`--output-dir ` to change the output location. diff --git a/tests/images/trident-testimage/base/baseimg.yaml b/tests/images/trident-testimage/base/baseimg.yaml deleted file mode 100644 index 80951ff4d6..0000000000 --- a/tests/images/trident-testimage/base/baseimg.yaml +++ /dev/null @@ -1,83 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - maxSize: 4G - partitions: - - id: esp - type: esp - size: 8M - - - id: rootfs - size: grow - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: rootfs - type: ext4 - mountPoint: - path: / - -os: - bootloader: - resetType: hard-reset - hostname: trident-testimg - - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.info - - log_buf_len=1M - - packages: - remove: - - grub2-efi-binary - - install: - # replace grub2-efi-binary with grub2-efi-binary-noprefix - - grub2-efi-binary-noprefix - - curl - - dnf - - efibootmgr - - iproute - - iptables - - lsof - - mdadm - - netplan - - openssh-server - - tpm2-tools - - trident-service - - vim - - audit - # Packages required for functional tests, which currently use this image: - - device-mapper - - dosfstools - - lvm2 - - veritysetup - # Optional dependencies for NTFS - - ntfs-3g - - ntfsprogs - - services: - enable: - - sshd - - trident - - tridentd.socket - - additionalFiles: - # For tests, override the public trident.service behavior and use - # grpc-client commit. - - source: files/use-grpc-client-commit.conf - destination: /etc/systemd/system/trident.service.d/override.conf - -scripts: - postCustomization: - - path: post-install.sh diff --git a/tests/images/trident-testimage/base/files/use-grpc-client-commit.conf b/tests/images/trident-testimage/base/files/use-grpc-client-commit.conf deleted file mode 100644 index 958e0095c3..0000000000 --- a/tests/images/trident-testimage/base/files/use-grpc-client-commit.conf +++ /dev/null @@ -1,5 +0,0 @@ -[Service] -ExecStart= -ExecStart=trident grpc-client commit -StandardOutput=journal+console -StandardError=journal+console diff --git a/tests/images/trident-testimage/base/post-install.sh b/tests/images/trident-testimage/base/post-install.sh deleted file mode 100755 index 79da025b3b..0000000000 --- a/tests/images/trident-testimage/base/post-install.sh +++ /dev/null @@ -1,2 +0,0 @@ -# Add the necessary directories for the audit logs so that auditd can start -mkdir -p /var/log/audit diff --git a/tests/images/trident-verity-testimage/README.md b/tests/images/trident-verity-testimage/README.md deleted file mode 100644 index 0c8dd782a7..0000000000 --- a/tests/images/trident-verity-testimage/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Trident Verity Test Image - -This image is used for testing Trident on Azure Linux with `dm-verity` enabled. It -is based on the baremetal image and adds Trident as well as its dependencies. It -also adds openssh-server to allow for remote access. In addition to the [Trident -Test Image](../trident-testimage/README.md), this image is configured to use -dm-verity. - -## Prerequisites - -- **Trident RPMs** in `bin/RPMS/`. Build them with: - ```bash - make bin/trident-rpms.tar.gz - ``` - -## Building - -From the repo root, run: - -```bash -python3 tests/images/testimages.py build trident-verity-testimage -``` - -Output is written to `artifacts/trident-verity-testimage.cosi` by default. Use -`--output-dir ` to change the output location. diff --git a/tests/images/trident-verity-testimage/base/baseimg-container.yaml b/tests/images/trident-verity-testimage/base/baseimg-container.yaml deleted file mode 100644 index 21dd824cb5..0000000000 --- a/tests/images/trident-verity-testimage/base/baseimg-container.yaml +++ /dev/null @@ -1,146 +0,0 @@ -storage: - disks: - - partitionTableType: gpt - maxSize: 5G - partitions: - - id: esp - type: esp - size: 8M - - - id: boot - size: 1G - - - label: root - id: root - size: 2G - - - label: root-hash - id: verityhash - size: 128M - - - id: sysexts - size: 1G - - - id: confexts - size: 200M - - - id: var - size: grow - - bootType: efi - - verity: - - id: rootverity - name: root - dataDeviceId: root - hashDeviceId: verityhash - dataDeviceMountIdType: part-label - hashDeviceMountIdType: part-label - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: boot - type: ext4 - mountPoint: - path: /boot - - - deviceId: rootverity - type: ext4 - mountPoint: - path: / - options: defaults,ro - - - deviceId: sysexts - type: ext4 - mountPoint: - path: /var/lib/extensions - - - deviceId: confexts - type: ext4 - mountPoint: - path: /var/lib/confexts - - - deviceId: var - type: ext4 - mountPoint: - path: /var - -os: - bootloader: - resetType: hard-reset - hostname: trident-container-verity-testimg - - selinux: - mode: disabled - - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.info - - log_buf_len=1M - - packages: - remove: - - grub2-efi-binary - - # Package list carried over from base image. - install: - # replace grub2-efi-binary with grub2-efi-binary-noprefix - - grub2-efi-binary-noprefix - - curl - - device-mapper - - dnf - - docker-cli - # Required to create vfat filesystems, which at the moment is not needed - # from the runtime image; included here to unblock functional tests - - dosfstools - # Required to boot from the overlay supplied on the kernel command line - - dracut-overlayfs - - efibootmgr - - iproute - - iptables - - lsof - - lvm2 - - mdadm - - moby-engine - - netplan - - openssh-server - - systemd-udev - - tpm2-tools - - veritysetup - - squashfs-tools - - tar - - vim - - additionalFiles: - # Early boot one shot service to activate secondary rw /etc overlay - - source: etc-mount.service - destination: /etc/systemd/system/etc-mount.service - # Script invoked by the service above to mount the /etc rw overlay - - source: etc-mount.sh - destination: /usr/local/bin/etc-mount.sh - # SSH user needs sudo access for tests, and scripts cannot modify /etc - # directly, so modifying the wheel group as part of the image creation (note - # scripts could mount the rw etc from below instead) - - source: sudoers-wheel - destination: /etc/sudoers.d/wheel - - source: files/trident-container.service - destination: /usr/lib/systemd/system/trident-container.service - - services: - enable: - - etc-mount - - sshd - - trident-container - -scripts: - postCustomization: - # Script to create the /web directory - - path: create-web-dir.sh diff --git a/tests/images/trident-verity-testimage/base/baseimg.yaml b/tests/images/trident-verity-testimage/base/baseimg.yaml deleted file mode 100644 index 1477615dcd..0000000000 --- a/tests/images/trident-verity-testimage/base/baseimg.yaml +++ /dev/null @@ -1,146 +0,0 @@ -storage: - disks: - - partitionTableType: gpt - maxSize: 5G - partitions: - - id: esp - type: esp - size: 8M - - - id: boot - size: 1G - - - label: root - id: root - size: 2G - - - label: root-hash - id: verityhash - size: 128M - - - id: sysexts - size: 1G - - - id: confexts - size: 200M - - - id: var - size: grow - - bootType: efi - - verity: - - id: rootverity - name: root - dataDeviceId: root - hashDeviceId: verityhash - dataDeviceMountIdType: part-label - hashDeviceMountIdType: part-label - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: boot - type: ext4 - mountPoint: - path: /boot - - - deviceId: rootverity - type: ext4 - mountPoint: - path: / - options: defaults,ro - - - deviceId: sysexts - type: ext4 - mountPoint: - path: /var/lib/extensions - - - deviceId: confexts - type: ext4 - mountPoint: - path: /var/lib/confexts - - - deviceId: var - type: ext4 - mountPoint: - path: /var - -os: - bootloader: - resetType: hard-reset - hostname: trident-verity-testimg - - selinux: - mode: disabled - - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.info - - log_buf_len=1M - - packages: - remove: - - grub2-efi-binary - - # Package list carried over from base image. - install: - # replace grub2-efi-binary with grub2-efi-binary-noprefix - - grub2-efi-binary-noprefix - - curl - - device-mapper - # Required to create vfat filesystems, which at the moment is not needed - # from the runtime image; included here to unblock functional tests - - dosfstools - # Required to boot from the overlay supplied on the kernel command line - - dracut-overlayfs - - efibootmgr - - iproute - - iptables - - lsof - - lvm2 - - mdadm - - netplan - - openssh-server - - systemd-udev - - tpm2-tools - - trident-service - - veritysetup - - vim - - additionalFiles: - # Early boot one shot service to activate secondary rw /etc overlay - - source: etc-mount.service - destination: /etc/systemd/system/etc-mount.service - # Script invoked by the service above to mount the /etc rw overlay - - source: etc-mount.sh - destination: /usr/local/bin/etc-mount.sh - # SSH user needs sudo access for tests, and scripts cannot modify /etc - # directly, so modifying the wheel group as part of the image creation (note - # scripts could mount the rw etc from below instead) - - source: sudoers-wheel - destination: /etc/sudoers.d/wheel - # For tests, override the public trident.service behavior and use - # grpc-client commit. - - source: files/use-grpc-client-commit.conf - destination: /etc/systemd/system/trident.service.d/override.conf - - services: - enable: - - etc-mount - - sshd - - trident - - tridentd.socket - -scripts: - postCustomization: - - path: trident-debug-log.sh - # Script to create the /web directory - - path: create-web-dir.sh diff --git a/tests/images/trident-verity-testimage/base/create-web-dir.sh b/tests/images/trident-verity-testimage/base/create-web-dir.sh deleted file mode 100755 index 71f393a31a..0000000000 --- a/tests/images/trident-verity-testimage/base/create-web-dir.sh +++ /dev/null @@ -1,2 +0,0 @@ -# Create the web directory for testing -mkdir -p /web \ No newline at end of file diff --git a/tests/images/trident-verity-testimage/base/etc-mount.service b/tests/images/trident-verity-testimage/base/etc-mount.service deleted file mode 100644 index 7883ddf82f..0000000000 --- a/tests/images/trident-verity-testimage/base/etc-mount.service +++ /dev/null @@ -1,17 +0,0 @@ -[Unit] -Description=/etc Mount Service -DefaultDependencies=no -Conflicts=umount.target -Before=local-fs.target umount.target -Requires=etc.mount -After=etc.mount -Requires=var-lib-trident\x2doverlay.mount -After=var-lib-trident\x2doverlay.mount - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=etc-mount.sh - -[Install] -WantedBy=local-fs.target \ No newline at end of file diff --git a/tests/images/trident-verity-testimage/base/etc-mount.sh b/tests/images/trident-verity-testimage/base/etc-mount.sh deleted file mode 100755 index f9feb5db94..0000000000 --- a/tests/images/trident-verity-testimage/base/etc-mount.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -eux - -mount -t overlay overlay -o lowerdir=/etc,upperdir=/var/lib/trident-overlay/etc-rw/upper,workdir=/var/lib/trident-overlay/etc-rw/work /etc -# Workaround for https://dev.azure.com/mariner-org/ECF/_workitems/edit/7349/ -chmod o+rx /etc \ No newline at end of file diff --git a/tests/images/trident-verity-testimage/base/etc.mount b/tests/images/trident-verity-testimage/base/etc.mount deleted file mode 100644 index 8dd53647f9..0000000000 --- a/tests/images/trident-verity-testimage/base/etc.mount +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=/etc Overlay Mount -DefaultDependencies=no -Conflicts=shutdown.target - -[Mount] -What=overlay -Where=/etc -Type=overlay -Options=lowerdir=/etc,upperdir=/var/lib/trident-overlay/etc/upper,workdir=/var/lib/trident-overlay/etc/work,rw \ No newline at end of file diff --git a/tests/images/trident-verity-testimage/base/files/trident-container.service b/tests/images/trident-verity-testimage/base/files/trident-container.service deleted file mode 100644 index 98ce5f3e40..0000000000 --- a/tests/images/trident-verity-testimage/base/files/trident-container.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Trident Agent -Requires=docker.service -After=network.target network-online.target systemd-udev-settle.service docker.service - -[Service] -Type=oneshot -ExecStartPre=/bin/bash -c "set -e; if ! docker image ls | grep -q 'trident/trident'; then docker load --input /var/lib/trident/trident-container.tar.gz; fi" -ExecStart=docker run --name trident_container --pull=never --rm --privileged -v /etc/trident:/etc/trident -v /var/lib/trident:/var/lib/trident -v /var/log:/var/log -v /:/host -v /dev:/dev -v /run:/run -v /sys:/sys --pid host --ipc host trident/trident:latest commit --verbosity DEBUG -StandardOutput=journal+console -StandardError=journal+console - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/tests/images/trident-verity-testimage/base/files/use-grpc-client-commit.conf b/tests/images/trident-verity-testimage/base/files/use-grpc-client-commit.conf deleted file mode 100644 index 958e0095c3..0000000000 --- a/tests/images/trident-verity-testimage/base/files/use-grpc-client-commit.conf +++ /dev/null @@ -1,5 +0,0 @@ -[Service] -ExecStart= -ExecStart=trident grpc-client commit -StandardOutput=journal+console -StandardError=journal+console diff --git a/tests/images/trident-verity-testimage/base/sudoers-wheel b/tests/images/trident-verity-testimage/base/sudoers-wheel deleted file mode 100644 index c8b3629606..0000000000 --- a/tests/images/trident-verity-testimage/base/sudoers-wheel +++ /dev/null @@ -1 +0,0 @@ -%wheel ALL=(ALL:ALL) NOPASSWD: ALL \ No newline at end of file diff --git a/tests/images/trident-verity-testimage/base/trident-debug-log.sh b/tests/images/trident-verity-testimage/base/trident-debug-log.sh deleted file mode 100755 index da03d7c143..0000000000 --- a/tests/images/trident-verity-testimage/base/trident-debug-log.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -sed -i 's/--verbosity INFO/--verbosity DEBUG/' /usr/lib/systemd/system/trident.service \ No newline at end of file diff --git a/tests/images/trident-verity-testimage/usr/container.yaml b/tests/images/trident-verity-testimage/usr/container.yaml deleted file mode 100644 index 855cd0f10c..0000000000 --- a/tests/images/trident-verity-testimage/usr/container.yaml +++ /dev/null @@ -1,130 +0,0 @@ -storage: - disks: - - partitionTableType: gpt - maxSize: 5G - partitions: - - id: esp - type: esp - size: 500M - label: esp - - - id: boot - size: 150M - - - id: root - size: 2G - - - id: usr-data - label: usr - size: 1G - - - id: usr-hash - label: usr-hash - size: 128M - - bootType: efi - - verity: - - id: usr - name: usr - dataDeviceId: usr-data - hashDeviceId: usr-hash - dataDeviceMountIdType: uuid - hashDeviceMountIdType: uuid - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: boot - type: ext4 - mountPoint: - path: /boot - - - deviceId: root - type: ext4 - mountPoint: - path: / - - - deviceId: usr - type: ext4 - mountPoint: - path: /usr - options: defaults,ro - -os: - bootloader: - resetType: hard-reset - hostname: trident-container-usrverity-testimg - - selinux: - mode: disabled - - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.info - - log_buf_len=1M - - rd.hostonly=0 - - packages: - remove: - - grub2-efi-binary - - install: - - curl - - device-mapper - - docker-cli - - efibootmgr - - iproute - - iptables - - lvm2 - - mdadm - - moby-engine - - netplan - - openssh-server - - systemd-udev - - tpm2-tools - - veritysetup - - vim - - systemd-ukify - - systemd-boot - - efibootmgr - - squashfs-tools - - tar - - services: - enable: - - trident-container - - sshd - - uki: - mode: create - - additionalFiles: - # Add mdraid dracut module, this will enable installation on raid devices - - source: files/dracut-nohostonly.conf - destination: /usr/lib/dracut/dracut.conf.d/nohostonly.conf - - source: files/sudoers-wheel - destination: /etc/sudoers.d/wheel - - source: files/trident-container.service - destination: /usr/lib/systemd/system/trident-container.service - -output: - # Specifies config for output dir containining generated artifacts. This is - # required for later running inject-files command, so that the final image - # built via imagecustomizer is signed and SecureBoot can be enabled in E2E - # tests where UKI ROS is used. - artifacts: - items: - - ukis - path: ./output - -previewFeatures: - - uki - - output-artifacts diff --git a/tests/images/trident-verity-testimage/usr/files/dracut-nohostonly.conf b/tests/images/trident-verity-testimage/usr/files/dracut-nohostonly.conf deleted file mode 100644 index 18912360ca..0000000000 --- a/tests/images/trident-verity-testimage/usr/files/dracut-nohostonly.conf +++ /dev/null @@ -1 +0,0 @@ -hostonly="no" diff --git a/tests/images/trident-verity-testimage/usr/files/sudoers-wheel b/tests/images/trident-verity-testimage/usr/files/sudoers-wheel deleted file mode 100644 index c8b3629606..0000000000 --- a/tests/images/trident-verity-testimage/usr/files/sudoers-wheel +++ /dev/null @@ -1 +0,0 @@ -%wheel ALL=(ALL:ALL) NOPASSWD: ALL \ No newline at end of file diff --git a/tests/images/trident-verity-testimage/usr/files/trident-container.service b/tests/images/trident-verity-testimage/usr/files/trident-container.service deleted file mode 100644 index 98ce5f3e40..0000000000 --- a/tests/images/trident-verity-testimage/usr/files/trident-container.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Trident Agent -Requires=docker.service -After=network.target network-online.target systemd-udev-settle.service docker.service - -[Service] -Type=oneshot -ExecStartPre=/bin/bash -c "set -e; if ! docker image ls | grep -q 'trident/trident'; then docker load --input /var/lib/trident/trident-container.tar.gz; fi" -ExecStart=docker run --name trident_container --pull=never --rm --privileged -v /etc/trident:/etc/trident -v /var/lib/trident:/var/lib/trident -v /var/log:/var/log -v /:/host -v /dev:/dev -v /run:/run -v /sys:/sys --pid host --ipc host trident/trident:latest commit --verbosity DEBUG -StandardOutput=journal+console -StandardError=journal+console - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/tests/images/trident-verity-testimage/usr/files/use-grpc-client-commit.conf b/tests/images/trident-verity-testimage/usr/files/use-grpc-client-commit.conf deleted file mode 100644 index 958e0095c3..0000000000 --- a/tests/images/trident-verity-testimage/usr/files/use-grpc-client-commit.conf +++ /dev/null @@ -1,5 +0,0 @@ -[Service] -ExecStart= -ExecStart=trident grpc-client commit -StandardOutput=journal+console -StandardError=journal+console diff --git a/tests/images/trident-verity-testimage/usr/host.yaml b/tests/images/trident-verity-testimage/usr/host.yaml deleted file mode 100644 index 476178d805..0000000000 --- a/tests/images/trident-verity-testimage/usr/host.yaml +++ /dev/null @@ -1,136 +0,0 @@ -storage: - disks: - - partitionTableType: gpt - maxSize: 5G - partitions: - - id: esp - type: esp - size: 500M - label: esp - - - id: boot - size: 150M - - - id: root - size: 2G - - - id: usr-data - label: usr - size: 1G - - - id: usr-hash - label: usr-hash - size: 128M - - bootType: efi - - verity: - - id: usr - name: usr - dataDeviceId: usr-data - hashDeviceId: usr-hash - dataDeviceMountIdType: uuid - hashDeviceMountIdType: uuid - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: boot - type: ext4 - mountPoint: - path: /boot - - - deviceId: root - type: ext4 - mountPoint: - path: / - - - deviceId: usr - type: ext4 - mountPoint: - path: /usr - options: defaults,ro - -os: - bootloader: - resetType: hard-reset - hostname: trident-usrverity-testimg - - selinux: - mode: disabled - - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=ttyS0 - - rd.info - - log_buf_len=1M - - rd.hostonly=0 - - packages: - remove: - - grub2-efi-binary - - install: - - binutils - - curl - - device-mapper - - efibootmgr - - iproute - - iptables - - lvm2 - - mdadm - - netplan - - openssh-server - - systemd-udev - - tpm2-tools - - trident-service - # Package required for systemd-pcrlock & PCR-based encryption; can be removed once AZL 4.0 - # merges a fix to provide statically defined files inside the same package as the - # systemd-pcrlock binary, i.e. systemd-udev. - - trident-static-pcrlock-files - - veritysetup - - vim - - systemd-ukify - - systemd-boot - - efibootmgr - - audit - - selinux-policy-devel - - services: - enable: - - sshd - - trident - - tridentd.socket - uki: - mode: create - - additionalFiles: - - source: files/sudoers-wheel - destination: /etc/sudoers.d/wheel - # Add mdraid dracut module, this will enable installation on raid devices - - source: files/dracut-nohostonly.conf - destination: /usr/lib/dracut/dracut.conf.d/nohostonly.conf - # For tests, override the public trident.service behavior and use - # grpc-client commit. - - source: files/use-grpc-client-commit.conf - destination: /etc/systemd/system/trident.service.d/override.conf - -output: - # Specifies config for output dir containining generated artifacts. This is - # required for later running inject-files command, so that the final image - # built via imagecustomizer is signed and SecureBoot can be enabled in E2E - # tests where UKI ROS is used. - artifacts: - items: - - ukis - path: ./output - -previewFeatures: - - uki - - output-artifacts diff --git a/tests/images/trident-vm-testimage/README.md b/tests/images/trident-vm-testimage/README.md deleted file mode 100644 index d7f37b5e38..0000000000 --- a/tests/images/trident-vm-testimage/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# Trident VM Test Image - -This image is used for testing Trident adopting an already produced image (e.g. -generated by MIC). It is based on the baremetal -image and adds Trident as well as its dependencies. It also adds openssh-server -to allow for remote access. Finally, it contains duplicate set of partitions to -setup the disk layout for A/B update. - -Two sets of images are available: - -- regular -- with verity -- with UKI usr-verity for ACL-agent-driven A/B update testing - -For both, a set of corresponding update images is available. The ACL-agent -variant reuses the servicing-style VM image layout but additionally installs -`trident-acl-agent` so storm ACL-agent scenarios can drive a real in-guest -agent talking to `tridentd`. The base (qcow2) image installs the package but -leaves `trident-acl-agent.service` disabled -- the storm scenario delivers a -fake kubeconfig at runtime and enables/starts the service itself. Only the -update image enables `trident-acl-agent.service` by default, since after a -real A/B update boots into it there is no test harness left to `systemctl -enable --now` it. Neither image preseeds `/etc/trident/trident-acl-agent.conf` --- the harness never writes that file at all; instead it delivers a fake -kubeconfig to `/var/lib/kubelet/kubeconfig` and supplies the Nebraska -endpoint/appId/track per-request via the update-request annotation. - -## Additional Prerequisites - -- Artifacts - - **Trident RPMs**: expected in `bin/RPMS/**/*.rpm`. Can be created with - `make bin/trident-rpms.tar.gz` - -## Building - -To build the base image, run: - -| Image type | Make command | Output path | -| ---------- | ------------ | ----------- | -| Regular | `make artifacts/trident-vm-grub-testimage.qcow2` | `artifacts/trident-vm-grub-testimage.qcow2` | -| With verity `qcow2` | `make artifacts/trident-vm-grub-verity-testimage.qcow2` | `artifacts/trident-vm-grub-verity-testimage.qcow2` | -| With verity fixed size `vhd` | `make artifacts/trident-vm-grub-verity-testimage.vhd` | `artifacts/trident-vm-grub-verity-testimage.vhd` | -| ACL-agent UKI usr-verity `qcow2` | `make artifacts/trident-vm-acl-agent-testimage.qcow2` | `artifacts/trident-vm-acl-agent-testimage.qcow2` | - -To build the update images, run: - -| Image type | Make command | Output path | -| ---------- | ------------ | ----------- | -| Regular | `make trident-vm-grub-testimage` | `artifacts/trident-vm-grub-testimage/*` | -| With verity | `make trident-vm-grub-verity-testimage` | `artifacts/trident-vm-grub-testimage/*` | -| ACL-agent UKI usr-verity | `make artifacts/trident-vm-acl-agent-update-testimage.cosi` | `artifacts/trident-vm-acl-agent-update-testimage.cosi` | diff --git a/tests/images/trident-vm-testimage/base/.gitignore b/tests/images/trident-vm-testimage/base/.gitignore deleted file mode 100644 index 6c07ccac55..0000000000 --- a/tests/images/trident-vm-testimage/base/.gitignore +++ /dev/null @@ -1 +0,0 @@ -mic-config.yaml \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/baseimg-acl-agent.yaml b/tests/images/trident-vm-testimage/base/baseimg-acl-agent.yaml deleted file mode 100644 index 383e7e9857..0000000000 --- a/tests/images/trident-vm-testimage/base/baseimg-acl-agent.yaml +++ /dev/null @@ -1,211 +0,0 @@ -# UKI usr-verity VM test image for validating trident-acl-agent's -# label-driven A/B update protocol against a real tridentd. -storage: - bootType: efi - - disks: - - partitionTableType: gpt - partitions: - - id: esp - type: esp - label: esp - size: 512M - - - id: boot-a - size: 256M - - - id: boot-b - size: 256M - - - id: root-a - size: 4G - - - id: root-b - size: 4G - - - id: usr-a - size: 1G - - - id: usr-b - size: 1G - - - id: usr-hash-a - size: 128M - - - id: usr-hash-b - size: 128M - - - id: trident - label: trident - size: 512M - - - id: trident-acl-agent - label: trident-acl-agent - size: 128M - - - id: kubelet - label: kubelet - size: 128M - - - id: etc-trident - label: etc-trident - size: 128M - - - id: home - label: home - size: 1G - - - id: srv - label: srv - size: 128M - - verity: - - id: usrverity - name: usr - dataDeviceId: usr-a - hashDeviceId: usr-hash-a - dataDeviceMountIdType: uuid - hashDeviceMountIdType: uuid - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - idType: part-label - path: /boot/efi - options: umask=0077 - - - deviceId: boot-a - type: ext4 - mountPoint: - idType: uuid - path: /boot - - - deviceId: usrverity - type: ext4 - mountPoint: - path: /usr - options: defaults,ro - - - deviceId: root-a - type: ext4 - mountPoint: - idType: uuid - path: / - - - deviceId: trident - type: ext4 - mountPoint: - idType: part-label - path: /var/lib/trident - - - deviceId: trident-acl-agent - type: ext4 - mountPoint: - idType: part-label - path: /var/lib/trident-acl-agent - - - deviceId: kubelet - type: ext4 - mountPoint: - idType: part-label - path: /var/lib/kubelet - - - deviceId: etc-trident - type: ext4 - mountPoint: - idType: part-label - path: /etc/trident - - - deviceId: home - type: ext4 - mountPoint: - idType: part-label - path: /home - - - deviceId: srv - type: ext4 - mountPoint: - idType: part-label - path: /srv - -os: - bootloader: - resetType: hard-reset - hostname: trident-acl-agent-testimg - - selinux: - mode: disabled - - uki: - mode: create - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=tty1 - - console=ttyS0 - - rd.debug - - loglevel=6 - - log_buf_len=1M - - systemd.journald.forward_to_console=1 - - rd.hostonly=0 - - packages: - install: - - device-mapper - - dnf - - efibootmgr - - iproute - - iptables - - jq - - kexec-tools - - lvm2 - - openssh-server - - systemd-boot - - systemd-udev - - trident-acl - - veritysetup - - vim - - netplan - remove: - - grub2-efi-binary - - additionalFiles: - - source: files/99-dhcp-eth0.network - destination: /etc/systemd/network/99-dhcp-eth0.network - - source: files/sudoers-wheel - destination: /etc/sudoers.d/wheel - # Pins this scenario's expected annotation prefix/current-version key - # (see proxies/constants.go) to the AKS-era values it has always - # exercised, now that trident-acl-agent's compiled-in defaults are the - # generic acl.microsoft.com/VERSION_ID. Baked into both the base and - # update image builds directly, since a drop-in written at runtime - # under /etc/systemd/system does not survive this usr-verity image's - # A/B root swap. - - source: files/trident-acl-agent-override.conf - destination: /etc/systemd/system/trident-acl-agent.service.d/override.conf - - services: - enable: - - kdump - - tridentd.socket - - users: - - name: testuser - sshPublicKeyPaths: - - files/id_rsa.pub - secondaryGroups: - - wheel - -scripts: - postCustomization: - - path: scripts/post-install.sh - - path: scripts/update-host-status.sh - - path: scripts/prepare-update-config-verity.sh - arguments: - - uki - - path: scripts/duid-type-to-link-layer.sh - -previewFeatures: - - uki diff --git a/tests/images/trident-vm-testimage/base/baseimg-grub-verity-azure.yaml b/tests/images/trident-vm-testimage/base/baseimg-grub-verity-azure.yaml deleted file mode 100644 index 7da14975f6..0000000000 --- a/tests/images/trident-vm-testimage/base/baseimg-grub-verity-azure.yaml +++ /dev/null @@ -1,169 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - maxSize: 15G - partitions: - - id: esp - type: esp - size: 16M - - - id: boot-a - size: 256M - - - id: boot-b - size: 256M - - - id: root-a - size: 4G - - - id: root-b - size: 4G - - - id: root-hash-a - size: 128M - - - id: root-hash-b - size: 128M - - - id: var-a - size: 1G - - - id: var-b - size: 1G - - - id: trident-overlay-a - size: 32M - - - id: trident-overlay-b - size: 32M - - - id: trident - size: 512M - - - id: home - size: 1G - - - id: srv - size: grow - - verity: - - id: rootverity - name: root - dataDeviceId: root-a - hashDeviceId: root-hash-a - dataDeviceMountIdType: uuid - hashDeviceMountIdType: uuid - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: boot-a - type: ext4 - mountPoint: /boot - - - deviceId: rootverity - type: ext4 - mountPoint: - path: / - options: defaults,ro - - - deviceId: var-a - type: ext4 - mountPoint: /var - - - deviceId: trident-overlay-a - type: ext4 - mountPoint: /var/lib/trident-overlay - - - deviceId: trident - type: ext4 - mountPoint: /var/lib/trident - - - deviceId: home - type: ext4 - mountPoint: /home - - - deviceId: srv - type: ext4 - mountPoint: /srv - -os: - bootloader: - resetType: hard-reset - hostname: trident-vm-verity-testimg - - selinux: - mode: permissive - - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=tty1 - - console=ttyS0 - - rd.debug - - loglevel=6 - - log_buf_len=1M - - systemd.journald.forward_to_console=1 - - packages: - install: - - device-mapper - - dnf - - efibootmgr - - grub2-efi-binary - - iproute - - iptables - - jq - - kexec-tools - - lvm2 - - openssh-server - - selinux-policy - - systemd-udev - - trident - - veritysetup - - vim - - WALinuxAgent - - additionalFiles: - # Early boot one shot service to activate secondary rw /etc overlay - - source: files/etc-mount-mic.service - destination: /etc/systemd/system/etc-mount.service - # Script invoked by the service above to mount the /etc rw overlay - - source: files/etc-mount.sh - destination: /usr/local/bin/etc-mount.sh - - source: files/sshd-keygen.service - destination: /usr/lib/systemd/system/sshd-keygen.service - - source: files/99-dhcp-eth0.network - destination: /etc/systemd/network/99-dhcp-eth0.network - - source: files/sudoers-wheel - destination: /etc/sudoers.d/wheel - - services: - enable: - - etc-mount - - kdump - - tridentd.socket - - users: - - name: testuser - secondaryGroups: - - wheel - -scripts: - postCustomization: - - path: scripts/post-install.sh - - path: scripts/create-rw-overlay-dirs.sh - - path: scripts/update-host-status.sh - - path: scripts/prepare-update-config-verity.sh - arguments: - - "eth0" - - path: scripts/ssh-move-host-keys.sh - - path: scripts/create-ssh-dirs.sh - - path: scripts/duid-type-to-link-layer.sh diff --git a/tests/images/trident-vm-testimage/base/baseimg-grub-verity.yaml b/tests/images/trident-vm-testimage/base/baseimg-grub-verity.yaml deleted file mode 100644 index 11715cfc91..0000000000 --- a/tests/images/trident-vm-testimage/base/baseimg-grub-verity.yaml +++ /dev/null @@ -1,167 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - partitions: - - id: esp - type: esp - size: 512M - - - id: boot-a - size: 256M - - - id: boot-b - size: 256M - - - id: root-a - size: 4G - - - id: root-b - size: 4G - - - id: root-hash-a - size: 128M - - - id: root-hash-b - size: 128M - - - id: var-a - size: 1G - - - id: var-b - size: 1G - - - id: trident-overlay-a - size: 32M - - - id: trident-overlay-b - size: 32M - - - id: trident - size: 512M - - - id: home - size: 1G - - - id: srv - size: 128M - - verity: - - id: rootverity - name: root - dataDeviceId: root-a - hashDeviceId: root-hash-a - dataDeviceMountIdType: uuid - hashDeviceMountIdType: uuid - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: boot-a - type: ext4 - mountPoint: /boot - - - deviceId: rootverity - type: ext4 - mountPoint: - path: / - options: defaults,ro - - - deviceId: var-a - type: ext4 - mountPoint: /var - - - deviceId: trident-overlay-a - type: ext4 - mountPoint: /var/lib/trident-overlay - - - deviceId: trident - type: ext4 - mountPoint: /var/lib/trident - - - deviceId: home - type: ext4 - mountPoint: /home - - - deviceId: srv - type: ext4 - mountPoint: /srv - -os: - bootloader: - resetType: hard-reset - hostname: trident-vm-verity-testimg - - selinux: - mode: disabled - - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=tty1 - - console=ttyS0 - - rd.debug - - loglevel=6 - - log_buf_len=1M - - systemd.journald.forward_to_console=1 - - packages: - install: - - device-mapper - - dnf - - efibootmgr - - grub2-efi-binary - - iproute - - iptables - - jq - - kexec-tools - - lvm2 - - openssh-server - - systemd-udev - - trident - - veritysetup - - vim - - netplan - - additionalFiles: - # Early boot one shot service to activate secondary rw /etc overlay - - source: files/etc-mount-mic.service - destination: /etc/systemd/system/etc-mount.service - # Script invoked by the service above to mount the /etc rw overlay - - source: files/etc-mount.sh - destination: /usr/local/bin/etc-mount.sh - - source: files/sshd-keygen.service - destination: /usr/lib/systemd/system/sshd-keygen.service - - source: files/99-dhcp-eth0.network - destination: /etc/systemd/network/99-dhcp-eth0.network - - source: files/sudoers-wheel - destination: /etc/sudoers.d/wheel - - services: - enable: - - etc-mount - - kdump - - tridentd.socket - - users: - - name: testuser - sshPublicKeyPaths: - - files/id_rsa.pub - secondaryGroups: - - wheel - -scripts: - postCustomization: - - path: scripts/post-install.sh - - path: scripts/create-rw-overlay-dirs.sh - - path: scripts/update-host-status.sh - - path: scripts/prepare-update-config-verity.sh - - path: scripts/ssh-move-host-keys.sh - - path: scripts/create-ssh-dirs.sh - - path: scripts/duid-type-to-link-layer.sh diff --git a/tests/images/trident-vm-testimage/base/baseimg-grub.yaml b/tests/images/trident-vm-testimage/base/baseimg-grub.yaml deleted file mode 100644 index 0286a9a8a5..0000000000 --- a/tests/images/trident-vm-testimage/base/baseimg-grub.yaml +++ /dev/null @@ -1,101 +0,0 @@ -storage: - disks: - - partitionTableType: gpt - maxSize: 10G - partitions: - - id: esp - type: esp - size: 16M - - - id: root-a - size: 4G - - - id: root-b - size: 4G - - - id: trident - size: 1G - - - id: srv - size: grow - - bootType: efi - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - path: /boot/efi - options: umask=0077 - - - deviceId: root-a - type: ext4 - mountPoint: / - - - deviceId: trident - type: ext4 - mountPoint: /var/lib/trident - - - deviceId: srv - type: ext4 - mountPoint: /srv - -os: - bootloader: - resetType: hard-reset - hostname: trident-vm-testimg - - selinux: - mode: disabled - - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=tty1 - - console=ttyS0 - - rd.debug - - loglevel=6 - - log_buf_len=1M - - systemd.journald.forward_to_console=1 - - packages: - install: - - dnf - - efibootmgr - # Note: grub2-efi-binary-noprefix package is going to be the default grub package for azl3 - - grub2-efi-binary - - iproute - - iptables - - jq - - openssh-server - - trident-service - - vim - - netplan - services: - enable: - - tridentd.socket - - additionalFiles: - - source: files/sshd-keygen.service - destination: /usr/lib/systemd/system/sshd-keygen.service - - source: files/99-dhcp-eth0.network - destination: /etc/systemd/network/99-dhcp-eth0.network - - source: files/sudoers-wheel - destination: /etc/sudoers.d/wheel - - users: - - name: testuser - sshPublicKeyPaths: - - files/id_rsa.pub - secondaryGroups: - - wheel - -scripts: - postCustomization: - - path: scripts/post-install.sh - - path: scripts/update-host-status.sh - - path: scripts/prepare-update-config.sh - - path: scripts/ssh-move-host-keys.sh - - path: scripts/create-ssh-dirs.sh - - path: scripts/duid-type-to-link-layer.sh diff --git a/tests/images/trident-vm-testimage/base/baseimg-root-verity.yaml b/tests/images/trident-vm-testimage/base/baseimg-root-verity.yaml deleted file mode 100644 index 0ec362b70f..0000000000 --- a/tests/images/trident-vm-testimage/base/baseimg-root-verity.yaml +++ /dev/null @@ -1,180 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - partitions: - - id: esp - type: esp - label: esp - size: 512M - - - id: boot-a - size: 256M - - - id: boot-b - size: 256M - - - id: root-a - size: 4G - - - id: root-b - size: 4G - - - id: root-hash-a - size: 128M - - - id: root-hash-b - size: 128M - - - id: var-a - size: 1G - - - id: var-b - size: 1G - - - id: trident - label: trident - size: 512M - - - id: home - label: home - size: 1G - - - id: srv - label: srv - size: 128M - - verity: - - id: rootverity - name: root - dataDeviceId: root-a - hashDeviceId: root-hash-a - dataDeviceMountIdType: uuid - hashDeviceMountIdType: uuid - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - idType: part-label - path: /boot/efi - options: umask=0077 - - - deviceId: boot-a - type: ext4 - mountPoint: - idType: uuid - path: /boot - - - deviceId: rootverity - type: ext4 - mountPoint: - path: / - options: defaults,ro - - - deviceId: var-a - type: ext4 - mountPoint: - idType: uuid - path: /var - options: defaults,x-initrd.mount - - - deviceId: trident - type: ext4 - mountPoint: - idType: part-label - path: /var/lib/trident - - - deviceId: home - type: ext4 - mountPoint: - idType: part-label - path: /home - - - deviceId: srv - type: ext4 - mountPoint: - idType: part-label - path: /srv - -os: - bootloader: - resetType: hard-reset - hostname: trident-vm-root-verity-testimg - - selinux: - mode: disabled - - uki: - mode: create - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=tty1 - - console=ttyS0 - - rd.debug - - loglevel=6 - - log_buf_len=1M - - systemd.journald.forward_to_console=1 - - rd.hostonly=0 - - packages: - install: - - device-mapper - - dnf - - efibootmgr - - iproute - - iptables - - jq - - kexec-tools - - lvm2 - - openssh-server - - systemd-boot - - systemd-udev - - trident-service - - veritysetup - - vim - - netplan - remove: - - grub2-efi-binary - - additionalFiles: - - source: files/99-dhcp-eth0.network - destination: /etc/systemd/network/99-dhcp-eth0.network - - source: files/sudoers-wheel - destination: /etc/sudoers.d/wheel - - overlays: - - mountPoint: /etc - lowerDirs: [/etc] - upperDir: /var/lib/overlays/etc/upper - workDir: /var/lib/overlays/etc/work - mountDependencies: [/var] - isInitrdOverlay: true - - services: - enable: - - kdump - - trident - - tridentd.socket - - users: - - name: testuser - sshPublicKeyPaths: - - files/id_rsa.pub - secondaryGroups: - - wheel - -scripts: - postCustomization: - - path: scripts/post-install.sh - - path: scripts/update-host-status.sh - - path: scripts/prepare-update-config-verity.sh - arguments: - - uki - - path: scripts/duid-type-to-link-layer.sh - -previewFeatures: - - uki diff --git a/tests/images/trident-vm-testimage/base/baseimg-usr-verity.yaml b/tests/images/trident-vm-testimage/base/baseimg-usr-verity.yaml deleted file mode 100644 index ae5208a2bb..0000000000 --- a/tests/images/trident-vm-testimage/base/baseimg-usr-verity.yaml +++ /dev/null @@ -1,171 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - partitions: - - id: esp - type: esp - label: esp - size: 512M - - - id: boot-a - size: 256M - - - id: boot-b - size: 256M - - - id: root-a - size: 4G - - - id: root-b - size: 4G - - - id: usr-a - size: 1G - - - id: usr-b - size: 1G - - - id: usr-hash-a - size: 128M - - - id: usr-hash-b - size: 128M - - - id: trident - label: trident - size: 512M - - - id: home - label: home - size: 1G - - - id: srv - label: srv - size: 128M - - verity: - - id: usrverity - name: usr - dataDeviceId: usr-a - hashDeviceId: usr-hash-a - dataDeviceMountIdType: uuid - hashDeviceMountIdType: uuid - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - idType: part-label - path: /boot/efi - options: umask=0077 - - - deviceId: boot-a - type: ext4 - mountPoint: - idType: uuid - path: /boot - - - deviceId: usrverity - type: ext4 - mountPoint: - path: /usr - options: defaults,ro - - - deviceId: root-a - type: ext4 - mountPoint: - idType: uuid - path: / - - - deviceId: trident - type: ext4 - mountPoint: - idType: part-label - path: /var/lib/trident - - - deviceId: home - type: ext4 - mountPoint: - idType: part-label - path: /home - - - deviceId: srv - type: ext4 - mountPoint: - idType: part-label - path: /srv - -os: - bootloader: - resetType: hard-reset - hostname: trident-vm-usr-verity-testimg - - selinux: - mode: disabled - - uki: - mode: create - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=tty1 - - console=ttyS0 - - rd.debug - - loglevel=6 - - log_buf_len=1M - - systemd.journald.forward_to_console=1 - - rd.hostonly=0 - - packages: - install: - - device-mapper - - dnf - - efibootmgr - - iproute - - iptables - - jq - - kexec-tools - - lvm2 - - openssh-server - - systemd-boot - - systemd-udev - - trident-service - - veritysetup - - vim - - netplan - remove: - - grub2-efi-binary - - additionalFiles: - - source: files/99-dhcp-eth0.network - destination: /etc/systemd/network/99-dhcp-eth0.network - - source: files/sudoers-wheel - destination: /etc/sudoers.d/wheel - - services: - enable: - - kdump - - trident - - tridentd.socket - - users: - - name: testuser - sshPublicKeyPaths: - - files/id_rsa.pub - secondaryGroups: - - wheel - -scripts: - postCustomization: - - path: scripts/post-install.sh - - path: scripts/update-host-status.sh - - path: scripts/prepare-update-config-verity.sh - arguments: - - uki - - path: scripts/duid-type-to-link-layer.sh - -previewFeatures: - - uki diff --git a/tests/images/trident-vm-testimage/base/etc.mount b/tests/images/trident-vm-testimage/base/etc.mount deleted file mode 100644 index 8dd53647f9..0000000000 --- a/tests/images/trident-vm-testimage/base/etc.mount +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=/etc Overlay Mount -DefaultDependencies=no -Conflicts=shutdown.target - -[Mount] -What=overlay -Where=/etc -Type=overlay -Options=lowerdir=/etc,upperdir=/var/lib/trident-overlay/etc/upper,workdir=/var/lib/trident-overlay/etc/work,rw \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/files/.gitignore b/tests/images/trident-vm-testimage/base/files/.gitignore deleted file mode 100644 index 7ed8773999..0000000000 --- a/tests/images/trident-vm-testimage/base/files/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -host_status.yaml -config.yaml -id_rsa.pub \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/files/99-dhcp-eth0.network b/tests/images/trident-vm-testimage/base/files/99-dhcp-eth0.network deleted file mode 100644 index 5cef9e24f8..0000000000 --- a/tests/images/trident-vm-testimage/base/files/99-dhcp-eth0.network +++ /dev/null @@ -1,6 +0,0 @@ -[Match] -Name=eth0 - -[Network] -DHCP=yes -IPv6AcceptRA=no \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/files/etc-mount-mic.service b/tests/images/trident-vm-testimage/base/files/etc-mount-mic.service deleted file mode 100644 index 48f05860e4..0000000000 --- a/tests/images/trident-vm-testimage/base/files/etc-mount-mic.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=/etc Mount Service -DefaultDependencies=no -Conflicts=umount.target -Before=local-fs.target umount.target -Requires=var-lib-trident\x2doverlay.mount -After=var-lib-trident\x2doverlay.mount - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=etc-mount.sh commit-machine-id - -[Install] -WantedBy=local-fs.target \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/files/etc-mount.service b/tests/images/trident-vm-testimage/base/files/etc-mount.service deleted file mode 100644 index a90c052deb..0000000000 --- a/tests/images/trident-vm-testimage/base/files/etc-mount.service +++ /dev/null @@ -1,17 +0,0 @@ -[Unit] -Description=/etc Mount Service -DefaultDependencies=no -Conflicts=umount.target -Before=local-fs.target umount.target systemd-networkd.service -Requires=etc.mount -After=etc.mount -Requires=var-lib-trident\x2doverlay.mount -After=var-lib-trident\x2doverlay.mount - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=etc-mount.sh - -[Install] -WantedBy=local-fs.target \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/files/etc-mount.sh b/tests/images/trident-vm-testimage/base/files/etc-mount.sh deleted file mode 100755 index b187511aca..0000000000 --- a/tests/images/trident-vm-testimage/base/files/etc-mount.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -ex - -# TODO: figure out why we are missing systemd-machine-id-commit service, which should automate this -if [ "$1" == "commit-machine-id" ]; then - MACHINEID=`cat /etc/machine-id` - echo $MACHINEID - # if machine-id has a mount point, unmount it - if grep -q /etc/machine-id /proc/mounts; then - umount /etc/machine-id - fi -fi - -mount -t overlay overlay -o lowerdir=/etc,upperdir=/var/lib/trident-overlay/etc-rw/upper,workdir=/var/lib/trident-overlay/etc-rw/work /etc -# Workaround for dracut overlayfs module mounting /etc overlay as 755 on clean install and -# 750 on abupdate -chmod o+rx /etc - -if [ "$1" == "commit-machine-id" ]; then - echo Committing machine-id - echo $MACHINEID > /etc/machine-id - cat /etc/machine-id -fi \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/files/sshd-keygen.service b/tests/images/trident-vm-testimage/base/files/sshd-keygen.service deleted file mode 100644 index ab8532cd74..0000000000 --- a/tests/images/trident-vm-testimage/base/files/sshd-keygen.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Generate sshd host keys -ConditionPathExists=|!/srv/etc/ssh/ssh_host_rsa_key -ConditionPathExists=|!/srv/etc/ssh/ssh_host_ecdsa_key -ConditionPathExists=|!/srv/etc/ssh/ssh_host_ed25519_key -Before=sshd.service - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/usr/bin/ssh-keygen -A -f /srv - -[Install] -WantedBy=multi-user.target diff --git a/tests/images/trident-vm-testimage/base/files/sudoers-wheel b/tests/images/trident-vm-testimage/base/files/sudoers-wheel deleted file mode 100644 index c8b3629606..0000000000 --- a/tests/images/trident-vm-testimage/base/files/sudoers-wheel +++ /dev/null @@ -1 +0,0 @@ -%wheel ALL=(ALL:ALL) NOPASSWD: ALL \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/files/trident-acl-agent-cert-install.service b/tests/images/trident-vm-testimage/base/files/trident-acl-agent-cert-install.service deleted file mode 100644 index 9f9b85e086..0000000000 --- a/tests/images/trident-vm-testimage/base/files/trident-acl-agent-cert-install.service +++ /dev/null @@ -1,28 +0,0 @@ -[Unit] -Description=Install trident-acl-agent storm test CA cert into system trust store -# Test-harness-only plumbing: this file only exists when a storm test run -# has written an ephemeral CA cert onto the persistent, non-A/B -# /var/lib/trident-acl-agent partition (see prepareVmForAclAgent in -# tools/storm/aclagent/tests/update.go). It never exists on a real -# deployment. Skips as a no-op (not a failure) when absent, e.g. before the -# harness has run at all, or for run-rollback, which never uses Nebraska. -ConditionPathExists=/var/lib/trident-acl-agent/nebraska-ca.pem -Before=trident-acl-agent.service - -[Service] -Type=oneshot -RemainAfterExit=yes -# Re-derives the system trust store install every boot: /etc is part of -# this usr-verity image's A/B-swapped root (an overlay backed by the -# per-slot trident-overlay-a/-b partitions), so neither step below carries -# over across a reboot into the other slot, unlike the source cert on -# /var/lib/trident-acl-agent. -ExecStart=/bin/sh -c ' \ - cp /var/lib/trident-acl-agent/nebraska-ca.pem /etc/pki/ca-trust/source/anchors/trident-acl-agent-storm-test-ca.pem && \ - update-ca-trust extract && \ - cp /etc/pki/ca-trust/source/anchors/trident-acl-agent-storm-test-ca.pem /etc/pki/tls/certs/trident-acl-agent-storm-test-ca.pem && \ - openssl rehash /etc/pki/tls/certs \ - ' - -[Install] -WantedBy=multi-user.target diff --git a/tests/images/trident-vm-testimage/base/files/trident-acl-agent-override.conf b/tests/images/trident-vm-testimage/base/files/trident-acl-agent-override.conf deleted file mode 100644 index 9529661983..0000000000 --- a/tests/images/trident-vm-testimage/base/files/trident-acl-agent-override.conf +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Wants=trident-acl-agent-cert-install.service -After=trident-acl-agent-cert-install.service - -[Service] -Environment=TRIDENT_ACL_AGENT_KUBERNETES_ANNOTATION_PREFIX=acl.azure.com -Environment=TRIDENT_ACL_AGENT_CURRENT_VERSION_KEY=IMAGE_VERSION -Environment=TRIDENT_ACL_AGENT_ORCHESTRATION_MODE=annotations -Environment=TRIDENT_ACL_AGENT_CURRENT_VERSION_PATH=/etc/os-release -Environment=TRIDENT_ACL_AGENT_CURRENT_VERSION_FALLBACK=always diff --git a/tests/images/trident-vm-testimage/base/files/use-grpc-client-commit.conf b/tests/images/trident-vm-testimage/base/files/use-grpc-client-commit.conf deleted file mode 100644 index 958e0095c3..0000000000 --- a/tests/images/trident-vm-testimage/base/files/use-grpc-client-commit.conf +++ /dev/null @@ -1,5 +0,0 @@ -[Service] -ExecStart= -ExecStart=trident grpc-client commit -StandardOutput=journal+console -StandardError=journal+console diff --git a/tests/images/trident-vm-testimage/base/scripts/create-rw-overlay-dirs.sh b/tests/images/trident-vm-testimage/base/scripts/create-rw-overlay-dirs.sh deleted file mode 100755 index 56f74ceb13..0000000000 --- a/tests/images/trident-vm-testimage/base/scripts/create-rw-overlay-dirs.sh +++ /dev/null @@ -1,2 +0,0 @@ -mkdir -p /var/lib/trident-overlay/etc-rw/upper -mkdir -p /var/lib/trident-overlay/etc-rw/work \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/scripts/create-ssh-dirs.sh b/tests/images/trident-vm-testimage/base/scripts/create-ssh-dirs.sh deleted file mode 100755 index 6454a7a0e3..0000000000 --- a/tests/images/trident-vm-testimage/base/scripts/create-ssh-dirs.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Move the SSH host keys off the read-only /etc directory, so that sshd can run. -SSH_VAR_DIR="/srv/etc/ssh/" -mkdir -p "$SSH_VAR_DIR" diff --git a/tests/images/trident-vm-testimage/base/scripts/duid-type-to-link-layer.sh b/tests/images/trident-vm-testimage/base/scripts/duid-type-to-link-layer.sh deleted file mode 100755 index 5c35e32cf2..0000000000 --- a/tests/images/trident-vm-testimage/base/scripts/duid-type-to-link-layer.sh +++ /dev/null @@ -1 +0,0 @@ -sed -i 's/#DUIDType=vendor/DUIDType=link-layer/' /etc/systemd/networkd.conf \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/scripts/lsblk.sh b/tests/images/trident-vm-testimage/base/scripts/lsblk.sh deleted file mode 100644 index 39b5518e72..0000000000 --- a/tests/images/trident-vm-testimage/base/scripts/lsblk.sh +++ /dev/null @@ -1 +0,0 @@ -lsblk --json --output-all --bytes \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/scripts/post-install.sh b/tests/images/trident-vm-testimage/base/scripts/post-install.sh deleted file mode 100755 index b960507cd1..0000000000 --- a/tests/images/trident-vm-testimage/base/scripts/post-install.sh +++ /dev/null @@ -1,2 +0,0 @@ -# Add the necessary directories for the audit logs so that auditd can start -mkdir -p /var/log/audit \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/scripts/prepare-update-config-usrverity.sh b/tests/images/trident-vm-testimage/base/scripts/prepare-update-config-usrverity.sh deleted file mode 100755 index 82663a13d3..0000000000 --- a/tests/images/trident-vm-testimage/base/scripts/prepare-update-config-usrverity.sh +++ /dev/null @@ -1,9 +0,0 @@ -CONFIG_PATH=/var/lib/trident/update-config.yaml -DOWNLOAD_URL_PREFIX="http://192.168.122.1:8000" - -cp /etc/trident/config.yaml $CONFIG_PATH -cat <> $CONFIG_PATH -image: - url: $DOWNLOAD_URL_PREFIX/usrverity.cosi - sha384: ignored -EOF \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/scripts/prepare-update-config-verity.sh b/tests/images/trident-vm-testimage/base/scripts/prepare-update-config-verity.sh deleted file mode 100755 index 600151fdd8..0000000000 --- a/tests/images/trident-vm-testimage/base/scripts/prepare-update-config-verity.sh +++ /dev/null @@ -1,36 +0,0 @@ -CONFIG_PATH=/var/lib/trident/update-config.yaml -DOWNLOAD_URL_PREFIX="http://192.168.122.1:8000" - -cat < $CONFIG_PATH -image: - url: $DOWNLOAD_URL_PREFIX/verity.cosi - sha384: ignored -EOF - -INTERFACE_MASK='enp*' -if [ "$1" == "eth0" ]; then - INTERFACE_MASK="$1" -fi - -if [ "$1" != "uki" ]; then - cat <> $CONFIG_PATH -scripts: - postConfigure: - - name: rw-overlay - runOn: [all] - content: | - mkdir -p /var/lib/trident-overlay/etc-rw/upper && mkdir -p /var/lib/trident-overlay/etc-rw/work -EOF -fi - -cat <> $CONFIG_PATH -internalParams: - allowUnusedFilesystems: true -EOF - -if [ "$1" == "uki" ]; then - cat <> $CONFIG_PATH - uki: true - disableGrubNoprefixCheck: true -EOF -fi diff --git a/tests/images/trident-vm-testimage/base/scripts/prepare-update-config.sh b/tests/images/trident-vm-testimage/base/scripts/prepare-update-config.sh deleted file mode 100755 index df4ddb8143..0000000000 --- a/tests/images/trident-vm-testimage/base/scripts/prepare-update-config.sh +++ /dev/null @@ -1,9 +0,0 @@ -CONFIG_PATH=/var/lib/trident/update-config.yaml -DOWNLOAD_URL_PREFIX="http://192.168.122.1:8000" - -cp /etc/trident/config.yaml $CONFIG_PATH -cat <> $CONFIG_PATH -image: - url: $DOWNLOAD_URL_PREFIX/regular.cosi - sha384: ignored -EOF \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/scripts/ssh-move-host-keys.sh b/tests/images/trident-vm-testimage/base/scripts/ssh-move-host-keys.sh deleted file mode 100755 index 7891a607ac..0000000000 --- a/tests/images/trident-vm-testimage/base/scripts/ssh-move-host-keys.sh +++ /dev/null @@ -1,9 +0,0 @@ -# Move the SSH host keys off the read-only /etc directory, so that sshd can run. -SSH_VAR_DIR="/srv/etc/ssh/" - -cat << EOF >> /etc/ssh/sshd_config - -HostKey $SSH_VAR_DIR/ssh_host_rsa_key -HostKey $SSH_VAR_DIR/ssh_host_ecdsa_key -HostKey $SSH_VAR_DIR/ssh_host_ed25519_key -EOF diff --git a/tests/images/trident-vm-testimage/base/scripts/update-host-status.sh b/tests/images/trident-vm-testimage/base/scripts/update-host-status.sh deleted file mode 100755 index 4a69a02213..0000000000 --- a/tests/images/trident-vm-testimage/base/scripts/update-host-status.sh +++ /dev/null @@ -1 +0,0 @@ -trident offline-initialize diff --git a/tests/images/trident-vm-testimage/base/scripts/update-os-release.sh b/tests/images/trident-vm-testimage/base/scripts/update-os-release.sh deleted file mode 100755 index d28e1c109d..0000000000 --- a/tests/images/trident-vm-testimage/base/scripts/update-os-release.sh +++ /dev/null @@ -1,2 +0,0 @@ -printf -v DATE '%(%Y%m%d)T' -1 -sed -i "s/VERSION=\".*\"/VERSION=\"$DATE\"/" /etc/os-release \ No newline at end of file diff --git a/tests/images/trident-vm-testimage/base/updateimg-acl-agent.yaml b/tests/images/trident-vm-testimage/base/updateimg-acl-agent.yaml deleted file mode 100644 index b6a8f725fb..0000000000 --- a/tests/images/trident-vm-testimage/base/updateimg-acl-agent.yaml +++ /dev/null @@ -1,218 +0,0 @@ -# UKI usr-verity VM test image for validating trident-acl-agent's -# label-driven A/B update protocol against a real tridentd. -# -# This is the "update" counterpart to baseimg-acl-agent.yaml: it is built as -# a .cosi and served to the initial qcow2-booted VM as the A/B update target, -# not booted directly. Unlike the qcow2 base image, this image enables -# trident-acl-agent.service by default, since after a real A/B update boots -# into this image's root, there is no SSH session available anymore to -# `systemctl enable --now` it as the storm test harness does for the initial -# qcow2 boot. -storage: - bootType: efi - - disks: - - partitionTableType: gpt - partitions: - - id: esp - type: esp - label: esp - size: 512M - - - id: boot-a - size: 256M - - - id: boot-b - size: 256M - - - id: root-a - size: 4G - - - id: root-b - size: 4G - - - id: usr-a - size: 1G - - - id: usr-b - size: 1G - - - id: usr-hash-a - size: 128M - - - id: usr-hash-b - size: 128M - - - id: trident - label: trident - size: 512M - - - id: trident-acl-agent - label: trident-acl-agent - size: 128M - - - id: kubelet - label: kubelet - size: 128M - - - id: etc-trident - label: etc-trident - size: 128M - - - id: home - label: home - size: 1G - - - id: srv - label: srv - size: 128M - - verity: - - id: usrverity - name: usr - dataDeviceId: usr-a - hashDeviceId: usr-hash-a - dataDeviceMountIdType: uuid - hashDeviceMountIdType: uuid - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - idType: part-label - path: /boot/efi - options: umask=0077 - - - deviceId: boot-a - type: ext4 - mountPoint: - idType: uuid - path: /boot - - - deviceId: usrverity - type: ext4 - mountPoint: - path: /usr - options: defaults,ro - - - deviceId: root-a - type: ext4 - mountPoint: - idType: uuid - path: / - - - deviceId: trident - type: ext4 - mountPoint: - idType: part-label - path: /var/lib/trident - - - deviceId: trident-acl-agent - type: ext4 - mountPoint: - idType: part-label - path: /var/lib/trident-acl-agent - - - deviceId: kubelet - type: ext4 - mountPoint: - idType: part-label - path: /var/lib/kubelet - - - deviceId: etc-trident - type: ext4 - mountPoint: - idType: part-label - path: /etc/trident - - - deviceId: home - type: ext4 - mountPoint: - idType: part-label - path: /home - - - deviceId: srv - type: ext4 - mountPoint: - idType: part-label - path: /srv - -os: - bootloader: - resetType: hard-reset - hostname: trident-acl-agent-testimg - - selinux: - mode: disabled - - uki: - mode: create - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=tty1 - - console=ttyS0 - - rd.debug - - loglevel=6 - - log_buf_len=1M - - systemd.journald.forward_to_console=1 - - rd.hostonly=0 - - packages: - install: - - device-mapper - - dnf - - efibootmgr - - iproute - - iptables - - jq - - kexec-tools - - lvm2 - - openssh-server - - systemd-boot - - systemd-udev - - trident-acl - - veritysetup - - vim - - netplan - remove: - - grub2-efi-binary - - additionalFiles: - - source: files/99-dhcp-eth0.network - destination: /etc/systemd/network/99-dhcp-eth0.network - - source: files/sudoers-wheel - destination: /etc/sudoers.d/wheel - # See baseimg-acl-agent.yaml for why this is baked in rather than - # written at runtime. - - source: files/trident-acl-agent-override.conf - destination: /etc/systemd/system/trident-acl-agent.service.d/override.conf - - source: files/trident-acl-agent-cert-install.service - destination: /etc/systemd/system/trident-acl-agent-cert-install.service - - services: - enable: - - kdump - - tridentd.socket - - trident-acl-agent-cert-install.service - - trident-acl-agent.service - - users: - - name: testuser - sshPublicKeyPaths: - - files/id_rsa.pub - secondaryGroups: - - wheel - -scripts: - postCustomization: - - path: scripts/post-install.sh - - path: scripts/update-host-status.sh - - path: scripts/prepare-update-config-verity.sh - arguments: - - uki - - path: scripts/duid-type-to-link-layer.sh - -previewFeatures: - - uki diff --git a/tests/images/trident-vm-testimage/base/updateimg-grub-verity-azure.yaml b/tests/images/trident-vm-testimage/base/updateimg-grub-verity-azure.yaml deleted file mode 100644 index 6bde755308..0000000000 --- a/tests/images/trident-vm-testimage/base/updateimg-grub-verity-azure.yaml +++ /dev/null @@ -1,156 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - maxSize: 7G - partitions: - - id: esp - type: esp - size: 8M - - - id: boot - size: 256M - - - id: root - size: 4G - - - id: root-hash - size: 128M - - - id: var - size: 1G - - - id: trident-overlay - size: 32M - - - id: srv - size: 1G - - - id: home - size: 32M - - verity: - - id: rootverity - name: root - dataDeviceId: root - hashDeviceId: root-hash - dataDeviceMountIdType: uuid - hashDeviceMountIdType: uuid - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - options: umask=0077 - path: /boot/efi - - - deviceId: boot - type: ext4 - mountPoint: - path: /boot - - - deviceId: rootverity - type: ext4 - mountPoint: - path: / - options: defaults,ro - - - deviceId: var - type: ext4 - mountPoint: - path: /var - - - deviceId: trident-overlay - type: ext4 - mountPoint: - path: /var/lib/trident-overlay - - - deviceId: srv - type: ext4 - mountPoint: - path: /srv - - - deviceId: home - type: ext4 - mountPoint: - path: /home - -os: - bootloader: - resetType: hard-reset - hostname: trident-vm-testimg - - selinux: - mode: permissive - - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=tty1 - - console=ttyS0 - - rd.debug - - loglevel=6 - - log_buf_len=1M - - systemd.journald.forward_to_console=1 - - packages: - install: - - curl - - device-mapper - - dnf - - dracut-overlayfs - - efibootmgr - - grub2-efi-binary-noprefix - - iproute - - iptables - - jq - - kexec-tools - - lsof - - lvm2 - - netplan - - openssh-server - - selinux-policy - - systemd-udev - - trident-service - - veritysetup - - vim - - WALinuxAgent - remove: - - grub2-efi-binary - - additionalFiles: - # Early boot one shot service to activate secondary rw /etc overlay - - source: files/etc-mount.service - destination: /etc/systemd/system/etc-mount.service - # Script invoked by the service above to mount the /etc rw overlay - - source: files/etc-mount.sh - destination: /usr/local/bin/etc-mount.sh - - source: files/sudoers-wheel - destination: /etc/sudoers.d/wheel - - source: files/99-dhcp-eth0.network - destination: /etc/systemd/network/99-dhcp-eth0.network - # For tests, override the public trident.service behavior and use - # grpc-client commit. - - source: files/use-grpc-client-commit.conf - destination: /etc/systemd/system/trident.service.d/override.conf - - services: - enable: - - etc-mount - - kdump - - trident - - tridentd.socket - - users: - - name: testuser - secondaryGroups: - - wheel - -scripts: - postCustomization: - - path: scripts/post-install.sh - - path: scripts/ssh-move-host-keys.sh - - path: scripts/update-os-release.sh - - path: scripts/duid-type-to-link-layer.sh diff --git a/tests/images/trident-vm-testimage/base/updateimg-grub-verity.yaml b/tests/images/trident-vm-testimage/base/updateimg-grub-verity.yaml deleted file mode 100644 index db03d2c61f..0000000000 --- a/tests/images/trident-vm-testimage/base/updateimg-grub-verity.yaml +++ /dev/null @@ -1,151 +0,0 @@ -storage: - bootType: efi - - disks: - - partitionTableType: gpt - partitions: - - id: esp - type: esp - size: 8M - - - id: boot - size: 256M - - - id: root - size: 4G - - - id: root-hash - size: 128M - - - id: var - size: 1G - - - id: trident-overlay - size: 32M - - - id: srv - size: 1G - - - id: home - size: 32M - - verity: - - id: rootverity - name: root - dataDeviceId: root - hashDeviceId: root-hash - dataDeviceMountIdType: uuid - hashDeviceMountIdType: uuid - - filesystems: - - deviceId: esp - type: fat32 - mountPoint: - options: umask=0077 - path: /boot/efi - - - deviceId: boot - type: ext4 - mountPoint: /boot - - - deviceId: rootverity - type: ext4 - mountPoint: - path: / - options: defaults,ro - - - deviceId: var - type: ext4 - mountPoint: /var - - - deviceId: trident-overlay - type: ext4 - mountPoint: /var/lib/trident-overlay - - # Throwaway - - deviceId: srv - type: ext4 - mountPoint: /srv - - deviceId: home - type: ext4 - mountPoint: /home - -os: - bootloader: - resetType: hard-reset - hostname: trident-vm-verity-testimg - - selinux: - mode: disabled - - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=tty1 - - console=ttyS0 - - rd.debug - - loglevel=6 - - log_buf_len=1M - - systemd.journald.forward_to_console=1 - - packages: - install: - - curl - - device-mapper - - dnf - - dracut-overlayfs - - efibootmgr - - grub2-efi-binary-noprefix - - iproute - - iptables - - jq - - kexec-tools - - lsof - - lvm2 - - netplan - - openssh-server - - systemd-udev - - trident-service - - veritysetup - - vim - - netplan - remove: - - grub2-efi-binary - - additionalFiles: - # Early boot one shot service to activate secondary rw /etc overlay - - source: files/etc-mount.service - destination: /etc/systemd/system/etc-mount.service - # Script invoked by the service above to mount the /etc rw overlay - - source: files/etc-mount.sh - destination: /usr/local/bin/etc-mount.sh - - source: files/sudoers-wheel - destination: /etc/sudoers.d/wheel - - source: files/99-dhcp-eth0.network - destination: /etc/systemd/network/99-dhcp-eth0.network - # For tests, override the public trident.service behavior and use - # grpc-client commit. - - source: files/use-grpc-client-commit.conf - destination: /etc/systemd/system/trident.service.d/override.conf - - services: - enable: - - etc-mount - - kdump - - trident - - tridentd.socket - - users: - - name: testuser - sshPublicKeyPaths: - - files/id_rsa.pub - secondaryGroups: - - wheel - -scripts: - postCustomization: - - path: scripts/post-install.sh - - path: scripts/ssh-move-host-keys.sh - - path: scripts/update-os-release.sh - - path: scripts/duid-type-to-link-layer.sh diff --git a/tests/images/trident-vm-testimage/base/updateimg-grub.yaml b/tests/images/trident-vm-testimage/base/updateimg-grub.yaml deleted file mode 100644 index 02b2cd0723..0000000000 --- a/tests/images/trident-vm-testimage/base/updateimg-grub.yaml +++ /dev/null @@ -1,81 +0,0 @@ -storage: - bootType: efi - disks: - - maxSize: 5G - partitionTableType: gpt - partitions: - - id: esp - size: 8M - type: esp - - id: root - size: 4G - - filesystems: - - deviceId: esp - mountPoint: - options: umask=0077 - path: /boot/efi - type: fat32 - - deviceId: root - mountPoint: / - type: ext4 - -os: - hostname: trident-vm-testimg - packages: - install: - - curl - - dnf - - efibootmgr - - grub2-efi-binary-noprefix - - iproute - - iptables - - jq - - lsof - - netplan - - openssh-server - - trident-service - - vim - - netplan - remove: - - grub2-efi-binary - bootloader: - resetType: hard-reset - selinux: - mode: disabled - kernelCommandLine: - # Replicates BM base image settings, that would otherwise be lost - extraCommandLine: - - console=tty0 - - console=tty1 - - console=ttyS0 - - rd.debug - - loglevel=6 - - log_buf_len=1M - - systemd.journald.forward_to_console=1 - services: - enable: - - trident - - tridentd.socket - users: - - name: testuser - sshPublicKeyPaths: - - files/id_rsa.pub - secondaryGroups: - - wheel - additionalFiles: - - source: files/sudoers-wheel - destination: /etc/sudoers.d/wheel - - source: files/99-dhcp-eth0.network - destination: /etc/systemd/network/99-dhcp-eth0.network - # For tests, override the public trident.service behavior and use - # grpc-client commit. - - source: files/use-grpc-client-commit.conf - destination: /etc/systemd/system/trident.service.d/override.conf - -scripts: - postCustomization: - - path: scripts/post-install.sh - - path: scripts/ssh-move-host-keys.sh - - path: scripts/duid-type-to-link-layer.sh - - path: scripts/update-os-release.sh