Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chcao
Copy link
Contributor

@chcao chcao commented Jun 19, 2024

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.

@chcao chcao force-pushed the upgrade_to_target_product_plus_mu_repo branch 10 times, most recently from 504a682 to f91505a Compare June 19, 2024 09:11
@chcao chcao added the qe-yam label Jun 19, 2024
@chcao chcao force-pushed the upgrade_to_target_product_plus_mu_repo branch 5 times, most recently from e79b236 to 2e15c92 Compare June 20, 2024 13:09
@chcao chcao changed the title [WIP] Upgrade SLES12SP5 MU released to SLES15SP6 MU unreleased Upgrade SLES12SP5 MU released to SLES15SP6 MU unreleased Jun 21, 2024
@chcao chcao requested a review from lemon-suse June 21, 2024 02:33
@jknphy
Copy link
Contributor

jknphy commented Jun 21, 2024

we should not use old modules like reboot_to_upgrade or version_switch_upgrade_target, check here to inspire you:
https://openqa.suse.de/tests/14698741

@chcao chcao force-pushed the upgrade_to_target_product_plus_mu_repo branch 2 times, most recently from b33ae4b to 0646cb0 Compare June 21, 2024 11:13
@chcao
Copy link
Contributor Author

chcao commented Jun 21, 2024

we should not use old modules like reboot_to_upgrade or version_switch_upgrade_target, check here to inspire you: https://openqa.suse.de/tests/14698741

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);
Copy link
Contributor

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 {

Copy link
Contributor

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
Copy link
Contributor

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'));
Copy link
Contributor

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.

Comment on lines 29 to 30
my %incidents;
$incidents{OS} = get_var('OS_TEST_REPOS', '');
Copy link
Contributor

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) {
Copy link
Contributor

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.
Copy link
Contributor

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'

@chcao chcao force-pushed the upgrade_to_target_product_plus_mu_repo branch from 0646cb0 to 4d9af4d Compare June 24, 2024 07:50
@chcao chcao force-pushed the upgrade_to_target_product_plus_mu_repo branch 3 times, most recently from 262a79b to 0b6ecb0 Compare June 24, 2024 09:32
@chcao chcao changed the title Upgrade SLES12SP5 MU released to SLES15SP6 MU unreleased [WIP] Upgrade SLES12SP5 MU released to SLES15SP6 MU unreleased Jun 24, 2024
@chcao chcao force-pushed the upgrade_to_target_product_plus_mu_repo branch 7 times, most recently from aa7e6a0 to c8d3f06 Compare June 25, 2024 08:02
@chcao chcao changed the title [WIP] Upgrade SLES12SP5 MU released to SLES15SP6 MU unreleased Upgrade SLES12SP5 MU released to SLES15SP6 MU unreleased Jun 25, 2024
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) = ('', '');
Copy link
Contributor

@jknphy jknphy Jun 26, 2024

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)

@chcao chcao force-pushed the upgrade_to_target_product_plus_mu_repo branch 2 times, most recently from a0a1c55 to 60500bc Compare June 27, 2024 08:05
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants