update logic and documentation of check_prerelease

This commit is contained in:
Trevor Cooper 2024-04-03 20:58:03 -07:00
parent 12a9e8ec00
commit 69dfa89cc8
Signed by: tcooper
GPG Key ID: 52364D7BBCEB35B8
1 changed files with 14 additions and 37 deletions

View File

@ -1180,16 +1180,11 @@ sub check_prerelease {
# defaults to False, but if the compose has a label and it's an
# 'RC' or 'Update' or 'SecurityFix' compose (see definition of
# SUPPORTED_MILESTONES in productmd.composeinfo), the default is
# True. AFAICS, Fedora's pungi configs don't explicitly set this,
# but rely on the heuristic. So for installer images, we expect
# isFinal to be True for RC candidate composes and post-release
# nightly Cloud, IoT etc. composes (these are also marked as 'RC'
# composes), but False for Rawhide and Branched nightly composes
# and Beta candidate composes. For installer images built by our
# own _installer_build test, we control whether --isfinal is set
# or not; we pass it if the update is for a stable release, we do
# not pass it if the update is for Branched. Live images do not
# have the buildstamp file.
# True. Not sure if Rocky's pungi configs explicitly set this,
# or rely on the heuristic. So for installer images, we expect
# isFinal to be True for RC candidate and final composes, but
# False for LookAhead and Beta candidate composes. Live images
# do not have the buildstamp file.
# 2. If there's no buildstamp file, the value of the environment
# variable ANACONDA_ISFINAL is used as `product.isFinal`, default
@ -1197,22 +1192,11 @@ sub check_prerelease {
# wrapper script sets ANACONDA_ISFINAL based on the release field
# of whatever package provides system-release: if it starts with
# "0.", it sets ANACONA_ISFINAL to "false", otherwise it sets it
# to "true". So for live images, we expect isFinal to be True
# unless the fedora-release-common package release starts with 0.
# to "true".
# 3. If `product.isFinal` is False, the pre-release warning and
# tags are shown; if it is False, they are not shown.
# We don't really need to check this stuff for update tests, as
# the only installer images we test on updates are ones we build
# ourselves; there's no value to this check for those really.
# For compose tests, we will expect to see the pre-release tags if
# the compose is Rawhide, or a Beta candidate, or it's a nightly
# and we're checking an installer image. If it's an RC or Updates
# candidate, or a respin release, we expect NOT to see the tags.
# If it's a nightly and we're checking a live image, we don't do
# the check.
# bail if this is an update test
return if (get_var("ADVISORY OR TASK"));
@ -1220,25 +1204,18 @@ sub check_prerelease {
# any other value means we don't care
my $prerelease = 10;
# if this is RC or update compose we absolutely *MUST NOT* see tags
# if this is RC we absolutely *MUST NOT* see tags
my $label = get_var("LABEL");
$prerelease = 0 if ($label =~ /^(RC|Update)-/);
$prerelease = 0 if ($label =~ /^RC/);
# if it's a Beta compose we *MUST* see tags
$prerelease = 1 if ($label =~ /^Beta-/);
my $version = get_var('VERSION');
# if it's Rawhide we *MUST* see tags
$prerelease = 1 if ($version eq "Rawhide");
$prerelease = 1 if ($label =~ /^(B(?i)eta(?-i))/);
my $build = get_var('BUILD');
# if it's a nightly installer image we should see tags
$prerelease = 1 if ($build =~ /\.n\.\d+/ && !get_var("LIVE"));
# if it's a respin compose we *MUST NOT* see tags
$prerelease = 0 if ($build =~ /Respin/);
# we *could* go to a console and parse fedora-release-common
# to decide if a nightly live image should have tags or not, but
# it seems absurd as we're almost reinventing the code that
# decides whether to show the tags, at that point, and it's not
# really a big deal either way whether a nightly live image has
# the tags or not. So we don't.
$prerelease = 1 if ($build =~ /\.t\.\d+/ && !get_var("LIVE"));
# check based on ISO name, does not work for 8.x boot-iso name(s) which must use
# LABEL
my $iso = get_var('ISO');
$prerelease = 1 if ($iso =~ /^Rocky-\d+\.\d+-(B(?i)eta(?-i)|LookAhead)-(x86_64|aarch64|ppc64le|s390x)-(boot|dvd\d?|minimal).iso/);
# For all prerelease requiring ISOs, assert that prerelease is there.
if ($prerelease == 1) {