-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade SLES12SP5 MU released to SLES15SP6 MU unreleased #19547
base: master
Are you sure you want to change the base?
Upgrade SLES12SP5 MU released to SLES15SP6 MU unreleased #19547
Conversation
504a682
to
f91505a
Compare
e79b236
to
2e15c92
Compare
we should not use old modules like |
b33ae4b
to
0646cb0
Compare
Updated, I didn't use version_switch_upgrade_target, this test module switches versions with VERSION_2 settings as target product version. My case should be added to 15SP6 (the target product version), so can not load that new test module. |
use strict; | ||
use warnings; | ||
use testapi; | ||
use List::Util qw(uniq); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check for libraries not used.
use main_common qw(join_incidents_to_repo); | ||
|
||
sub run { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, remove all spaces between lines unless there is clear separation.
@@ -0,0 +1,47 @@ | |||
# Copyright 2023 SUSE LLC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2024
select_console 'root-console'; | ||
|
||
# SCC_ADDONS_2 values are upgraded 15SPx's modules, swap the SCC_ADDONS to SCC_ADDONS_2. | ||
set_var('SCC_ADDONS', get_var('SCC_ADDONS_2')) if (get_var('SCC_ADDONS_2')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need conditional logic, you could just get_required_var.
SCC_ADDONS_2 should be explained in the description of this file, so a set_var doesn't require a comment.
my %incidents; | ||
$incidents{OS} = get_var('OS_TEST_REPOS', ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could go in single line and apparently we don't use OS_TEST_REPOS
so it could be initialize it to empty. But I would recommend you something else, have you ever use map
in Perl?
You can iterate @addons and then map the hash ref %incidents in a single line without any loop.
https://perldoc.perl.org/functions/map
BUT actually a 3rd option is not to use the existing code from main.pm, we just need a variable with all the repos concatenated, why we don't do that in a loop concatenating each *_TEST_REPOS
that we have based in our know addons? would be more simple I guess.
set_var('SCC_ADDONS', join(',', @addons)); | ||
|
||
for my $i (@addons) { | ||
if ($i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need this if
, we assume that we always have addons, otherwise we could use get_required_var
--- | ||
name: autoupgrade | ||
description: > | ||
Performs a migration from installed system with released maintenance updates to mu unreleased testsuites. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mu
is not widely used, maintenance updates
. It should say `...to a target system using its unreleased maintenance updates'
0646cb0
to
4d9af4d
Compare
262a79b
to
0b6ecb0
Compare
aa7e6a0
to
c8d3f06
Compare
select_console 'root-console'; | ||
set_var('SCC_ADDONS', get_var('SCC_ADDONS_2')); | ||
# Recreate the incidents repos based on the swapped SCC_ADDONS values. | ||
my ($maint_test_repos, $test_repo) = ('', ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is something peculiar in Perl that you can use to avoid to control so much the values and add conditional code.
Pushing an empty array into an array doesn't create any undef or gaps in the list:
my @maint_test_repo = ('a', 'b', 'c');
push(@maint_test_repo, ());
print Dumper(@maint_test_repo), "\n";
You can try this snippet:
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
sub get_repo {
my $addon = shift;
return "http://repo/with/patch/for/base/1,http://repo/with/patch/for/base/2" if $addon eq "base";
return "http://repo/with/patch/for/desktop/1" if $addon eq "desktop";
return "http://repo/with/patch/for/contm/1,http://repo/with/patch/for/contm/2,http://repo/with/patch/for/contm/3 " if $addon eq "contm";
return "";
}
sub get_addons {
return "base,serverapp,desktop,sdk,legacy,python3,script,contm,pcm,we";
}
my @maint_test_repo = ();
for my $addon (split(/,/, get_addons())) {
my @result = split(/,/, get_repo($addon));
push(@maint_test_repo, split(/,/, get_repo($addon)));
}
print Dumper(@maint_test_repo), "\n";
print join(',', @maint_test_repo);
that means that doing something similar and using the default parameter of get_var it should simplify the code: get_var(uc($addon) . '_TEST_REPOS', "")
Note: zypper in perl-Data-Dump
(if you don't have installed in your system)
a0a1c55
to
60500bc
Compare
Add upgrade autoyast profile and yaml schedule files for migration from maintenance update released to maintenance update unreleased testsuites; And add a testsuite to generate the support image of SLES12SP5 via autoyast installation; To make the job add target product's maintenance update repos, need to reset the SCC_ADDONS values becuase the modules names of SLES12SP5 and SLES15SP5 are different, and there's a blessed modules which would be added during migration fron 12SP5 to 15SPx.
Add a testsuite to generate the support image of SLES12SP5 via autoyast installation;
Add upgrade autoyast profile and yaml schedule files for migration from maintenance update released to maintenance update unreleased testsuites;
To make the job add target product's maintenance update repos, reset the SCC_ADDONS values because the modules names of SLES12SP5 and SLES15SP5 are different, and there's a blessed modules which would be added during migration fron 12SP5 to 15SPx.