Skip to content

Commit

Permalink
Generate DUD dynamically before installation
Browse files Browse the repository at this point in the history
  • Loading branch information
jknphy committed Sep 18, 2020
1 parent 0ecc8f9 commit 5fe0409
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 3 deletions.
14 changes: 14 additions & 0 deletions data/add_on_products.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<add_on_products xmlns="http://www.suse.com/1.0/yast2ns"
xmlns:config="http://www.suse.com/1.0/configns">
<product_items config:type="list">
<product_item>
<name>SUSE Linux Enterprise Development Tools Module</name>
<url><![CDATA[ftp://openqa.suse.de/{{REPO_SLE_MODULE_DEVELOPMENT_TOOLS}}]]></url>
<priority config:type="integer">50</priority>
<ask_user config:type="boolean">true</ask_user>
<selected config:type="boolean">true</selected>
<check_name config:type="boolean">true</check_name>
</product_item>
</product_items>
</add_on_products>
4 changes: 3 additions & 1 deletion lib/autoyast.pm
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,9 @@ sub adjust_network_conf {
sub expand_variables {
my ($profile) = @_;
# Expand other variables
my @vars = qw(SCC_REGCODE SCC_REGCODE_HA SCC_REGCODE_GEO SCC_REGCODE_HPC SCC_REGCODE_WE SCC_URL ARCH LOADER_TYPE NTP_SERVER_ADDRESS SCC_REGCODE_LTSS);
my @vars = qw(SCC_REGCODE SCC_REGCODE_HA SCC_REGCODE_GEO SCC_REGCODE_HPC
SCC_REGCODE_WE SCC_URL ARCH LOADER_TYPE NTP_SERVER_ADDRESS
SCC_REGCODE_LTSS REPO_SLE_MODULE_DEVELOPMENT_TOOLS);
# Push more variables to expand from the job setting
my @extra_vars = push @vars, split(/,/, get_var('AY_EXPAND_VARS', ''));
if (get_var 'SALT_FORMULAS_PATH') {
Expand Down
5 changes: 5 additions & 0 deletions lib/bootloader_setup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,11 @@ sub specific_bootmenu_params {
if ($dud =~ /^(http|https|ftp):\/\//) {
push @params, "dud=$dud";
}
elsif ($dud =~ /^ASSET_\d+$/) {
# In case dud is uploaded as an ASSET we need just filename
$dud = basename(get_required_var($dud));
push @params, 'dud=' . autoinst_url("/assets/other/$dud");
}
else {
push @params, 'dud=' . data_url($dud);
}
Expand Down
3 changes: 1 addition & 2 deletions schedule/yast/dud_development_tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ description: >
Also development tools module requires desktop applications module as a
dependency, so DESKTOP is set to gnome.
vars:
DUD: dev_tools.dud
DUD_ADDONS: sdk
DESKTOP: gnome
SCC_ADDONS: base,serverapp,desktop
Expand Down Expand Up @@ -40,6 +39,6 @@ schedule:
test_data:
dud_repos:
# The URI is the same as set in 'data/dev_tools.dud' file.
- URI: 'ftp://openqa.suse.de/SLE-15-Module-Development-Tools-POOL-x86_64-Media1-CURRENT'
- URI: 'ftp://openqa.suse.de/SLE-15-SP3-Module-Development-Tools-POOL-x86_64-Build36.5-Media1'
Enabled: Yes
Autorefresh: On
10 changes: 10 additions & 0 deletions schedule/yast/generate_dud.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: generate_dud
description: >
Generate DUD dynamically:
- Boot an image where phub module is consolidated allowing to install mkdud
(from a product not under development).
- Create DUD expanding variables using values configured for the product.
- Upload the DUD as an asset to be used by a chained job.
schedule:
- boot/boot_to_desktop
- console/generate_dud
39 changes: 39 additions & 0 deletions tests/console/generate_dud.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# SUSE's openQA tests
#
# Copyright © 2020 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.

# Summary: Generate DUD dynamically using mkdud and xml file where variables
# are expanded for the corresponding product/build.
#
# Maintainer: QA SLE YaST team <qa-sle-yast@suse.de>

use strict;
use warnings;
use base "opensusebasetest";
use testapi;
use utils qw(zypper_call);
use autoyast qw(expand_variables);
use registration qw(add_suseconnect_product get_addon_fullname);

sub run {
select_console 'root-console';

my $xml = 'add_on_products.xml';
my $dud = get_required_var('DUD');

add_suseconnect_product(get_addon_fullname('phub'));
zypper_call('in mkdud');
my $content = expand_variables(get_test_data($xml));
save_tmp_file($xml, $content);
assert_script_run('wget -P inst-sys ' . data_url($xml));
assert_script_run("mkdud --create $dud --dist sle15 " .
"--install instsys,repo --obs-keys --name 'Update' inst-sys");
upload_asset($dud);
}

1;

0 comments on commit 5fe0409

Please sign in to comment.