Skip to content

Commit 7c2d776

Browse files
committed
Make integration tests to build outside of OBS
Update and extend all integration tests such that they also build outside of the Open Build Service. Along with the changes on the descriptions a simple build-tests.sh script was added to drive the build process. The build is based on the kiwi boxbuild plugin in container mode to build the tests from a given build-tests directory. A new chapter to document how to Build the Build Tests is also provided and referenced on the github main page.
1 parent 03b0560 commit 7c2d776

File tree

78 files changed

+579
-281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+579
-281
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ check: setup
117117
# shell code checks
118118
bash -c 'shellcheck -e ${sc_disable} dracut/modules.d/*/*.sh -s bash'
119119
bash -c 'shellcheck -e ${sc_disable} kiwi/config/functions.sh -s bash'
120+
bash -c 'shellcheck build-tests.sh'
120121
# python flake tests
121122
poetry run flake8 --statistics -j auto --count kiwi
122123
poetry run flake8 --statistics -j auto --count test/unit

README.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ KIWI - Next Generation
1818
.. |Doc| replace:: `Documentation <https://osinside.github.io/kiwi/>`__
1919
.. |Installation| replace:: `Installation <https://osinside.github.io/kiwi/installation.html>`__
2020
.. |Contributing| replace:: `Contributing <https://osinside.github.io/kiwi/contributing.html>`__
21+
.. |IntegrationTesting| replace:: `Integration Testing <https://osinside.github.io/kiwi/integration_testing.html>`__
2122
.. |Donate| image:: https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif
2223
:target: https://www.paypal.com/donate/?hosted_button_id=CYZY57A7Q4TCC
2324

@@ -27,10 +28,13 @@ KIWI - Next Generation
2728

2829
* |Installation|
2930

31+
* |IntegrationTesting|
32+
3033
* |Contributing|
3134

3235
* |Doc|
3336

34-
We'll donate it for good luck so's you're sure to come back :)
37+
KIWI has helped you in your work ? Even the smallest gift is
38+
a way to help that we don't run out of coffee :)
3539

3640
|Donate|

build-tests.sh

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
#!/bin/bash
2+
# git clone https://github.com/OSInside/kiwi.git
3+
# Simple build test script to build the integration test
4+
# images from a given test directory. The host to run this
5+
# command requires the following tools:
6+
#
7+
# - tree
8+
# - git
9+
# - xmllint
10+
# - podman
11+
# - pip
12+
#
13+
# And requires the installation of the kiwi box plugin
14+
#
15+
# $ pip install --upgrade kiwi-boxed-plugin
16+
#
17+
set -e
18+
19+
ARGUMENT_LIST=(
20+
"test-dir:"
21+
"test-name:"
22+
"box-name:"
23+
)
24+
25+
function usage() {
26+
echo "usage: build-tests --test-dir <dir>"
27+
echo " --test-dir <dir>"
28+
echo " Some test dir name, e.g. build-tests/x86/tumbleweed/"
29+
echo " --test-name <name>"
30+
echo " some test name, e.g. test-image-disk"
31+
echo " --box-name <name>"
32+
echo " name of the box to use for the build, default: universal"
33+
}
34+
35+
if ! opts=$(getopt \
36+
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
37+
--name "$(basename "$0")" \
38+
--options "" \
39+
-- "$@"
40+
); then
41+
usage
42+
exit 0
43+
fi
44+
45+
eval set --"${opts}"
46+
47+
while [[ $# -gt 0 ]]; do
48+
case "$1" in
49+
--test-dir)
50+
argTestDir=$2
51+
shift 2
52+
;;
53+
54+
--test-name)
55+
argTestName=$2
56+
shift 2
57+
;;
58+
59+
--box-name)
60+
argBoxName=$2
61+
shift 2
62+
;;
63+
64+
*)
65+
break
66+
;;
67+
esac
68+
done
69+
70+
if [ ! "${argTestDir}" ];then
71+
usage
72+
exit 1
73+
fi
74+
75+
if [ ! -e "${argTestDir}"/.repos ];then
76+
echo "No .repos information for specified test dir"
77+
exit 1
78+
fi
79+
80+
boxname=universal
81+
if [ "${argBoxName}" ];then
82+
boxname="${argBoxName}"
83+
fi
84+
85+
function create_repo_list() {
86+
local build_dir=$1
87+
if [ -s "${build_dir}"/.repos ];then
88+
local repo_options="--ignore-repos"
89+
while read -r repo;do
90+
repo_options="${repo_options} --add-repo ${repo}"
91+
done < "${build_dir}"/.repos
92+
echo "${repo_options}"
93+
fi
94+
}
95+
96+
function create_build_commands() {
97+
local build_dir=$1
98+
local test_name=$2
99+
build_commands=()
100+
for image in "${build_dir}"/*;do
101+
test -e "${image}/appliance.kiwi" || continue
102+
test -e "${image}/.skip_boxbuild_container" && continue
103+
base_image=$(basename "${image}")
104+
if [ -n "${test_name}" ] && [ ! "${test_name}" = "${base_image}" ];then
105+
continue
106+
fi
107+
build_command="kiwi-ng --debug"
108+
has_profiles=false
109+
repo_options=$(create_repo_list "${build_dir}")
110+
for profile in $(
111+
xmllint --xpath "//image/profiles/profile/@name" \
112+
"${image}/appliance.kiwi" 2>/dev/null | cut -f2 -d\"
113+
);do
114+
has_profiles=true
115+
target_dir="build_results/${base_image}/${profile}"
116+
build_command="${build_command} --profile ${profile}"
117+
build_command="${build_command} system boxbuild"
118+
build_command="${build_command} --box ${boxname} --container --"
119+
build_command="${build_command} --description $image"
120+
build_command="${build_command} ${repo_options}"
121+
build_command="${build_command} --target-dir ${target_dir}"
122+
echo "${build_command}" \
123+
> "build_results/${base_image}-${profile}.build"
124+
build_commands+=( "${build_command}" )
125+
build_command="kiwi-ng --debug"
126+
done
127+
if [ "${has_profiles}" = "false" ];then
128+
target_dir="build_results/${base_image}"
129+
build_command="${build_command} system boxbuild"
130+
build_command="${build_command} --box ${boxname} --container --"
131+
build_command="${build_command} --description $image"
132+
build_command="${build_command} ${repo_options}"
133+
build_command="${build_command} --target-dir ${target_dir}"
134+
echo "${build_command}" \
135+
> "build_results/${base_image}.build"
136+
build_commands+=( "${build_command}" )
137+
fi
138+
done
139+
}
140+
141+
# create results directory
142+
mkdir -p build_results
143+
144+
# build command list
145+
create_build_commands "${argTestDir}" "${argTestName}"
146+
147+
# build them in a row
148+
for build in "${build_commands[@]}";do
149+
${build}
150+
sudo rm -rf build_results/*/*/build/
151+
sudo rm -rf build_results/*/build/
152+
done
153+
154+
# show result tree
155+
test -d build_results && tree -L 3 build_results

build-tests/README.rst

Lines changed: 0 additions & 10 deletions
This file was deleted.

build-tests/arm/fedora/.repos

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
obs://Virtualization:Appliances:Staging/Fedora_39
2+
https://fedora.mirrorservice.org/fedora/linux/releases/39/Everything/aarch64/os

build-tests/arm/rawhide/.repos

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
obs://Virtualization:Appliances:Staging/Fedora_Rawhide
2+
https://fedora.mirrorservice.org/fedora/linux/development/rawhide/Everything/aarch64/os

build-tests/arm/tumbleweed/.repos

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
obs://Virtualization:Appliances:Staging/openSUSE_Tumbleweed
2+
https://download.opensuse.org/ports/aarch64/tumbleweed/repo/oss/

build-tests/arm/ubuntu/.repos

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
obs://Virtualization:Appliances:Staging/xUbuntu_24.04_aarch64,apt-deb,kiwi,,,,,,,false
2+
https://ports.ubuntu.com/ubuntu-ports,apt-deb,noble_1,,,,,main,noble,false
3+
https://ports.ubuntu.com/ubuntu-ports,apt-deb,noble_2,,,,,multiverse,noble,false
4+
https://ports.ubuntu.com/ubuntu-ports,apt-deb,noble_3,,,,,restricted,noble,false
5+
https://ports.ubuntu.com/ubuntu-ports,apt-deb,noble_4,,,,,universe,noble,false
6+
https://ports.ubuntu.com/ubuntu-ports,apt-deb,noble-updates_1,,,,,main,noble-updates,false
7+
https://ports.ubuntu.com/ubuntu-ports,apt-deb,noble-updates_2,,,,,multiverse,noble-updates,false
8+
https://ports.ubuntu.com/ubuntu-ports,apt-deb,noble-updates_3,,,,,restricted,noble-updates,false
9+
https://ports.ubuntu.com/ubuntu-ports,apt-deb,noble-updates_4,,,,,universe,noble-updates,false

build-tests/arm/ubuntu/test-image-rpi/appliance.kiwi

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
<preferences>
1010
<version>1.22.4</version>
1111
<packagemanager>apt</packagemanager>
12-
<locale>en_US</locale>
13-
<keytable>us</keytable>
14-
<timezone>UTC</timezone>
1512
<rpm-excludedocs>true</rpm-excludedocs>
1613
<type image="oem" filesystem="xfs" firmware="efi" bootpartition="false" efipartsize="128" devicepersistency="by-label" editbootinstall="editbootinstall_rpi.sh">
1714
<bootloader name="custom"/>
@@ -31,13 +28,13 @@
3128
</users>
3229

3330
<repository type="apt-deb" alias="kiwi-next-generation" priority="1" repository_gpgcheck="false" architectures="arm64">
34-
<source path="obs://Virtualization:Appliances:Staging/xUbuntu_23.04"/>
31+
<source path="obs://Virtualization:Appliances:Staging/xUbuntu_24.04"/>
3532
</repository>
36-
<repository type="apt-deb" alias="Ubuntu-Lunar-Universe" distribution="lunar" components="main multiverse restricted universe" repository_gpgcheck="false">
37-
<source path="obs://Ubuntu:23.04/universe"/>
33+
<repository type="apt-deb" alias="Ubuntu-Noble-Universe" distribution="noble" components="main multiverse restricted universe" repository_gpgcheck="false">
34+
<source path="obs://Ubuntu:24.04/universe"/>
3835
</repository>
39-
<repository type="apt-deb" alias="Ubuntu-Lunar" distribution="lunar" components="main multiverse restricted universe" repository_gpgcheck="false">
40-
<source path="obs://Ubuntu:23.04/standard"/>
36+
<repository type="apt-deb" alias="Ubuntu-Noble" distribution="noble" components="main multiverse restricted universe" repository_gpgcheck="false">
37+
<source path="obs://Ubuntu:24.04/standard"/>
4138
</repository>
4239

4340
<packages type="image">
@@ -56,7 +53,6 @@
5653
<package name="git"/>
5754
<package name="sudo"/>
5855
<package name="net-tools"/>
59-
<package name="tzdata"/>
6056
<package name="apt-utils"/>
6157
<package name="systemd"/>
6258
<package name="systemd-timesyncd"/>
@@ -69,21 +65,19 @@
6965
<package name="dbus"/>
7066
<package name="xfsprogs"/>
7167
<package name="dracut-kiwi-oem-repart"/>
72-
<package name="usrmerge"/>
7368
<package name="mawk"/>
7469
<package name="openssh-client"/>
7570
<package name="openssh-server"/>
76-
<package name="netcat"/>
7771
<package name="zstd"/>
7872
<package name="util-linux"/>
7973
<package name="less"/>
8074
<package name="vim"/>
8175
<package name="fdisk"/>
8276
<package name="language-pack-en"/>
77+
<package name="locales-all"/>
78+
<package name="tzdata"/>
8379
</packages>
8480
<packages type="bootstrap">
85-
<package name="apt-utils"/>
86-
<package name="debconf"/>
87-
<package name="mawk"/>
81+
<package name="ca-certificates"/>
8882
</packages>
8983
</image>

build-tests/arm/ubuntu/test-image-rpi/pre_disk_sync.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ cp -a /usr/lib/firmware/*-raspi/device-tree/broadcom/* /boot/efi/
1717
#==========================================
1818
# copy initrd and kernel
1919
#------------------------------------------
20-
cp /boot/initrd-*-raspi /boot/efi/initrd.img
21-
cp /boot/vmlinuz-*-raspi /boot/efi/vmlinuz
20+
cp /boot/initrd*-raspi /boot/efi/initrd.img
21+
cp /boot/vmlinuz*-raspi /boot/efi/vmlinuz
2222

2323
#==========================================
2424
# copy u-boot

0 commit comments

Comments
 (0)