Compare commits

...

No commits in common. "c8" and "c8s" have entirely different histories.
c8 ... c8s

18 changed files with 32450 additions and 11 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

25
.gitignore vendored
View File

@ -1 +1,24 @@
SOURCES/osbuild-110.tar.gz SOURCES/osbuild-80.tar.gz
/osbuild-80.tar.gz
/osbuild-81.tar.gz
/osbuild-82.tar.gz
/osbuild-84.tar.gz
/osbuild-85.tar.gz
/osbuild-86.tar.gz
/osbuild-87.tar.gz
/osbuild-88.tar.gz
/osbuild-89.tar.gz
/osbuild-90.tar.gz
/osbuild-91.tar.gz
/osbuild-92.tar.gz
/osbuild-93.tar.gz
/osbuild-94.tar.gz
/osbuild-95.tar.gz
/osbuild-96.tar.gz
/osbuild-100.tar.gz
/osbuild-101.tar.gz
/osbuild-104.tar.gz
/osbuild-105.tar.gz
/osbuild-106.tar.gz
/osbuild-109.tar.gz
/osbuild-110.tar.gz

37
PR1610.patch Normal file
View File

@ -0,0 +1,37 @@
From bdbecf4a695750abc4488e893241df80389c2aa6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= <thozza@redhat.com>
Date: Thu, 22 Feb 2024 20:47:03 +0100
Subject: [PATCH] Sources/containers-storage: make the code Python 3.6
compliant
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The source implementation used `subprocess.run()` argument
`capture_output`, which was added in Python 3.7. Since the minimum
supported Python version for osbuild on RHEL-8 is 3.6, the stage fails
with TypeError.
Example failure: https://artifacts.dev.testing-farm.io/c147b608-c40e-46ed-bf11-6b15ecf718dc/
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
---
sources/org.osbuild.containers-storage | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sources/org.osbuild.containers-storage b/sources/org.osbuild.containers-storage
index f83eb4fa..ea18e08c 100755
--- a/sources/org.osbuild.containers-storage
+++ b/sources/org.osbuild.containers-storage
@@ -77,7 +77,7 @@ class ContainersStorageSource(sources.SourceService):
image_id = checksum.split(":")[1]
source = self.local_image_name(image_id)
res = sp.run(["skopeo", "inspect", "--raw", "--config", source],
- check=False, capture_output=True, universal_newlines=True)
+ check=False, stdout=sp.PIPE, stderr=sp.PIPE, universal_newlines=True)
# fail early if the user hasn't imported the container into
# containers-storage
--
2.43.2

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -9,7 +9,7 @@ Version: 110
%global pkgdir %{_prefix}/lib/%{pypi_name} %global pkgdir %{_prefix}/lib/%{pypi_name}
Name: %{pypi_name} Name: %{pypi_name}
Release: 1%{?dist}.alma.1 Release: 1%{?dist}
License: Apache-2.0 License: Apache-2.0
URL: %{forgeurl} URL: %{forgeurl}
@ -164,12 +164,6 @@ bzip2 -9 osbuild.pp
%install %install
%py3_install %py3_install
ln -rs %{_builddir}/%{name}-%{version}/runners/org.osbuild.rhel82 %{_builddir}/%{name}-%{version}/runners/org.osbuild.almalinux8
%if 0%{?almalinux} >= 9
ln -rs %{_builddir}/%{name}-%{version}/runners/org.osbuild.centos9 %{_builddir}/%{name}-%{version}/runners/org.osbuild.almalinux9
%endif
mkdir -p %{buildroot}%{pkgdir}/stages mkdir -p %{buildroot}%{pkgdir}/stages
install -p -m 0755 $(find stages -type f -not -name "test_*.py") %{buildroot}%{pkgdir}/stages/ install -p -m 0755 $(find stages -type f -not -name "test_*.py") %{buildroot}%{pkgdir}/stages/
@ -302,11 +296,9 @@ fi
%{_libexecdir}/osbuild-depsolve-dnf %{_libexecdir}/osbuild-depsolve-dnf
%changelog %changelog
* Wed Mar 27 2024 Eduard Abdullin <eabdullin@almalinux.org> - 110-1.alma
- Add AlmaLinux runners
* Mon Feb 26 2024 imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> - 110-1 * Mon Feb 26 2024 imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> - 110-1
- New upstream release - New upstream release
* Thu Feb 22 2024 imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> - 109-1 * Thu Feb 22 2024 imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> - 109-1
- New upstream release - New upstream release

View File

@ -0,0 +1,10 @@
summary: Run osbuild integration tests
prepare:
how: install
package:
- osbuild
discover:
how: fmf
filter: tag:integration-test
execute:
how: tmt

12
plans/unit-tests.fmf Normal file
View File

@ -0,0 +1,12 @@
summary: Run osbuild unit tests from dist-git sources
prepare:
how: install
package:
- git
- make
- osbuild
discover:
how: fmf
filter: tag:unit-test
execute:
how: tmt

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (osbuild-110.tar.gz) = 14a88b34fe266222dbb8b10f0c69667642df6d6d6fa3cfb283d3227e6f07cce3912de3f7d7ad08bf8df44d19e70b19f8ad21e3af84523f3871c7abdf8ef02cd9

View File

@ -0,0 +1,49 @@
#!/usr/bin/bash
set -euxo pipefail
MANIFESTS_DIR=$1
# check that MANIFESTS_DIR is a directory
if [ ! -d "$MANIFESTS_DIR" ]; then
echo "Error: $MANIFESTS_DIR is not a directory"
exit 1
fi
# ensure that we are running on x86_64 architecture
if [ "$(uname -m)" != "x86_64" ]; then
echo "Error: this script is only supported on x86_64 architecture"
exit 1
fi
. /etc/os-release
case "${ID}-${VERSION_ID}" in
fedora-*)
IMAGE_MANIFEST="${MANIFESTS_DIR}/fedora.json"
;;
rhel-8.*)
IMAGE_MANIFEST="${MANIFESTS_DIR}/rhel-8.json"
;;
rhel-9.*)
IMAGE_MANIFEST="${MANIFESTS_DIR}/rhel-9.json"
;;
centos-8)
IMAGE_MANIFEST="${MANIFESTS_DIR}/centos-8.json"
;;
centos-9)
IMAGE_MANIFEST="${MANIFESTS_DIR}/centos-9.json"
;;
*)
echo "Error: unsupported OS: ${ID}-${VERSION_ID}"
exit 1
;;
esac
OUTPUT_DIR=/var/tmp/osbuild-output
STORE_DIR=/var/tmp/osbuild-store
sudo mkdir -p "${OUTPUT_DIR}"
sudo mkdir -p "${STORE_DIR}"
# all the images are built with qcow2 format, so export it
EXPORT_PIPELINE="qcow2"
sudo osbuild --output-directory "${OUTPUT_DIR}" --store "${STORE_DIR}" --export "${EXPORT_PIPELINE}" "${IMAGE_MANIFEST}"

View File

@ -0,0 +1,4 @@
summary: Build simple image using osbuild
tag: integration-test
duration: 1h
test: ./build-images.sh ./manifests

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
summary: Run osbuild unit tests from dist-git sources
tag: unit-test
duration: 4h
test: ./prep-host-environment.sh; sudo chcon $(matchpathcon -n /usr/bin/osbuild) ./run-unit-tests.sh; ./run-unit-tests.sh

View File

@ -0,0 +1,64 @@
#!/usr/bin/bash
# Prepare the host environment for running the osbuild unit tests.
# This includes installing missing dependencies and tools.
set -euxo pipefail
source /etc/os-release
case "${ID}" in
fedora)
PKG_MAINT_TOOL="fedpkg"
sudo dnf install -y "${PKG_MAINT_TOOL}"
;;
rhel)
PKG_MAINT_TOOL="rhpkg"
# rhpkg is not available in the default repos
sudo curl -L -o "/etc/yum.repos.d/rcm-tools-rhel-${VERSION_ID%.*}-baseos.repo" "http://download.devel.redhat.com/rel-eng/internal/rcm-tools-rhel-${VERSION_ID%.*}-baseos.repo"
# install the RH IT CA certificate used by the repo above
sudo curl -L -o /etc/pki/ca-trust/source/anchors/2015-IT-Root-CA.pem http://certs.corp.redhat.com/certs/2015-IT-Root-CA.pem
sudo curl -L -o /etc/pki/ca-trust/source/anchors/2022-IT-Root-CA.pem http://certs.corp.redhat.com/certs/2022-IT-Root-CA.pem
sudo update-ca-trust
;;
centos)
PKG_MAINT_TOOL="centpkg"
# centpkg is not available in the default repos
sudo dnf install -y epel-release
# CRB repos are available only for CentOS Stream 9
if [ "${VERSION_ID}" == "9" ]; then
dnf config-manager --set-enabled crb
fi
;;
*)
echo "Error: unsupported OS: ${ID}-${VERSION_ID}"
exit 1
;;
esac
# Move to the checked out git repo with the test plans
# this should be the root of the dist-git repo
cd "${TMT_TREE}"
# install all test dependencies
sudo dnf install -y \
"${PKG_MAINT_TOOL}" \
rpmdevtools \
python3-mako \
python3-pip \
rpm-ostree \
dosfstools \
gdisk
sudo dnf builddep -y osbuild.spec
# Install pytst from pip, because the version in some RHEL / CentOS releases is too old
sudo pip3 install pytest
# Make sure that /usr/lib/systemd/boot/efi/linuxx64.efi.stub is available to enable pe32p tests
case "${ID}-${VERSION_ID}" in
rhel-8.* | centos-8)
sudo dnf install -y systemd-udev
;;
*)
sudo dnf install -y systemd-boot-unsigned
;;
esac

View File

@ -0,0 +1,110 @@
#!/usr/bin/bash
# Execute osbuild unit tests from a checked out dist-git repo
set -euxo pipefail
source /etc/os-release
case "${ID}" in
fedora)
PKG_MAINT_TOOL="fedpkg"
;;
rhel)
PKG_MAINT_TOOL="rhpkg"
;;
centos)
PKG_MAINT_TOOL="centpkg"
;;
*)
echo "Error: unsupported OS: ${ID}-${VERSION_ID}"
exit 1
;;
esac
# Move to the checked out git repo with the test plans
# this should be the root of the dist-git repo
cd "${TMT_TREE}"
# the content of the directory is copy of the dist-git repo, but the .git directory is missing
# so we need to create it to make all *pkg tools happy
git init
# deduct the release to pass to rpkg to prep the sources.
# 1. use the DIST_GIT_RELEASE if set
DIST_GIT_RELEASE="${DIST_GIT_RELEASE:-}"
# 2. use the TARGET_BRANCH if set
if [[ -z "${DIST_GIT_RELEASE}" ]]; then
echo "DIST_GIT_RELEASE was not provided, trying to use TARGET_BRANCH"
DIST_GIT_RELEASE="${TARGET_BRANCH:-}"
fi
# 3. use the host OS type and version
if [[ -z "${DIST_GIT_RELEASE}" ]]; then
echo "DIST_GIT_RELEASE nor TARGET_BRANCH were not provided, trying to use the host OS type and version"
case "${ID}" in
fedora)
DIST_GIT_RELEASE="f${VERSION_ID}"
;;
rhel)
DIST_GIT_RELEASE="rhel-${VERSION_ID}.0"
;;
centos)
DIST_GIT_RELEASE="c${VERSION_ID}s"
;;
esac
fi
# The namespace and name must be passed explicitly to rhpkg, because it can't determine them on its own.
# Passing these options to centpkg and fedpkg is harmless, so we can use them for all tools.
# shellcheck disable=SC2086
${PKG_MAINT_TOOL} -v --namespace rpms --name osbuild --release "${DIST_GIT_RELEASE}" prep
# Extract the Source0 basename without extension
SRC_DIR=$(spectool --source 0 osbuild.spec | sed 's/.\+\(osbuild-[0-9]\+\)\.tar\.gz/\1/')
cd "${SRC_DIR}"
# Some unit tests depend on the fact that the source code is in a git repo
git init .
git add *
git commit -m "Initial commit"
# The 'test/run/test_assemblers.py::test_tar' test case uses system tar to extract the built tar archive.
# However, files in the tar archive can have SELinux context not present in the system policy. Therefore,
# in order for the system tar to be able to set it when extracting the archive, it must be labeled with
# 'install_exec_t' type.
ORIGINAL_TAR_CONTEXT="$(matchpathcon -n "$(which tar)")"
sudo chcon "system_u:object_r:install_exec_t:s0" "$(which tar)"
function restore_tar_context() {
sudo chcon "${ORIGINAL_TAR_CONTEXT}" "$(which tar)"
}
trap restore_tar_context EXIT
# Run the unit tests
# Note:
# - Ignore the boot test, because it requires qemu-system-x86_64 not available on all distributions.
# - Ignore source code tests, which run linters, since we can't ensure that all linters are available
# and of the same version as in upstream.
# - Explicitly mark btrfs as unsupported on CentOS / RHEL
if [ "${ID}" == "centos" ] || [ "${ID}" == "rhel" ]; then
UNSUPPORTED_FS="--unsupported-fs btrfs"
fi
TEST_SELECTION_EXPR="not (TestBoot and boot)"
# disable some tests on RHEL-8
if ([ "${ID}" == "rhel" ] || [ "${ID}" == "centos" ]) && [ "${VERSION_ID%%.*}" == "8" ]; then
# qemu-img info in RHEL-8 produces "raw" as the image format for "vdi" images, which causes tests to fail. Skip it.
TEST_SELECTION_EXPR="${TEST_SELECTION_EXPR} and not (test_qemu[ext4-vdi] or test_qemu[xfs-vdi])"
TEST_SELECTION_EXPR="${TEST_SELECTION_EXPR} and not (TestStages and test_qemu)"
# https://github.com/osbuild/osbuild/issues/1611
TEST_SELECTION_EXPR="${TEST_SELECTION_EXPR} and not (TestStages and test_skopeo_with_localstorage)"
fi
sudo python3 -m pytest \
--rootdir "$(pwd)" \
--ignore "$(pwd)/test/src" \
${UNSUPPORTED_FS:-} \
-k "${TEST_SELECTION_EXPR}" \
-v \
"$(pwd)/test/"