Skip to content

feat(diagnostics): deploy the OpenSOVD gateway and CDA - #482

Draft
alexmohr wants to merge 40 commits into
mainfrom
feat/add-diagnostics
Draft

alexmohr wants to merge 40 commits into
mainfrom
feat/add-diagnostics

Conversation

@alexmohr

@alexmohr alexmohr commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add the OpenSOVD gateway and the classic diagnostic adapter (CDA) from eclipse-score/diagnostics to the platform, so they end up in the Linux, EB and AutoSD images, and add a showcase that starts them.

  • Register score_diagnostics in known_good.json (and regenerate the Bazel fragments); its docs bundle is mounted.
  • Generate the root overrides for opensovd_core, classic-diagnostic-adapter and mbedtls-rs from the diagnostics_deps group in known_good.json, because overrides are only honoured in the root module.
  • Supply the pinned OpenSOVD commit and its reproducible date through the upstream gateway build-stamp setting. opensovd-gateway --version and /sovd/version-info report that revision; //deploy/diagnostics:gateway_stamp_test checks it against the pin in MODULE.bazel. The CDA requirements exports and gateway stamp support are consumed upstream, without the former local patches.
  • Add //deploy/diagnostics and install the gateway and CDA under /usr/bin/diagnostics via //deploy:platform_tar.
  • Add the showcase Diagnostics Stack and start the stack as a service (//showcases/diagnostics): service.sh waits for a network address and runs the launch manager, which starts the CDA with the ECU simulator's databases and settings, then starts the gateway. The EB QEMU image starts the service at boot with a crinit task; the showcase check uses a running service or starts one. A shared lock prevents duplicate startup, and the check leaves an existing service running. HTTP probes have a timeout and retry until both apps are available.
  • Keep the diagnostics launch manager's process name, communication instance and application ID separate from the other showcases. Add the platform integration test //platform_integration_tests/diagnostics (Linux x86_64) to the pit suite; it also checks that the diagnostics service keeps running while Platform Run runs.
  • Enable --experimental_isolated_extension_usages, which the current opensovd_core pin needs.
  • Use --host_conlyopt=-std=gnu11 for integration and unified module-test host tools, so the pkg-config bootstrap's bundled GLib can compile without applying the local rules_foreign_cc patch.
  • Stop restoring the Bazel disk cache in the EB image workflow; with it the runner runs out of disk space.
  • Fix the module test harness: filter overrides that are not in the module's graph and provide the gateway build stamp when testing modules with the pinned OpenSOVD dependency.

Raspberry Pi image support is separate in draft PR #522 and is not included here.

The diagnostics dependency is pinned to 0152801c524c4af8d718ed03915703e8ef632131 on diagnostics main. The gateway uses the upstream SOVD_* settings and placeholder token authentication; this is a development setup, not production authentication.

Checklist

  • I have tested my changes locally
  • I have added or updated documentation
  • I have linked related issues or discussions
  • I have added or updated tests

Related

Includes the merged work in eclipse-score/diagnostics#70, eclipse-score/diagnostics#86 and eclipse-score/diagnostics#97. Refs eclipse-score/diagnostics#69.

Raspberry Pi images: #522.

Notes for Reviewers

Previously verified locally (not rerun as part of this description cleanup):

  • bazel build --config=linux-aarch64 //deploy:platform_tar //showcases:showcases_pkg_tar succeeds; the tars contain the gateway and the CDA (aarch64 ELF), the showcase, its launch manager configuration and the databases.
  • Both tars unpacked in an arm64 Debian 12 container: /showcases/bin/cli --examples="Diagnostics Stack" passes.
  • The EB QEMU image, booted as a host on the Docker network of the CDA's ECU simulator: crinit starts the diagnostics service at boot, and through the gateway on the VM's address the six simulated ECUs are listed and the VIN of flxc1000 is read. The CDA's port is not reachable from the network (dev.sh run-qemu, ecu-sim.sh test-vm in https://github.com/alexmohr/score-diagnostics-quickstart).
  • The Linux x86_64 and AutoSD images with the diagnostics components.
  • bazel query resolves @score_diagnostics//:docs_bundle and the new targets.
  • The module test harness change: with it the pin of rules_foreign_cc is dropped for score_kyron and Bazel gets past the graph step.

Design choices to review:

  • The components are added to platform_tar only, not to platform_bundle. The QNX images consume platform_bundle, and the OpenSOVD components do not support QNX. For the same reason the showcase is in //showcases:showcases but not in showcases_bundle.
  • Only the binaries are part of the platform. The CDA configuration and the ECU databases belong to the showcase, because they are test data (deploy/README.md says the platform stays free of that).
  • The CDA binary is about 127 MB, which grows the images.
  • The root OpenSOVD pin and build-stamp commit must stay in sync; gateway_stamp_test fails when the commit differs.
  • Registry releases for the external dependencies, removal of the experimental flag, and the QNX support question remain under discussion in the review threads.

Alexander Mohr alexander.m.mohr@mercedes-benz.com, Mercedes-Benz Tech Innovation GmbH
Provider Information

@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

@alexmohr
alexmohr force-pushed the feat/add-diagnostics branch 2 times, most recently from f5c7891 to 92a5da1 Compare November 14, 2026 20:55
@alexmohr
alexmohr force-pushed the feat/add-diagnostics branch 4 times, most recently from f31a10b to a7f467a Compare November 15, 2026 08:06
Comment thread deploy/README.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The diagnostics probe can hang indefinitely or fail before both apps are ready, while lifecycle cleanup can terminate the diagnostics service and exhaust its restart attempts.

3 open issues
What changed in this PR

Integrates the OpenSOVD gateway and classic diagnostic adapter from inc_diagnostics into S-CORE’s Linux-based images, while keeping these components out of QNX bundles.

Changes:

  • Registers diagnostics dependencies, patches and documentation, and adjusts module-test pin handling.
  • Packages the binaries, adds a supervised diagnostics showcase and integration test, and enables EB boot startup.
  • Adds an EB Raspberry Pi 4B image with offline deployment tooling.
File Description
showcases/​diagnostics/​service.sh Waits for networking and starts the diagnostics supervisor.
showcases/​diagnostics/​launch_manager_config.json Configures CDA and gateway startup and supervision.
showcases/​diagnostics/​diagnostics.score.json Registers the Diagnostics Stack showcase.
showcases/​diagnostics/​check.sh Checks gateway responses and CDA forwarding.
showcases/​diagnostics/​cda-paths.toml Defines CDA storage, database and network settings.
showcases/​diagnostics/​BUILD Packages showcase scripts, configuration and databases.
showcases/​BUILD Includes diagnostics in the showcase tar.
scripts/​tests/​test_module_tests.py Tests parsing of nonexistent-module override errors.
scripts/​module_tests.py Removes pins for dependencies absent after graph resolution.
platform_integration_tests/​diagnostics/​test_diagnostics_showcase.py Asserts diagnostics-specific showcase success.
platform_integration_tests/​diagnostics/​BUILD Defines the Linux x86_64 diagnostics test target.
platform_integration_tests/​BUILD Adds diagnostics to the integration-test suite.
patches/​diagnostics/​opensovd-core-expose-deps.patch Adds aliases for gateway dependencies.
patches/​diagnostics/​opensovd-core-expose-client.patch Adds a Bazel target for the client library.
patches/​diagnostics/​classic-diagnostic-adapter-test-databases.patch Exposes simulator databases through Bazel.
patches/​diagnostics/​classic-diagnostic-adapter-resource-ids.patch Populates resource identifiers in CDA responses.
patches/​diagnostics/​classic-diagnostic-adapter-linkme.patch Retains linker sections used for service registration.
patches/​diagnostics/​BUILD Establishes the diagnostics patch package.
MODULE.bazel Adds root-level OpenSOVD dependency pins and patches.
known_good.json Registers diagnostics and its module-test settings.
images/​ebclfsa_rpi4b/​README.md Documents image building, flashing and requirements.
images/​ebclfsa_rpi4b/​build/​build_image.sh Deploys archives into the board image using debugfs.
images/​ebclfsa_rpi4b/​build/​BUILD Assembles the deployed Raspberry Pi image.
images/​ebclfsa_rpi4b/​BUILD Exposes the board-image target.
images/​ebclfsa_aarch64/​build/​config-overlay/​etc/​crinit/​crinit.d/​diagnostics.crinit Defines diagnostics boot startup and restart policy.
images/​ebclfsa_aarch64/​build/​config-overlay/​BUILD Exports the diagnostics init task.
images/​ebclfsa_aarch64/​build/​BUILD Packages diagnostics startup for EB QEMU.
deploy/​README.md Documents diagnostics deployment and Raspberry Pi usage.
deploy/​diagnostics/​BUILD Packages the gateway and CDA under /usr/bin/diagnostics.
deploy/​BUILD Adds diagnostics binaries to the platform tar only.
bazel_common/​score_modules_target_sw.MODULE.bazel Adds the generated diagnostics module pin.
bazel_common/​score_images.MODULE.bazel Registers the Raspberry Pi base-image archive.
bazel_common/​docs_bundles.bzl Mounts the diagnostics documentation bundle.
.bazelrc Enables isolated extension usages required by OpenSOVD.

Review effort: Balanced

Comment thread showcases/diagnostics/check.sh Resolved
Comment thread showcases/diagnostics/check.sh Resolved
Comment thread showcases/diagnostics/service.sh Resolved
@alexmohr
alexmohr force-pushed the feat/add-diagnostics branch from 0349769 to c08f756 Compare November 19, 2026 11:12
@alexmohr
alexmohr force-pushed the feat/add-diagnostics branch from 7d6f5c3 to 73ab804 Compare November 23, 2026 11:21
@alexmohr alexmohr changed the title feat(diagnostics): deploy the OpenSOVD gateway and CDA from inc_diagnostics feat(diagnostics): deploy the OpenSOVD gateway and CDA Nov 24, 2026
@alexmohr
alexmohr force-pushed the feat/add-diagnostics branch 3 times, most recently from 9e0bb5f to ed53b85 Compare November 25, 2026 13:53
@alexmohr
alexmohr requested a balanced review from Copilot November 25, 2026 18:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A failed HTTP probe can start a duplicate diagnostics manager while the boot-started service is still initializing, requiring coordinated startup, readiness waiting, and ownership-aware shutdown.

1 open issue
3 resolved since last review

Review effort: Balanced

Comment thread showcases/diagnostics/check.sh Resolved
Build host tools in GNU C mode so the pkg-config bootstrap can compile
its bundled GLib without patching rules_foreign_cc. Apply the option to
both integration configurations and unified module tests.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Pin OpenSOVD core to its upstream build-stamp interface and select the
integration's generated revision metadata through its public setting.
Apply the same setting in isolated module tests.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Pin CDA to the merge that exports its requirements documentation.
Drop the local patch reference and refresh the resolved Bazel lockfile.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Both pinned upstream revisions now provide the required interfaces,
and neither patch is referenced by the integration.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Pin classic-diagnostic-adapter to afb0621d
(eclipse-opensovd/classic-diagnostic-adapter#779), which carries the
systemd fix, the QNX platform settings and the QNX crate patches with
their crate_universe annotations upstream. It also raises the main
thread stack of the CDA binary on QNX (-N8192K): the default 512 KiB
is too small while the CDA loads its configuration.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Pin opensovd_core to 6c01ccb5 (eclipse-opensovd/opensovd-core#304),
which carries the QNX platform settings and the QNX crate patches with
their crate_universe annotations upstream, and update the gateway
build stamp commit to match.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Pin score_diagnostics to 3fc08e71 (eclipse-score/diagnostics#104). It
overrides the CDA and opensovd_core at the same commits that
reference_integration repeats in the root module, and packages the
OpenSOVD example client sovd-client with a list-apps command.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
The diagnostics showcase uses /run for the CDA Unix domain socket that
the gateway forwards to, and for the service lock. QNX images have no
/run, so link it to /tmp_ram like /data.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Store the CDA flash and storage state under /data/diagnostics, which is
writable on Linux and points into the RAM disk on QNX, instead of
/var/lib/opensovd-cda. Put /proc/boot first in PATH, where QNX images
install sh, mkdir and the networking tools.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Run the diagnostics stack on demand like the other showcases: check.sh
starts service.sh, which waits for an address and becomes the
showcase's own launch manager, and stops it at exit. No image starts it
at boot, so the lock and the join of a running service are gone. As
the showcase CLI runs one showcase at a time, the stack never runs
next to another showcase, so it no longer needs a launch manager name
of its own, and the platform integration test that ran it alongside
Platform Run is gone.

check.sh queries the gateway with the OpenSOVD example client
sovd-client, which the platform now ships in /usr/bin/diagnostics: it
passes only if the gateway lists sovd2uds next to score-diagnostics.
This replaces the hand-written HTTP over Bash's /dev/tcp. An
unexpected exit under set -e is reported with its status.

Both scripts are POSIX sh with the same code on Linux and QNX. The
check keeps its logs in /data/diagnostics, since /tmp is /dev/shmem on
QNX. Its cleanup function is not named stop, which QNX ksh predefines
as an alias. The address wait uses ip, ifconfig or hostname -I,
whichever the image has.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
QNX images provide ksh as /bin/sh and no Bash, so the showcase runs its
now POSIX check script with /bin/sh on both Linux and QNX.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Move the gateway and CDA binaries from platform_tar into
platform_bundle, which the QNX images consume as well. The CDA and
opensovd_core pins now support QNX, so the Linux-only exception is no
longer needed.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Add the Diagnostics Stack showcase and its ECU databases to
showcases_bundle, which the QNX images consume, so the showcase can run
in the QNX image.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Backport upstream rules_rust behaviour to the S-CORE 0.68.2-score fork:
crate_universe trusts the lockfile shipped by a non-root crate universe
and skips its digest check. Upstream made this change in
bazelbuild/rules_rust commit 2f690546 (bazelbuild/rules_rust#4109),
released in rules_rust 0.71.1.

This is a partial backport. Upstream also fails hard for non-root crate
universes without a lockfile; that part is deliberately left out, so
those universes keep repinning as before.

The lockfile digest covers the cargo-bazel, rustc and cargo versions
and the manifest labels, which differ between producer and consumer.
Dependencies such as mbedtls-rs that ship lockfiles for rules_rust
>= 0.71.1 consumers therefore fail the digest check on 0.68.x.

Drop the patch once S-CORE's rules_rust fork contains the change or
S-CORE moves to rules_rust >= 0.71.1.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Pin mbedtls-rs to e13c4f4d, which builds mbedtls with Bazel-native
cc_library targets instead of rules_foreign_cc cmake(). Under the QNX
toolchain the cmake() build ran qcc from a build directory in which
the cwd-relative QNX_HOST did not resolve, so the license check failed.

mbedtls-rs ships a crate-universe lockfile for rules_rust >= 0.71.1.
The rules_rust backport patch lets the 0.68.2-score fork use it.
The rules_foreign_cc 0.15.1 pin stays, score_crypto still needs it.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Add an S-CORE rules_rust patch, not an upstream backport: upstream
rules_rust up to 0.75 does not do this. cargo_build_script rewrites a
leading /proc/self/cwd in each ':'-separated element of the cc
toolchain env passed to build scripts to ${pwd}, which the build
script runner resolves to the absolute exec root.

Build scripts run with cwd = CARGO_MANIFEST_DIR. The S-CORE QNX
toolchain sets QNX_HOST and QNX_TARGET relative to /proc/self/cwd, so
qcc called by cc-rs in build scripts such as aws-lc-sys fails its
license check. Only the cc toolchain env from get_linker_and_args is
changed, not the user build_script_env.

The change is intended to be proposed to bazelbuild/rules_rust and
eclipse-score/rules_rust; drop the patch once it is available there.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
Run //platform_integration_tests/diagnostics on QNX x86_64 too, with the
same test implementation as on Linux: only the ITF target differs (QEMU
with the QNX image instead of Docker with the Linux image), as for the
other platform integration tests.

Run it exclusively: it boots its own target with the whole diagnostics
stack, and the extra load next to other PITs made the timing-sensitive
lifecycle PIT miss its supervision deadlines on QNX twice.

Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
@alexmohr
alexmohr force-pushed the feat/add-diagnostics branch from 94b0452 to 633dc48 Compare November 29, 2026 09:14

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants