1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-12-22 10:23:09 +00:00

Enable testing of COPRs, fix some issues, enable package checks

This works more or less like testing side tags. We also fix up
some flow problems with this path (that also affect the side tag
case), and enable the package checks on this path - it's not too
hard really, we just need to write the updatepkgs file when we
set up the repo, which we can do with dnf repoquery.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2024-04-30 13:45:32 -07:00
parent 1edde53988
commit a353caeb90
7 changed files with 60 additions and 43 deletions

View File

@ -570,13 +570,24 @@ sub setup_repos {
);
my $arch = get_var("ARCH");
my $tag = get_var("TAG");
# write the tag repo config if appropriate
assert_script_run 'printf "[openqa-testtag]\nname=openqa-testtag\nbaseurl=https://kojipkgs.fedoraproject.org/repos/' . "$tag/latest/$arch" . '/\ncost=2000\nenabled=1\ngpgcheck=0\n" > /etc/yum.repos.d/openqa-testtag.repo' if ($tag && !$args{waonly});
my $copr = get_var("COPR");
if (($tag || $copr) && !$args{waonly}) {
# write a side tag or COPR repo config, enabled or disabled
# according to the 'configs' arg
assert_script_run 'printf "[openqa-testtag]\nname=openqa-testtag\nbaseurl=' . get_var("UPDATE_OR_TAG_REPO") . '/\ncost=2000\nenabled=' . $args{configs} . '\ngpgcheck=0\npriority=1\n" > /etc/yum.repos.d/openqa-testtag.repo';
# write out the info files
assert_script_run 'dnf --disablerepo=* --enablerepo=openqa-testtag repoquery --qf "%{SOURCERPM} %{NAME} %{EPOCH} %{VERSION} %{RELEASE}" | sort -u > /mnt/updatepkgs.txt';
# the | xargs here is a wacky trick that converts newlines to
# spaces - unlike rpm, dnf always puts every package on a new
# line, which we don't want here
# https://unix.stackexchange.com/a/110759
assert_script_run 'dnf --disablerepo=* --enablerepo=openqa-testtag repoquery --qf "%{NAME} " | xargs > /mnt/updatepkgnames.txt';
}
my @was = get_workarounds($args{version});
# bail if there are no workarounds:
# * if we're in workarounds-only mode
# * if we're testing a side tag (so no packages to dl)
if ($args{waonly} || $tag) {
# * if we're testing a side tag or COPR (so no packages to dl)
if ($args{waonly} || $tag || $copr) {
return unless (@was);
}
# if we got this far, we're definitely downloading *something*
@ -619,14 +630,14 @@ sub setup_repos {
die "Neither ADVISORY_NVRS nor KOJITASK set! Don't know what to do" unless ($args{waonly});
}
my $cmd = "/usr/local/bin/setup_repos.py";
# don't download updates if we're in workarounds-only mode or testing a tag
$cmd .= " -u $udstring" unless ($args{waonly} || $tag);
# don't download updates if we're in workarounds-only mode or testing a tag or COPR
$cmd .= " -u $udstring" unless ($args{waonly} || $tag || $copr);
$cmd .= " -w $wastring" if (@was);
# write repo config files if asked
$cmd .= " -c" if ($args{configs});
$cmd .= " $arch";
assert_script_run $cmd, $timeout;
unless ($args{waonly} || $tag) {
unless ($args{waonly} || $tag || $copr) {
upload_logs "/mnt/updatepkgnames.txt";
upload_logs "/mnt/updatepkgs.txt";
}
@ -635,8 +646,9 @@ sub setup_repos {
sub _repo_setup_updates {
# Appropriate repo setup steps for testing a Bodhi update
my $tag = get_var("TAG");
my $copr = get_var("COPR");
# Check if we already ran, bail if so
if ($tag) {
if ($tag || $copr) {
# for TAG case, check for the repo file
return unless script_run "test -f /etc/yum.repos.d/openqa-testtag.repo";
}
@ -670,8 +682,8 @@ sub _repo_setup_updates {
select_console("virtio-console");
console_login();
# prepare the directory the packages will be downloaded to, unless we're
# testing a side tag
_prepare_update_mount() unless ($tag);
# testing a side tag or COPR
_prepare_update_mount() unless ($tag || $copr);
# on CANNED, we need to enter the toolbox at this point
if (get_var("CANNED")) {
@ -829,7 +841,6 @@ sub gnome_initial_setup {
@_
);
my $relnum = get_release_number;
my $advortask = get_var("ADVISORY_OR_TASK");
# note: when 'language' is "skipped", it's turned into a 'welcome'
# page, which has a "Start Setup" button, not a "Next" button
@ -1203,8 +1214,6 @@ sub quit_with_shortcut {
# are currently installed. This is here so we can do it both in
# _advisory_post and post_fail_hook.
sub advisory_get_installed_packages {
# can't do anything useful when testing a side tag
return if (get_var("TAG"));
# bail out if the file doesn't exist: this is in case we get
# here in the post-fail hook but we failed before creating it
return if script_run "test -f /mnt/updatepkgs.txt";
@ -1234,8 +1243,6 @@ sub advisory_check_nonmatching_packages {
wrapper => "",
@_
);
# can't do anything useful when testing a side tag
return if (get_var("TAG"));
# bail out if the file doesn't exist: this is in case we get
# here in the post-fail hook but we failed before creating it
return if script_run "test -f /mnt/updatepkgnames.txt";
@ -1245,9 +1252,13 @@ sub advisory_check_nonmatching_packages {
script_run 'touch /tmp/installedupdatepkgs.txt';
my $rpmcmd = "rpm";
my $timeout = 180;
# longer if we have a lot of packages
my $pkgs = script_output "wc -l /mnt/updatepkgs.txt";
$timeout *= 2 if ($pkgs > 100);
$timeout *= 2 if ($pkgs > 400);
my $wrapper = $args{wrapper};
$rpmcmd = "$wrapper rpm" if ($wrapper);
$timeout = 360 if ($wrapper);
$timeout *= 2 if ($wrapper);
# this creates /tmp/installedupdatepkgs.txt as a sorted list of installed
# packages with the same name as packages from the update, in the same form
# as /mnt/updatepkgs.txt. The '--last | head -1' tries to handle the

View File

@ -20,6 +20,8 @@
"backend": "qemu",
"settings": {
"ARCH_BASE_MACHINE": "aarch64",
"INSECURE_PFLASH_CODE": "/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw",
"INSECURE_PFLASH_VARS": "/usr/share/edk2/aarch64/vars-template-pflash.raw",
"PART_TABLE_TYPE": "gpt",
"QEMU": "aarch64",
"QEMUCPU": "host",
@ -56,6 +58,8 @@
"backend": "qemu",
"settings": {
"ARCH_BASE_MACHINE": "64bit",
"INSECURE_PFLASH_CODE": "/usr/share/edk2/ovmf/OVMF_CODE.fd",
"INSECURE_PFLASH_VARS": "/usr/share/edk2/ovmf/OVMF_VARS.fd",
"PART_TABLE_TYPE": "gpt",
"QEMUCPU": "Nehalem",
"QEMUCPUS": "2",

View File

@ -33,6 +33,7 @@ sub run {
}
my $arch = get_var("ARCH");
my $tag = get_var("TAG");
my $copr = get_var("COPR");
my $workarounds = get_workarounds;
if (get_var("NUMDISKS") > 2) {
# put /var/lib/mock on the third disk, so we don't run out of
@ -50,13 +51,13 @@ sub run {
assert_script_run "echo \"include('/etc/mock/fedora-${mockver}-${arch}.cfg')\" > /etc/mock/openqa.cfg";
# make the side and workarounds repos and the serial device available inside the mock root
assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_enable\'] = True" >> /etc/mock/openqa.cfg';
assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_opts\'][\'dirs\'].append((\'/mnt/update_repo\', \'/mnt/update_repo\'))" >> /etc/mock/openqa.cfg' unless ($tag);
assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_opts\'][\'dirs\'].append((\'/mnt/update_repo\', \'/mnt/update_repo\'))" >> /etc/mock/openqa.cfg' unless ($tag || $copr);
assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_opts\'][\'dirs\'].append((\'/mnt/workarounds_repo\', \'/mnt/workarounds_repo\'))" >> /etc/mock/openqa.cfg' if ($workarounds);
assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_opts\'][\'dirs\'].append((\'/dev/' . $serialdev . '\', \'/dev/' . $serialdev . '\'))" >> /etc/mock/openqa.cfg';
my $repos = 'config_opts[\'dnf.conf\'] += \"\"\"\n';
# add the update repo or tag repo to the config
$repos .= '[advisory]\nname=Advisory repo\nbaseurl=file:///mnt/update_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' unless ($tag);
$repos .= '[openqa-testtag]\nname=Tag test repo\nbaseurl=https://kojipkgs.fedoraproject.org/repos/' . "${tag}/latest/${arch}" . '\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' if ($tag);
# add the update, tag or COPR repo to the config
$repos .= '[advisory]\nname=Advisory repo\nbaseurl=file:///mnt/update_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' unless ($tag || $copr);
$repos .= '[openqa-testtag]\nname=Tag test repo\nbaseurl=' . get_var("UPDATE_OR_TAG_REPO") . '\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\npriority=1\n' if ($tag || $copr);
# and the workaround repo
$repos .= '\n[workarounds]\nname=Workarounds repo\nbaseurl=file:///mnt/workarounds_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' if ($workarounds);
# also the buildroot repo, for Rawhide
@ -86,8 +87,8 @@ sub run {
assert_script_run 'sed -i -e "s,dnf-yum,yum,g" teams/cloud/vagrant.xml';
}
# now add the side repo or tag repo to the appropriate repo XML
assert_script_run 'printf "$(head -n -1 ' . $repoxml . ')\n <repository type=\"rpm-md\" alias=\"advisory\" sourcetype=\"baseurl\">\n <source path=\"file:///mnt/update_repo\"/>\n </repository>\n</image>\n" > ' . $repoxml unless ($tag);
assert_script_run 'printf "$(head -n -1 ' . $repoxml . ')\n <repository type=\"rpm-md\" alias=\"openqa-testtag\" sourcetype=\"baseurl\">\n <source path=\"https://kojipkgs.fedoraproject.org/repos/' . "${tag}/latest/${arch}" . '\"/>\n </repository>\n</image>\n" > ' . $repoxml if ($tag);
assert_script_run 'printf "$(head -n -1 ' . $repoxml . ')\n <repository type=\"rpm-md\" alias=\"advisory\" sourcetype=\"baseurl\">\n <source path=\"file:///mnt/update_repo\"/>\n </repository>\n</image>\n" > ' . $repoxml unless ($tag || $copr);
assert_script_run 'printf "$(head -n -1 ' . $repoxml . ')\n <repository type=\"rpm-md\" alias=\"openqa-testtag\" sourcetype=\"baseurl\">\n <source path=\"' . get_var("UPDATE_OR_TAG_REPO") . '\"/>\n </repository>\n</image>\n" > ' . $repoxml if ($tag || $copr);
# and the workarounds repo
assert_script_run 'printf "$(head -n -1 ' . $repoxml . ')\n <repository type=\"rpm-md\" alias=\"workarounds\" sourcetype=\"baseurl\">\n <source path=\"file:///mnt/workarounds_repo\"/>\n </repository>\n</image>\n" > ' . $repoxml if ($workarounds);
# and the buildroot repo, for Rawhide

View File

@ -27,8 +27,8 @@ sub run {
}
$cmd .= " --repo=/etc/yum.repos.d/workarounds.repo" if (get_workarounds);
$cmd .= " --repo=/etc/yum.repos.d/koji-rawhide.repo" if ($version eq $rawrel);
$cmd .= " --repo=/etc/yum.repos.d/advisory.repo" unless (get_var("TAG"));
$cmd .= " --repo=/etc/yum.repos.d/openqa-testtag.repo" if (get_var("TAG"));
$cmd .= " --repo=/etc/yum.repos.d/advisory.repo" unless (get_var("TAG") || get_var("COPR"));
$cmd .= " --repo=/etc/yum.repos.d/openqa-testtag.repo" if (get_var("TAG") || get_var("COPR"));
$cmd .= " ./results";
assert_script_run $cmd, 2400;
# good to have the log around for checks

View File

@ -28,6 +28,7 @@ sub run {
my $subv = get_var("SUBVARIANT");
my $lcsubv = lc($subv);
my $tag = get_var("TAG");
my $copr = get_var("COPR");
my $workarounds = get_workarounds;
if (get_var("NUMDISKS") > 2) {
# put /var/lib/mock on the third disk, so we don't run out of
@ -45,13 +46,13 @@ sub run {
assert_script_run "echo \"include('/etc/mock/fedora-${mockver}-${arch}.cfg')\" > /etc/mock/openqa.cfg";
# make the side and workarounds repos and the serial device available inside the mock root
assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_enable\'] = True" >> /etc/mock/openqa.cfg';
assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_opts\'][\'dirs\'].append((\'/mnt/update_repo\', \'/mnt/update_repo\'))" >> /etc/mock/openqa.cfg' unless ($tag);
assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_opts\'][\'dirs\'].append((\'/mnt/update_repo\', \'/mnt/update_repo\'))" >> /etc/mock/openqa.cfg' unless ($tag || $copr);
assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_opts\'][\'dirs\'].append((\'/mnt/workarounds_repo\', \'/mnt/workarounds_repo\'))" >> /etc/mock/openqa.cfg' if ($workarounds);
assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_opts\'][\'dirs\'].append((\'/dev/' . $serialdev . '\', \'/dev/' . $serialdev . '\'))" >> /etc/mock/openqa.cfg';
my $repos = 'config_opts[\'dnf.conf\'] += \"\"\"\n';
# add the update repo or tag repo to the config
$repos .= '[advisory]\nname=Advisory repo\nbaseurl=file:///mnt/update_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' unless ($tag);
$repos .= '[openqa-testtag]\nname=Tag test repo\nbaseurl=https://kojipkgs.fedoraproject.org/repos/' . "${tag}/latest/${arch}" . '\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' if ($tag);
# add the update, tag or COPR repo to the config
$repos .= '[advisory]\nname=Advisory repo\nbaseurl=file:///mnt/update_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' unless ($tag || $copr);
$repos .= '[openqa-testtag]\nname=Tag test repo\nbaseurl=' . get_var("UPDATE_OR_TAG_REPO") . '/\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\npriority=1\n' if ($tag || $copr);
# and the workaround repo
$repos .= '\n[workarounds]\nname=Workarounds repo\nbaseurl=file:///mnt/workarounds_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n' if ($workarounds);
# also the buildroot repo, for Rawhide
@ -68,9 +69,9 @@ sub run {
assert_script_run 'git clone https://pagure.io/fedora-kickstarts.git';
assert_script_run 'cd fedora-kickstarts';
assert_script_run "git checkout ${branch}";
# now add the side repo or tag repo to the appropriate repo ks
assert_script_run 'echo "repo --name=advisory --baseurl=file:///mnt/update_repo" >> ' . $repoks unless ($tag);
assert_script_run 'echo "repo --name=openqa-testtag --baseurl=https://kojipkgs.fedoraproject.org/repos/' . "${tag}/latest/${arch}" . '" >> ' . $repoks if ($tag);
# now add the side, tag or COPR repo to the appropriate repo ks
assert_script_run 'echo "repo --name=advisory --baseurl=file:///mnt/update_repo" >> ' . $repoks unless ($tag || $copr);
assert_script_run 'echo "repo --name=openqa-testtag --baseurl=' . get_var("UPDATE_OR_TAG_REPO") . '" >> ' . $repoks if ($tag || $copr);
# and the workarounds repo
assert_script_run 'echo "repo --name=workarounds --baseurl=file:///mnt/workarounds_repo" >> ' . $repoks if ($workarounds);
# and the buildroot repo, for Rawhide

View File

@ -10,20 +10,18 @@ sub run {
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);
my $tag = get_var("TAG");
my $copr = get_var("COPR");
my $workarounds = get_workarounds;
# mount our nice big empty scratch disk as /var/tmp
assert_script_run "rm -rf /var/tmp/*";
@ -43,14 +41,14 @@ sub run {
# now copy the advisory, workaround repo and koji-rawhide config files
assert_script_run 'cp /etc/yum.repos.d/workarounds.repo .' if ($workarounds);
assert_script_run 'cp /etc/yum.repos.d/koji-rawhide.repo .' if ($version eq $rawrel);
assert_script_run 'cp /etc/yum.repos.d/advisory.repo .' unless ($tag);
assert_script_run 'cp /etc/yum.repos.d/openqa-testtag.repo .' if ($tag);
assert_script_run 'cp /etc/yum.repos.d/advisory.repo .' unless ($tag || $copr);
assert_script_run 'cp /etc/yum.repos.d/openqa-testtag.repo .' if ($tag || $copr);
# and add them to the config file
my $repl = 'repos:';
$repl .= '\n - workarounds' if ($workarounds);
$repl .= '\n - koji-rawhide' if ($version eq $rawrel);
$repl .= '\n - advisory' unless ($tag);
$repl .= '\n - openqa-testtag' if ($tag);
$repl .= '\n - advisory' unless ($tag || $copr);
$repl .= '\n - openqa-testtag' if ($tag || $copr);
# Up to Fedora 39, repo definitions are in the subvariant config...
assert_script_run 'sed -i -e "s,repos:,' . $repl . ',g" fedora-' . $lcsubv . '.yaml';
# From Fedora 40 onwards, they're in the common config. Let's just
@ -106,8 +104,8 @@ sub run {
}
$cmd .= " --repo=/etc/yum.repos.d/workarounds.repo" if ($workarounds);
$cmd .= " --repo=/etc/yum.repos.d/koji-rawhide.repo" if ($version eq $rawrel);
$cmd .= " --repo=/etc/yum.repos.d/advisory.repo" unless ($tag);
$cmd .= " --repo=/etc/yum.repos.d/openqa-testtag.repo" if ($tag);
$cmd .= " --repo=/etc/yum.repos.d/advisory.repo" unless ($tag || $copr);
$cmd .= " --repo=/etc/yum.repos.d/openqa-testtag.repo" if ($tag || $copr);
$cmd .= " ./results";
assert_script_run $cmd, 9000;
# good to have the log around for checks

View File

@ -133,9 +133,11 @@ sub run {
assert_script_run "mkdir -p /export";
# get the kickstart
assert_script_run "curl -o /export/root-user-crypted-net.ks https://fedorapeople.org/groups/qa/kickstarts/root-user-crypted-net.ks";
# for update tests, set up the update repository and export it
if (get_var("ADVISORY_OR_TASK") && !get_var("TAG")) {
assert_script_run "echo '/mnt/update_repo 172.16.2.0/24(ro)' >> /etc/exports";
# for update tests, set up the update repository and export it,
# if we have one (for tag and copr tests we don't really need to
# be here at all so we'll just sit here being useless)
if (get_var("ADVISORY_OR_TASK")) {
assert_script_run "echo '/mnt/update_repo 172.16.2.0/24(ro)' >> /etc/exports" if (!get_var("TAG") && !get_var("COPR"));
}
# for compose tests, we do all this stuff
else {