diff --git a/data/kiwi/appliance.kiwi b/data/kiwi/appliance.kiwi new file mode 100644 index 000000000000..33229c33ff84 --- /dev/null +++ b/data/kiwi/appliance.kiwi @@ -0,0 +1,391 @@ + + + + + + + + SUSE LLC + qe-core@suse.de + SUSE Linux Enterprise 15 SP4 Minimal + + + + + + + + + + + 1.1.0 + zypper + SLE + SLE + + true + + + + + + + + + + + + + 24 + + + + + 1.1.0 + zypper + SLE + SLE + + true + + + + + + + + + + + + 24 + + + + + 1.1.0 + zypper + SLE + SLE + + true + + + + + + + + + + + + + 24 + + + + + + 1.1.0 + zypper + SLE + SLE + + true + + + + + 1.1.0 + zypper + SLE + SLE + + true + + + + + + + + + + + + + 24 + + + + + 1.1.0 + zypper + SLE + SLE + + true + + + + + + + + + + + + + true + 1000 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/kiwi/config.sh b/data/kiwi/config.sh new file mode 100644 index 000000000000..1d21c387d53e --- /dev/null +++ b/data/kiwi/config.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Specify the network interface name +interface="eth0" + +# Create the network profile file +profile_file="/etc/sysconfig/network/ifcfg-$interface" +touch $profile_file + +# Add configuration to the network profile file +echo "BOOTPROTO='dhcp'" >> $profile_file +echo "STARTMODE='auto'" >> $profile_file + +# Restart the network service to apply the changes +systemctl restart wicked.service diff --git a/schedule/qam/15-SP4/kiwi_build_local_img.yaml b/schedule/qam/15-SP4/kiwi_build_local_img.yaml new file mode 100644 index 000000000000..0b15f388f58b --- /dev/null +++ b/schedule/qam/15-SP4/kiwi_build_local_img.yaml @@ -0,0 +1,9 @@ +--- +name: kiwi_build_image +description: > + Kiwi test to build a qcow2 image locally +schedule: + - installation/bootloader_start + - boot/boot_to_desktop + - kiwi_images_test/kiwi_build_image +... diff --git a/schedule/qam/15-SP4/kiwi_validate_local_img.yaml b/schedule/qam/15-SP4/kiwi_validate_local_img.yaml new file mode 100644 index 000000000000..a89db1051c11 --- /dev/null +++ b/schedule/qam/15-SP4/kiwi_validate_local_img.yaml @@ -0,0 +1,8 @@ +--- +name: kiwi_validate_local_img +description: > + Validate the locally built Kiwi qcow2 image by booting it +schedule: + - boot/boot_to_desktop + - kiwi_images_test/validate_local_kiwi_image +... diff --git a/tests/kiwi_images_test/kiwi_build_image.pm b/tests/kiwi_images_test/kiwi_build_image.pm new file mode 100644 index 000000000000..89fd474f6200 --- /dev/null +++ b/tests/kiwi_images_test/kiwi_build_image.pm @@ -0,0 +1,44 @@ +# SUSE's openQA tests +# +# Copyright 2022 SUSE LLC +# SPDX-License-Identifier: FSFAP + +# Summary: Perform a Kiwi test to build a qcow2 image locally. +# Firstly, install Kiwi-ng and copy the Kiwi XML file from the data +# folder to the /tmp directory. +# Execute the Kiwi-ng command to build the KVM and Xen image locally. +# Upload the locally created qcow2 image for further testing. +# Maintainer: QE Core + +use strict; +use warnings; +use base "consoletest"; +use testapi; +use utils; + +my $testdir = '/tmp'; + +sub run { + my ($self) = @_; + my $build = get_var("BUILD"); + my $version = get_var("VERSION"); + $self->select_serial_terminal; + # Install KIWI-NG + zypper_call 'in python3-kiwi'; + assert_script_run("mkdir -p $testdir"); + # Copy the Kiwi XML description file from the data folder for building the + # Kiwi image locally + assert_script_run("curl -v -o $testdir/appliance.kiwi " . data_url("kiwi/appliance.kiwi")); + assert_script_run("curl -v -o $testdir/config.sh " . data_url("kiwi/config.sh")); + assert_script_run("sed -ie 's/SLE-version/$version/' $testdir/appliance.kiwi"); + # Execute the Kiwi-ng command to build the KVM and Xen system image + assert_script_run("kiwi-ng --profile kvm-and-xen system build --description $testdir --target-dir /tmp/", timeout => 1200); + # Verify the built qcow2 image filename in the /tmp folder and rename the file with the proper build number, + # considering that the Kiwi NG XML requires a mandatory image version in the format of Major.Minor.Releases, + # while the SLE Build may have different requirements. + validate_script_output("ls -l /tmp", sub { m/SLES$version-kiwi.x86_64-1.1.0.qcow2/ }); + assert_script_run("mv /tmp/SLES$version-kiwi.x86_64-1.1.0.qcow2 /tmp/SLES$version-kiwi.x86_64-$build.qcow2"); + upload_asset("/tmp/SLES$version-kiwi.x86_64-$build.qcow2", 1, 1); +} + +1; diff --git a/tests/kiwi_images_test/validate_local_kiwi_image.pm b/tests/kiwi_images_test/validate_local_kiwi_image.pm new file mode 100644 index 000000000000..9d8fbd1498ae --- /dev/null +++ b/tests/kiwi_images_test/validate_local_kiwi_image.pm @@ -0,0 +1,23 @@ +# SUSE's openQA tests +# +# Copyright 2019 SUSE LLC +# SPDX-License-Identifier: FSFAP + +# Summary: Validate the locally built Kiwi qcow2 image by booting it. +# Maintainer: QE Core + +use base "installbasetest"; +use strict; +use warnings; +use testapi; +use serial_terminal 'select_serial_terminal'; + +sub run { + my $args_gw = testapi::host_ip(); + select_serial_terminal; + assert_script_run("cat /etc/os-release"); + assert_script_run("ip a"); + assert_script_run('ping -c 1 ' . $args_gw); +} + +1;