packit: Load fmf metadata from rpm spec repository (#36825)
This commit is contained in:
+12
-3
@@ -37,8 +37,17 @@ jobs:
|
||||
|
||||
- job: tests
|
||||
trigger: pull_request
|
||||
fmf_path: test/fmf
|
||||
tmt_plan: ci
|
||||
use_target_repo_for_fmf_url: true
|
||||
fmf_url: https://src.fedoraproject.org/rpms/systemd
|
||||
# This is automatically updated by tools/fetch-distro.py --update fedora
|
||||
fmf_ref: 2ecfbec1a444a2ec9e3dab91d04565330cf809ea
|
||||
targets:
|
||||
- fedora-rawhide-x86_64
|
||||
# testing-farm in the Fedora repository is explicitly configured to use testing-farm bare metal runners as
|
||||
# the volume of pull requests there is very low. Upstream the volume of pull requests is much higher and
|
||||
# we'll bottleneck ourselves if we insist on bare metal runners, so explicitly do not request support for
|
||||
# nested virtualization so we don't only consider bare metal runners.
|
||||
tf_extra_params:
|
||||
environments:
|
||||
- hardware:
|
||||
virtualization:
|
||||
is-supported: false
|
||||
|
||||
@@ -8,7 +8,7 @@ Distribution=|fedora
|
||||
Environment=
|
||||
GIT_URL=https://src.fedoraproject.org/rpms/systemd.git
|
||||
GIT_BRANCH=rawhide
|
||||
GIT_COMMIT=38b41a729ea836133d7e53a4c0cc8e5fee7e2b8a
|
||||
GIT_COMMIT=2ecfbec1a444a2ec9e3dab91d04565330cf809ea
|
||||
PKG_SUBDIR=fedora
|
||||
|
||||
[Content]
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
1
|
||||
@@ -1,13 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
summary: Run the upstream integration test suite
|
||||
test: ./test.sh
|
||||
duration: 2h
|
||||
require:
|
||||
- coreutils
|
||||
- distribution-gpg-keys
|
||||
- dnf
|
||||
- git-core
|
||||
- koji
|
||||
- centos-packager
|
||||
- copr-cli
|
||||
@@ -1,109 +0,0 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
# Switch SELinux to permissive if possible, since the tests don't set proper contexts
|
||||
setenforce 0 || true
|
||||
|
||||
echo "CPU and Memory information:"
|
||||
lscpu
|
||||
lsmem
|
||||
|
||||
echo "Clock source: $(cat /sys/devices/system/clocksource/clocksource0/current_clocksource)"
|
||||
|
||||
# Bump inotify limits if we can so nspawn containers don't run out of inotify file descriptors.
|
||||
sysctl fs.inotify.max_user_watches=65536 || true
|
||||
sysctl fs.inotify.max_user_instances=1024 || true
|
||||
|
||||
if [[ -n "${KOJI_TASK_ID:-}" ]]; then
|
||||
koji download-task --noprogress --arch="src,noarch,$(rpm --eval '%{_arch}')" "$KOJI_TASK_ID"
|
||||
elif [[ -n "${CBS_TASK_ID:-}" ]]; then
|
||||
cbs download-task --noprogress --arch="src,noarch,$(rpm --eval '%{_arch}')" "$CBS_TASK_ID"
|
||||
elif [[ -n "${PACKIT_SRPM_URL:-}" ]]; then
|
||||
COPR_BUILD_ID="$(basename "$(dirname "$PACKIT_SRPM_URL")")"
|
||||
COPR_CHROOT="$(basename "$(dirname "$(dirname "$PACKIT_BUILD_LOG_URL")")")"
|
||||
copr download-build --rpms --chroot "$COPR_CHROOT" "$COPR_BUILD_ID"
|
||||
mv "$COPR_CHROOT"/* .
|
||||
else
|
||||
echo "Not running within packit and no CBS/koji task ID provided"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir systemd
|
||||
rpm2cpio ./systemd-*.src.rpm | cpio --to-stdout --extract './systemd-*.tar.gz' | tar xz --strip-components=1 -C systemd
|
||||
pushd systemd
|
||||
|
||||
# Now prepare mkosi at the same version required by the systemd repo.
|
||||
git clone https://github.com/systemd/mkosi
|
||||
mkosi_hash="$(grep systemd/mkosi@ .github/workflows/mkosi.yml | sed "s|.*systemd/mkosi@||g")"
|
||||
git -C mkosi checkout "$mkosi_hash"
|
||||
|
||||
export PATH="$PWD/mkosi/bin:$PATH"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. /etc/os-release || . /usr/lib/os-release
|
||||
|
||||
tee mkosi.local.conf <<EOF
|
||||
[Distribution]
|
||||
Distribution=${MKOSI_DISTRIBUTION:-$ID}
|
||||
Release=${MKOSI_RELEASE:-${VERSION_ID:-rawhide}}
|
||||
|
||||
[Content]
|
||||
PackageDirectories=..
|
||||
SELinuxRelabel=yes
|
||||
|
||||
[Build]
|
||||
ToolsTreeDistribution=${MKOSI_DISTRIBUTION:-$ID}
|
||||
ToolsTreeRelease=${MKOSI_RELEASE:-${VERSION_ID:-rawhide}}
|
||||
ToolsTreePackageDirectories=..
|
||||
Environment=NO_BUILD=1
|
||||
WithTests=yes
|
||||
EOF
|
||||
|
||||
if [[ -n "${TEST_SELINUX_CHECK_AVCS:-}" ]]; then
|
||||
tee --append mkosi.local.conf <<EOF
|
||||
[Runtime]
|
||||
KernelCommandLineExtra=systemd.setenv=TEST_SELINUX_CHECK_AVCS=$TEST_SELINUX_CHECK_AVCS
|
||||
EOF
|
||||
fi
|
||||
|
||||
# If we don't have KVM, skip running in qemu, as it's too slow. But try to load the module first.
|
||||
modprobe kvm || true
|
||||
if [[ ! -e /dev/kvm ]]; then
|
||||
export TEST_NO_QEMU=1
|
||||
fi
|
||||
|
||||
NPROC="$(nproc)"
|
||||
if [[ "$NPROC" -ge 10 ]]; then
|
||||
export TEST_JOURNAL_USE_TMP=1
|
||||
NPROC="$((NPROC / 3))"
|
||||
else
|
||||
NPROC="$((NPROC - 1))"
|
||||
fi
|
||||
|
||||
# This test is only really useful if we're building with sanitizers and takes a long time, so let's skip it
|
||||
# for now.
|
||||
export TEST_SKIP="TEST-21-DFUZZER"
|
||||
|
||||
mkosi summary
|
||||
mkosi -f sandbox -- true
|
||||
mkosi sandbox -- meson setup --buildtype=debugoptimized -Dintegration-tests=true build
|
||||
mkosi genkey
|
||||
mkosi -f
|
||||
mkosi sandbox -- \
|
||||
meson test \
|
||||
-C build \
|
||||
--no-rebuild \
|
||||
--suite integration-tests \
|
||||
--print-errorlogs \
|
||||
--no-stdsplit \
|
||||
--num-processes "$NPROC" && EC=0 || EC=$?
|
||||
|
||||
[[ -d build/meson-logs ]] && find build/meson-logs -type f -exec mv {} "$TMT_TEST_DATA" \;
|
||||
[[ -d build/test/journal ]] && find build/test/journal -type f -exec mv {} "$TMT_TEST_DATA" \;
|
||||
|
||||
popd
|
||||
|
||||
exit "$EC"
|
||||
@@ -1,12 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
summary: systemd Fedora test suite
|
||||
discover:
|
||||
how: fmf
|
||||
prepare:
|
||||
- name: systemd
|
||||
how: install
|
||||
exclude:
|
||||
- systemd-standalone-.*
|
||||
execute:
|
||||
how: tmt
|
||||
+13
-3
@@ -42,13 +42,13 @@ def read_config(distro: str):
|
||||
images = {image["Image"]: image for image in data["Images"]}
|
||||
return images["build"]
|
||||
|
||||
def commit_file(distro: str, file: Path, commit: str, changes: str):
|
||||
def commit_file(distro: str, files: list[Path], commit: str, changes: str):
|
||||
message = '\n'.join((
|
||||
f'mkosi: update {distro} commit reference',
|
||||
'',
|
||||
changes))
|
||||
|
||||
cmd = ['git', 'commit', '-m', message, str(file)]
|
||||
cmd = ['git', 'commit', '-m', message, *(str(file) for file in files)]
|
||||
print(f"+ {shlex.join(cmd)}")
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
@@ -135,7 +135,17 @@ def update_distro(args, distro: str, config: dict):
|
||||
new = s.replace(old_commit, new_commit)
|
||||
assert new != s
|
||||
file.write_text(new)
|
||||
commit_file(distro, file, new_commit, changes)
|
||||
tocommit = [file]
|
||||
|
||||
if distro == "fedora":
|
||||
packit = Path(".packit.yml")
|
||||
s = packit.read_text()
|
||||
assert old_commit in s
|
||||
new = s.replace(old_commit, new_commit)
|
||||
packit.write_text(new)
|
||||
tocommit += [packit]
|
||||
|
||||
commit_file(distro, tocommit, new_commit, changes)
|
||||
break
|
||||
else:
|
||||
raise ValueError(f'{distro}: hash {new_commit} not found under {conf_dir}')
|
||||
|
||||
Reference in New Issue
Block a user