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 85a0b63
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 1 deletion.
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>
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
1 change: 0 additions & 1 deletion 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
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
49 changes: 49 additions & 0 deletions tests/console/generate_dud.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 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 registration qw(add_suseconnect_product get_addon_fullname);

sub expand_variables {
my ($xml) = shift;

my $file = "inst-sys/$xml";
my @vars = (script_output("cat $file") =~ /\{\{(\w+)\}\}/g);
for my $var (@vars) {
my $val = get_var($var);
die "Test died: Could not retrieve required variable '$var'" unless $val;
assert_script_run("sed -i 's/{{$var}}/$val/g' $file");
}
}

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');
assert_script_run('wget -P inst-sys ' . data_url($xml));
expand_variables($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 85a0b63

Please sign in to comment.