Skip to content

Commit f4e10b6

Browse files
authored
Integrate simple lifecycle examples (#89)
* Integrate simple lifecycle examples * Update to allow more custom layout * Make QEMU close on ctrl+c * Make CLI examples support more scenarios * Tune settings and reuse cache * USe latest modules versions * Use special signal
1 parent bc2c94f commit f4e10b6

File tree

20 files changed

+469
-66
lines changed

20 files changed

+469
-66
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ __pycache__/
2727
/score_*/
2828
/.gita/
2929
/.gita-workspace.csv
30+
integration/build

integration/MODULE.bazel

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,8 @@ git_override(
4949
remote = "https://github.com/bmw-software-engineering/trlc.git",
5050
)
5151

52-
git_override(
53-
module_name = "score_toolchains_qnx",
54-
commit = "aa94b4fb566b989d1a00395c810df2cf254a0cec",
55-
remote = "https://github.com/qorix-group/toolchains_qnx.git",
56-
)
57-
58-
5952
# Currently required for ifs tooling
60-
bazel_dep(name = "score_toolchains_qnx", version = "0.0.3")
53+
bazel_dep(name = "score_toolchains_qnx", version = "0.0.7")
6154
toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency=True)
6255
toolchains_qnx.sdp(
6356
sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63",

integration/bazel_common/bundlers.bzl

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ load("@rules_pkg//pkg:pkg.bzl", "pkg_tar")
22
load("@rules_pkg//pkg:mappings.bzl", "pkg_files")
33

44

5-
def score_pkg_bundle(name, bins, config_data= None, package_dir = None, other_package_files = []):
5+
def score_pkg_bundle(name, bins, config_data= None, package_dir = None, other_package_files = [], custom_layout = {}):
66
"""
77
Creates a reusable bundle by chaining Bazel packaging rules:
88
- Collects binaries and config files into a pkg_files target, renaming them into subdirectories.
@@ -17,7 +17,12 @@ def score_pkg_bundle(name, bins, config_data= None, package_dir = None, other_pa
1717
config_data: Optional list of config file labels to include (placed in 'configs/').
1818
package_dir: Optional directory path for the package root inside the tar archive.
1919
other_package_files: Optional list of additional `NAME_pkg_files` to include in the tar archive that was created by other `score_pkg_bundle` targets.
20-
20+
custom_layout: Optional dict mapping labels -> destination path inside the package. All destination will be prefixed with "data/NAME/".
21+
Example:
22+
custom_layout = {
23+
"//app:data.txt": "resources/data.txt",
24+
"//lib:helper.sh": "scripts/helper.sh",
25+
}
2126
"""
2227

2328
all_files_name = name + "_pkg_files"
@@ -37,10 +42,17 @@ def score_pkg_bundle(name, bins, config_data= None, package_dir = None, other_pa
3742
if config_data != None:
3843
config_data_arr = config_data
3944

45+
46+
if custom_layout == None:
47+
custom_layout = {}
48+
49+
for label, dst in custom_layout.items():
50+
rename_dict[label] = "data/" + name + "/" + dst
51+
4052
# Step 1: pkg_files
4153
pkg_files(
4254
name = all_files_name,
43-
srcs = bins + config_data_arr,
55+
srcs = bins + config_data_arr + list(custom_layout.keys()),
4456
renames = rename_dict,
4557
visibility = ["//visibility:public"],
4658
)

integration/bazel_common/score_basic_tools.MODULE.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,10 @@ git_override(
1616
branch = "main",
1717
remote = "https://github.com/bilelmoussaoui/bazel-rpm.git",
1818
)
19+
20+
bazel_dep(name = "flatbuffers", version = "25.9.23")
21+
git_override(
22+
module_name = "flatbuffers",
23+
commit = "187240970746d00bbd26b0f5873ed54d2477f9f3",
24+
remote = "https://github.com/google/flatbuffers.git",
25+
)

integration/bazel_common/score_modules.MODULE.bazel

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,11 @@ single_version_override(
3333
"//patches/baselibs:0001-RH-exception-header.patch",
3434
"//patches/baselibs:0002-RH-algorithm-header.patch",
3535
],
36-
)
36+
)
37+
38+
bazel_dep(name = "score_lifecycle_health")
39+
git_override(
40+
module_name = "score_lifecycle_health",
41+
commit = "84303c2e48c7e8e2481752170efe82d0afd45f1e",
42+
remote = "https://github.com/eclipse-score/lifecycle.git",
43+
)

integration/images/qnx_x86_64/build/system.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ toybox # Minimal Unix utilities collection (re
164164
[type=link] zcat=toybox # Display contents of compressed files
165165
[type=link] nc=toybox # Netcat for network connections and packet streaming
166166
[type=link] netcat=toybox # Netcat alias for network connections
167-
168-
167+
[type=link] pkill=slay # Process killer Linux compatibility layer
169168
#############################################
170169
### Tools ###
171170
#############################################
@@ -198,6 +197,7 @@ hostname
198197
route
199198
dhcpcd # DHCP client daemon for automatic network configuration
200199
tcpdump # Network packet capture tool for Wireshark analysis
200+
slay
201201
/usr/lib/ssh/sftp-server=${QNX_TARGET}/${PROCESSOR}/usr/libexec/sftp-server # File transfer server to enable scp
202202

203203
#############################################

integration/runners/docker_x86_64/scripts/run_docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ echo "Starting docker with overlay image: ${OVERLAY_ABS_PATH}"
2121
docker run --rm -it \
2222
-v "${OVERLAY_ABS_PATH}:/showcases" \
2323
ubuntu:22.04 \
24-
/showcases/bin/cli
24+
bash -c "/showcases/bin/cli; exec bash"

integration/runners/qemu_x86_64/scripts/run_qemu.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@ QNX_HOST=$1
2020
IFS_IMAGE=$2
2121
echo "Starting QEMU with IFS image: ${IFS_IMAGE}"
2222
qemu-system-x86_64 \
23+
-enable-kvm \
2324
-smp 2 \
24-
-cpu Cascadelake-Server-v5 \
25+
-cpu host\
2526
-m 1G \
2627
-pidfile /tmp/qemu.pid \
2728
-nographic \
2829
-kernel "${IFS_IMAGE}" \
29-
-serial mon:stdio \
30+
-chardev stdio,id=char0,signal=on,mux=on \
31+
-mon chardev=char0,mode=readline \
32+
-serial chardev:char0 \
3033
-object rng-random,filename=/dev/urandom,id=rng0 \
3134
-netdev bridge,id=net0,br=virbr0 -device virtio-net-pci,netdev=net0 \
32-
-device virtio-rng-pci,rng=rng0
35+
-device virtio-rng-pci,rng=rng0

integration/score_starter

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import argparse
99
# ================== CONFIG ==================
1010
# Each entry: (description, command, name)
1111
mEntries = [
12-
("Run QNX x86_64 QEMU", "bazel run --config qnx-x86_64 //images/qnx_x86_64:run", "qnx-x86_64"),
13-
("Run Linux x86_64 Docker", "bazel run --config linux-x86_64 //images/linux_x86_64:run", "linux-x86_64"),
12+
("Run QNX x86_64 QEMU", "bazel --output_base=build/qnx-x86_64 run --config qnx-x86_64 //images/qnx_x86_64:run", "qnx-x86_64"),
13+
("Run Linux x86_64 Docker", "bazel --output_user_root=build/linux-x86_64 run --config linux-x86_64 //images/linux_x86_64:run", "linux-x86_64"),
1414
("Run Elektrobit Corbos aarch64 QEMU",
15-
"bazel build --config eb-aarch64 //images/ebclfsa_aarch64/scrample_integration:run", "eb-aarch64"),
15+
"bazel --output_user_root=build/eb-aarch64 build --config eb-aarch64 //images/ebclfsa_aarch64/scrample_integration:run", "eb-aarch64"),
1616
("Build Autosd x86_64 RPM",
17-
"bazel build --config autosd-x86_64 //images/autosd_x86_64:lola-demo", "autosd-x86_64"),
17+
"bazel --output_user_root=build/autosd-x86_64 build --config autosd-x86_64 //images/autosd_x86_64:lola-demo", "autosd-x86_64"),
1818
("Exit", "exit 0", "exit"),
1919
]
2020

@@ -47,6 +47,7 @@ def run_entry(entry):
4747
sys.exit(0)
4848

4949
# Run command in user's shell
50+
print("Running ", cmd)
5051
result = subprocess.call(cmd, shell=True)
5152
sys.exit(result)
5253

integration/showcases/BUILD

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ score_pkg_bundle(
1616
name = "showcases_all",
1717
# package_dir = "",
1818
bins = ["//showcases/cli" ],
19-
other_package_files = ["//showcases/standalone:standalone_pkg_files", "//showcases/kyron:kyron_pkg_files", "//showcases/orchestration_persistency:orch_per_pkg_files"],
19+
other_package_files = [
20+
"//showcases/standalone:standalone_pkg_files",
21+
"//showcases/kyron:kyron_pkg_files",
22+
"//showcases/orchestration_persistency:orch_per_pkg_files",
23+
"//showcases/simple_lifecycle:simple_lifecycle_pkg_files",
24+
],
2025

2126
)
2227

0 commit comments

Comments
 (0)