1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-09-16 21:07:22 +00:00
os-autoinst-distri-fedora/tests/_ostree_build.pm
Adam Williamson 03b6663339 Add tests to build a Silverblue installer image and install it
This is like the existing tests that build network install and
live images then install them, only for Silverblue. First we
build an ostree, using the standard configuration for the release
and subvariant but with the 'advisory' and 'workarounds' repos
included, so it will contain current stable packages plus the
packages from the update and any workarounds. Then we build an
ostree installer image with the ostree embedded, again including
advisory and workarounds repos in the installer build config so
packages from them will be included in the installer environment.
The image is uploaded, which completes the _ostree_build test.
Then an install_default_update_ostree test runs, which does a
standard install and boot from the installer image.

We do make a change that affects other tests, too. We now run
_advisory_post on live image install tests, as well as this new
ostree install image install test. It was skipped before because
of an exception that's really only needed for the netinst image
install test. In that test, packages from the update won't be
included in the installed system, so we can't run _advisory_post
on it. But for ostree and live image build/install tests, the
installed system *should* include packages from the update, so
we should check and make sure that it does.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2022-11-30 13:17:28 -08:00

98 lines
4.4 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use utils;
sub run {
my $self = shift;
my $version = get_var("VERSION");
my $currrel = get_var("CURRREL");
my $rawrel = get_var("RAWREL");
my $repo = $version eq $rawrel ? "fedora-rawhide.repo" : "fedora.repo";
my $branch;
my $releasever;
if ($version eq $rawrel) {
$branch = "main";
$releasever = "Rawhide";
}
else {
$branch = "f${version}";
$releasever = $version;
}
my $advortask = get_var("ADVISORY_OR_TASK");
my $arch = get_var("ARCH");
my $subv = get_var("SUBVARIANT");
my $lcsubv = lc($subv);
assert_script_run "cd /";
# usually a good idea for this kinda thing
assert_script_run "setenforce Permissive";
# install the tools we need
assert_script_run "dnf -y install git lorax flatpak ostree rpm-ostree wget dbus-daemon", 300;
# now check out workstation-ostree-config
assert_script_run 'git clone https://pagure.io/workstation-ostree-config.git';
assert_script_run 'pushd workstation-ostree-config';
assert_script_run "git checkout ${branch}";
# now copy the advisory and workaround repo config files in
assert_script_run 'cp /etc/yum.repos.d/advisory.repo .';
assert_script_run 'cp /etc/yum.repos.d/workarounds.repo .';
# and add them to the config file
assert_script_run 'sed -i -e "s,repos:,repos:\n - advisory\n - workarounds,g" fedora-' . $lcsubv . '.yaml';
# upload the config so we can check it
upload_logs "fedora-$lcsubv.yaml";
assert_script_run 'popd';
# now make the ostree repo
assert_script_run "mkdir -p /ostree";
assert_script_run "ostree --repo=/ostree/repo init --mode=archive";
# PULL SOME LEVERS! PULL SOME LEVERS!
# This shadows pungi/ostree/tree.py
# FIXME: when https://fedoraproject.org/wiki/Changes/FedoraSilverblueUnifiedCore
# is implemented we should match it by adding --unified-core to the args
# Difference from releng: we don't pass --write-commitid-to as it
# disables updating the ref with the new commit, and we *do* want
# to do that. pungi updates the ref itself, I don't want to copy
# all that work in here
assert_script_run "rpm-ostree compose tree --repo=/ostree/repo/ --add-metadata-string=version=${advortask} --force-nocache /workstation-ostree-config/fedora-$lcsubv.yaml > /tmp/ostree.log 2>&1", 4500;
upload_logs "/tmp/ostree.log";
# check out the ostree installer lorax templates
assert_script_run 'cd /';
assert_script_run 'git clone https://pagure.io/fedora-lorax-templates.git';
# also check out pungi-fedora and use our script to build part of
# the lorax command
assert_script_run 'git clone https://pagure.io/pungi-fedora.git';
assert_script_run 'cd pungi-fedora/';
assert_script_run "git checkout ${branch}";
# FIXME FIXME change 'ostree' to 'main' on/after merge
assert_script_run 'wget https://pagure.io/fedora-qa/os-autoinst-distri-fedora/raw/ostree/f/ostree-parse-pungi.py', timeout => 120;
my $loraxargs = script_output "python3 ostree-parse-pungi.py $lcsubv $arch";
# this 'temporary file cleanup' thing can actually wipe bits of
# the lorax install root while lorax is still running...
assert_script_run "systemctl stop systemd-tmpfiles-clean.timer";
# create the installer ISO
assert_script_run "rm -rf /var/tmp/*";
assert_script_run "echo 'type=83' | sfdisk /dev/vdc";
assert_script_run "mkfs.ext4 /dev/vdc1";
assert_script_run "echo '/dev/vdc1 /var/tmp ext4 defaults 1 2' >> /etc/fstab";
assert_script_run "mount /var/tmp";
assert_script_run "mkdir -p /var/tmp/imgbuild";
assert_script_run "cd /var/tmp/imgbuild";
my $cmd = "lorax -p Fedora -v ${version} -r ${version} --repo=/etc/yum.repos.d/${repo} --variant=${subv} --nomacboot --buildarch=${arch} --volid=F-${subv}-ostree-${arch}-oqa --logfile=./lorax.log ${loraxargs}";
unless ($version > $currrel) {
$cmd .= " --isfinal --repo=/etc/yum.repos.d/fedora-updates.repo";
}
$cmd .= " --repo=/etc/yum.repos.d/advisory.repo --repo=/etc/yum.repos.d/workarounds.repo ./results";
assert_script_run $cmd, 4800;
# good to have the log around for checks
upload_logs "lorax.log", failok => 1;
assert_script_run "mv results/images/boot.iso ./${advortask}-${subv}-ostree-${arch}.iso";
upload_asset "./${advortask}-${subv}-ostree-${arch}.iso";
}
sub test_flags {
return {fatal => 1};
}
1;