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

Introduce Kiwi tests to build image locally #17178

Merged
merged 1 commit into from Jun 9, 2023

Conversation

DeepthiYV
Copy link
Contributor

@DeepthiYV DeepthiYV commented May 30, 2023

Copy link
Member

@foursixnine foursixnine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from the minor comments, it all looks ok... I would try to avoid hardcoding the version everywhere though

<image schemaversion="6.1" name="SLES15-SP4-Minimal" displayname="SLES 15 SP4">
<description type="system">
<author>SUSE LLC</author>
<contact>crc@suse.com</contact>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QE-Core? :)

<profile name="RaspberryPi" description="Minimal for the Raspberry Pi" arch="aarch64"/>
</profiles>
<preferences profiles="kvm-and-xen">
<version>15.4.0</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think version here shouldn't be hardcoded

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the Kiwi documentation, the mandatory image version should follow a three-part format: Major.Minor.Release. Therefore, I have modified the version to 1.1.0 in the Kiwi XML file. After the Kiwi build is completed,I rename the version in the generated qcow2 file to match the build setting value.This step enables me to further test the generated qcow2.

</preferences>

<preferences profiles="kvm">
<version>15.4.0</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Comment on lines 269 to 277
<repository type="rpm-md" alias="sle">
<source path="http://updates.suse.de/SUSE/Products/SLE-Product-SLES/15-SP4/x86_64/product/"/>
</repository>
<repository type="rpm-md" alias="sle-dev">
<source path="http://updates.suse.de/SUSE/Products/SLE-Module-Development-Tools/15-SP4/x86_64/product/"/>
</repository>
<repository type="rpm-md" >
<source path="http://updates.suse.de/SUSE/Products/SLE-Module-Server-Applications/15-SP4/x86_64/product/"/>
</repository>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as a bove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have modified the code and XML files to maintain generic across different SLEs versions.

# 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/SLES15-SP4-Minimal.x86_64-15.4.0.qcow2/ });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the <version>foo</version> only needed for this part? or if you set it to... say SLES-15-SP4 does it have any impact In the profile thing?

# Kiwi image locally
assert_script_run("curl -v -o $testdir/appliance.kiwi " . data_url("kiwi/appliance.kiwi"));
# Execute the Kiwi-ng command to build the KVM and Xen system image
script_run("kiwi-ng --profile kvm-and-xen system build --description $testdir --target-dir /tmp/", timeout => 1200);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not assert script run?

@foursixnine foursixnine added the qe-core Tag used to filter PR's created by QE-Core's members or are assigned to them label May 30, 2023
use warnings;
use testapi;
use utils;
use network_utils qw(iface setup_static_network);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not needed anymore?

@DeepthiYV DeepthiYV force-pushed the kiwi_test branch 2 times, most recently from 6cb10ca to 1b39772 Compare May 31, 2023 08:23
@DeepthiYV DeepthiYV changed the title Add a kiwi test Introduce Kiwi tests to build image locally May 31, 2023
my $args_gw = testapi::host_ip();
# login in to system
enter_cmd("root");
sleep(2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fear that the sleep will need to be changed in the future, can you add a comment to rework the test if it fails because of this? as 2 seconds might be too little if the host system is under heavy load

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the sleep in the code by handling the login to the system via a function call, select_serial_terminal(). Additionally, I modified the user accounts in the Kiwi XML file with the default passwords.

@@ -0,0 +1,9 @@
---
name: kiwi_test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: kiwi_test
name: kiwi_build_image

Perform a Kiwi test to build a qcow2 image locally
@DeepthiYV DeepthiYV merged commit 10611fe into os-autoinst:master Jun 9, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qe-core Tag used to filter PR's created by QE-Core's members or are assigned to them
Projects
None yet
2 participants