2022-12-06 22:41:56 +00:00
|
|
|
use base "installedtest";
|
|
|
|
use strict;
|
|
|
|
use testapi;
|
|
|
|
use utils;
|
|
|
|
|
|
|
|
sub run {
|
|
|
|
|
|
|
|
my $self = shift;
|
|
|
|
$self->root_console(tty => 3);
|
2023-03-29 21:29:52 +00:00
|
|
|
if (get_var("ARCH") eq "aarch64") {
|
|
|
|
# this should stop audit messages screwing things up
|
|
|
|
assert_script_run "rpm-ostree kargs --append=audit=0";
|
|
|
|
script_run "systemctl reboot", 0;
|
|
|
|
boot_to_login_screen;
|
|
|
|
$self->root_console(tty => 3);
|
|
|
|
}
|
2022-12-06 22:41:56 +00:00
|
|
|
|
|
|
|
# list available branches
|
|
|
|
my $subv = lc(get_var("SUBVARIANT"));
|
|
|
|
my $remote = "fedora";
|
|
|
|
$remote = "fedora-iot" if ($subv eq "iot");
|
|
|
|
assert_script_run "ostree remote refs $remote";
|
|
|
|
|
|
|
|
# get current branch
|
|
|
|
my $current = script_output "rpm-ostree status -b | grep fedora";
|
2023-06-12 15:55:32 +00:00
|
|
|
if (get_var("ADVISORY_OR_TASK")) {
|
|
|
|
die "Expected 'fedora-openqa' ref not deployed!" unless ($current =~ m/fedora-openqa/);
|
|
|
|
}
|
2022-12-06 22:41:56 +00:00
|
|
|
|
|
|
|
my $arch = lc(get_var("ARCH"));
|
|
|
|
|
|
|
|
# decide target
|
|
|
|
my $rebase;
|
|
|
|
my $target;
|
|
|
|
if ($current =~ "iot") {
|
2023-08-23 23:12:57 +00:00
|
|
|
# previously we did this:
|
|
|
|
#$rebase = $current =~ "stable" ? "devel" : "stable";
|
|
|
|
# but we cannot rebase from F39+ to <F39:
|
|
|
|
# https://github.com/fedora-silverblue/issue-tracker/issues/470
|
|
|
|
# so let's make sure we don't do that. This can be reverted
|
|
|
|
# when F39 is stable
|
|
|
|
$rebase = $current =~ "devel" ? "rawhide" : "devel";
|
2022-12-06 22:41:56 +00:00
|
|
|
$target = "fedora/${rebase}/${arch}/iot";
|
|
|
|
}
|
|
|
|
elsif ($current =~ "silverblue") {
|
|
|
|
my $relnum = get_release_number;
|
|
|
|
$rebase = $relnum - 1;
|
2023-08-23 23:12:57 +00:00
|
|
|
# avoid rebasing 39 > 38 due to
|
|
|
|
# https://github.com/fedora-silverblue/issue-tracker/issues/470
|
|
|
|
$rebase = "40" if ($rebase eq "38");
|
2023-06-10 23:00:21 +00:00
|
|
|
# on update tests, just rebase to the 'official' ref for the
|
|
|
|
# release, as opposed to the custom ref we used when building;
|
|
|
|
# this should be more reliable than a different release
|
|
|
|
$rebase = $relnum if (get_var("ADVISORY_OR_TASK"));
|
|
|
|
$rebase = "rawhide" if ($rebase eq get_var("RAWREL"));
|
2022-12-06 22:41:56 +00:00
|
|
|
$target = "fedora/${rebase}/${arch}/silverblue";
|
|
|
|
}
|
|
|
|
elsif ($current =~ "coreos") {
|
|
|
|
$rebase = $current =~ "stable" ? "testing" : "stable";
|
2024-02-19 23:00:34 +00:00
|
|
|
$target = "fedora:fedora/${arch}/coreos/${rebase}";
|
2022-12-06 22:41:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# rebase to the chosen target
|
2023-03-23 05:59:21 +00:00
|
|
|
validate_script_output "rpm-ostree rebase $target --bypass-driver", sub { m/systemctl reboot/ }, 300;
|
2022-12-06 22:41:56 +00:00
|
|
|
script_run "systemctl reboot", 0;
|
|
|
|
|
|
|
|
boot_to_login_screen;
|
|
|
|
$self->root_console(tty => 3);
|
|
|
|
|
|
|
|
# check booted branch to make sure successful rebase
|
|
|
|
validate_script_output "rpm-ostree status -b", sub { m/$target/ }, 300;
|
|
|
|
|
|
|
|
# rollback and reboot
|
2023-06-12 15:56:26 +00:00
|
|
|
validate_script_output "rpm-ostree rollback", sub { m/systemctl reboot/ }, 300;
|
|
|
|
script_run "systemctl reboot", 0;
|
|
|
|
boot_to_login_screen;
|
2022-12-06 22:41:56 +00:00
|
|
|
$self->root_console(tty => 3);
|
|
|
|
|
|
|
|
# check to make sure rollback successful
|
|
|
|
validate_script_output "rpm-ostree status -b", sub { m/$current/ }, 300;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub test_flags {
|
|
|
|
return {fatal => 1};
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
# vim: set sw=4 et:
|