Skip to content

Add ubuntu insights to the build system - #5541

Open
theartful wants to merge 31 commits into
mainfrom
essam/ubuntu-insights-port
Open

theartful wants to merge 31 commits into
mainfrom
essam/ubuntu-insights-port

Conversation

@theartful

@theartful theartful commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Description

Prepare Multipass for Ubuntu Insights integration.

  • Add a vcpkg port for Ubuntu Insights.
  • Add a mockable C++ wrapper around the Insights C API and some simple smoke tests.
  • Update snap recipe.
  • Provision Go 1.26 in CI.

Checklist

  • My code follows the contributing guidelines
  • I have signed the Canonical CLA
  • I am aware that fixes should be merged into the next stable-release branch (release/XX.XX) before being merged into main.
  • I have added unit tests or no new ones were appropriate
  • I have added integration tests or no new ones were appropriate
  • I have updated documentation or no changes were appropriate
  • I have tested the changes locally or no specific testing was appropriate

@theartful
theartful requested review from Laefy and jimporter November 11, 2026 02:56
@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 36.36364% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.53%. Comparing base (6b67ec5) to head (6dc6b74).

Files with missing lines Patch % Lines
src/ubuntu_insights/libinsights_wrapper.cpp 36.37% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5541      +/-   ##
==========================================
- Coverage   79.57%   79.53%   -0.04%     
==========================================
  Files         359      360       +1     
  Lines       19626    19647      +21     
==========================================
+ Hits        15616    15624       +8     
- Misses       4010     4023      +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@theartful
theartful force-pushed the essam/ubuntu-insights-port branch 2 times, most recently from 0ec4fd5 to a22d113 Compare November 11, 2026 04:37
@theartful theartful changed the title Add Ubuntu Insights dependency and C++ wrapper Add ubuntu insights to the build system Nov 11, 2026
@theartful
theartful force-pushed the essam/ubuntu-insights-port branch 2 times, most recently from 0d82ac3 to 52cd104 Compare November 11, 2026 10:34
@theartful
theartful marked this pull request as ready for review November 11, 2026 14:33
Copilot AI lite review requested due to automatic review settings November 11, 2026 14:33

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

Critical unresolved build and test-runtime issues remain across arm64, Linux CGo dependency handling, nested Go discovery, and Windows DLL availability.

5 open issues
What changed in this PR

Adds Ubuntu Insights build integration to Multipass by packaging the dependency with vcpkg, introducing a mockable C++ wrapper and smoke tests, and provisioning Go 1.26 across supported build environments.

Changes:

  • Adds the Ubuntu Insights vcpkg port, generated C API integration, and wrapper library.
  • Configures Insights tests, Go toolchain discovery, Snap recipes, and CI workflows.
  • Refactors shared MinGW package-lock tooling for related vcpkg ports.
File Description
vcpkg.json Adds the Ubuntu Insights feature dependency.
tests/​unit/​test_libinsights.cpp Adds consent-state smoke tests for the Insights wrapper.
tests/​unit/​CMakeLists.txt Builds and links Insights tests when enabled.
src/​ubuntu_insights/​libinsights_wrapper.cpp Implements forwarding methods for the Insights C API.
src/​ubuntu_insights/​CMakeLists.txt Defines the Insights wrapper library and dependency linkage.
src/​CMakeLists.txt Includes the Ubuntu Insights source directory.
snap/​snapcraft.yaml Updates plugs, Go tooling, build dependencies, and Wayland packaging.
packaging/​gui-less/​snap/​snapcraft.yaml Applies equivalent Insights and Go updates to GUI-less packaging.
include/​ubuntu_insights/​libinsights_wrapper.h Declares the mockable Insights wrapper interface.
CMakeLists.txt Adds the Insights option and Go environment setup.
3rd-party/​vcpkg-triplets/​x64-windows-static-md.cmake Passes the Go executable directory through vcpkg.
3rd-party/​vcpkg-triplets/​x64-linux.cmake Passes the Go executable directory through vcpkg.
3rd-party/​vcpkg-triplets/​s390x-linux-release.cmake Passes the Go executable directory through vcpkg.
3rd-party/​vcpkg-triplets/​ppc64le-linux-release.cmake Passes the Go executable directory through vcpkg.
3rd-party/​vcpkg-triplets/​osx.cmake.in Passes the Go executable directory through macOS vcpkg triplets.
3rd-party/​vcpkg-ports/​ubuntu-insights/​vcpkg.json Defines the Ubuntu Insights port metadata and Wayland dependency.
3rd-party/​vcpkg-ports/​ubuntu-insights/​usage Documents the generated CMake package targets.
3rd-party/​vcpkg-ports/​ubuntu-insights/​ubuntu-insights-config.cmake.in Defines imported library and executable targets.
3rd-party/​vcpkg-ports/​ubuntu-insights/​portfile.cmake Downloads, builds, and packages Ubuntu Insights.
3rd-party/​vcpkg-ports/​ubuntu-insights/​insights.def Lists Windows DLL exports for the Insights API.
3rd-party/​vcpkg-ports/​ubuntu-insights/​0001-c-api-free.patch Adds allocator-compatible memory-release support to the C API.
3rd-party/​vcpkg-ports/​qemu/​portfile.cmake Reuses the shared MinGW package-lock helper.
3rd-party/​vcpkg-port-utils/​mingw/​mingw64-toolchain.lock Pins the shared MinGW dependency closure.
3rd-party/​vcpkg-port-utils/​mingw/​get-mingw-packages.cmake Parses and exposes pinned MinGW package metadata.
3rd-party/​vcpkg-port-utils/​mingw/​generate-mingw-lockfile.py Generates the pinned MinGW package lockfile.
.github/​workflows/​windows.yml Provisions Go 1.26 for Windows builds.
.github/​workflows/​tics.yml Provisions Go 1.26 for TICS builds.
.github/​workflows/​macos.yml Provisions Go 1.26 for macOS builds.

Review effort: Lite

Comment thread CMakeLists.txt Resolved
Comment thread tests/unit/CMakeLists.txt Resolved
@theartful
theartful requested review from Laefy and jimporter and a lite review from Copilot November 11, 2026 20:19
@theartful
theartful marked this pull request as draft November 11, 2026 20:39
@theartful
theartful marked this pull request as ready for review November 11, 2026 20:39

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Two critical portfile issues block the feature on supported setups: the linkage check rejects the project’s static triplets, and the unsupported cmake -E env --modify option fails on the supported CMake 3.29 baseline.

2 open issues

Review effort: Lite

Copilot AI lite review requested due to automatic review settings November 12, 2026 10:13

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.

🔵 Needs a closer look

Both Snapcraft configurations request the unavailable golang-1.26-go package from Ubuntu 24.04’s core24 archive, causing dependency installation to fail before either build starts.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

High severity Use a Go 1.26 toolchain available to core24

packaging/​gui-less/​snap/​snapcraft.yaml:156

core24 is based on Ubuntu 24.04 (noble), whose archive does not publish golang-1.26-go; Snapcraft resolves build-packages from that base's apt sources, so this part fails during dependency installation before the build starts. Use a Go 1.26 build snap/toolchain (or a base/archive that provides this package) instead, and keep the toolchain setup consistent with the GitHub Actions jobs.

High severity Use a Go 1.26 toolchain available to core24

snap/​snapcraft.yaml:177

core24 is based on Ubuntu 24.04 (noble), whose archive does not publish golang-1.26-go; Snapcraft resolves build-packages from that base's apt sources, so this part fails during dependency installation before the build starts. Use a Go 1.26 build snap/toolchain (or a base/archive that provides this package) instead, and keep the toolchain setup consistent with the GitHub Actions jobs.

2 resolved since last review

Review effort: Lite

Copilot AI lite review requested due to automatic review settings November 12, 2026 20:35
@theartful
theartful force-pushed the essam/ubuntu-insights-port branch from fa7ab30 to 92d1d45 Compare November 12, 2026 20:39

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.

🔵 Needs a closer look

Human assessment is needed because the change includes a subtle clarity issue in the CMake option description that may affect maintainability.

No open issues 🎉

Review effort: Lite

theartful and others added 21 commits November 20, 2026 14:59
We require wayland as a system dependency on Linux
Maybe this can change in the future if there is a good reason
This makes it so that we don't have to edit every triplet, as we did
before with VCPKG_ENV_PASSTHROUGH
Enables vcpkg's applocal to automatically deploy the dll beside any
executable that uses it
Mimic what ubuntu-insights/snap/snapcraft.yaml does
Co-authored-by: Mustafa Kemal Gılor <mustafa.gilor@canonical.com>
Signed-off-by: Ahmed Essam <aessam.dahy@gmail.com>
Co-authored-by: Mustafa Kemal Gılor <mustafa.gilor@canonical.com>
Signed-off-by: Ahmed Essam <aessam.dahy@gmail.com>
Co-authored-by: Mustafa Kemal Gılor <mustafa.gilor@canonical.com>
Signed-off-by: Ahmed Essam <aessam.dahy@gmail.com>

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.

🔵 Needs a closer look

Human assessment is needed because the change introduces concurrency-sensitive shared state, an undeclared Python dependency, missing Windows runtime DLL packaging, and an installer component omission.

No open issues 🎉

Review effort: Lite

xmkg
xmkg previously approved these changes Nov 20, 2026

@xmkg xmkg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Alright, this looks good to me as a secondary reviewer (code review only, no compile/test etc.). Thanks, Essam!

@theartful
theartful force-pushed the essam/ubuntu-insights-port branch from f15eb9f to 6dc6b74 Compare November 20, 2026 14:18
Copilot AI lite review requested due to automatic review settings November 20, 2026 14:18

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 critical Windows packaging issue can leave the DLL unloadable due to missing MinGW runtime dependencies, and the success-path tests also invoke undefined behavior by streaming a null error pointer.

2 open issues

Review effort: Lite

{
char* error = MP_LIBINSIGHTS.insights_set_consent_state(&config, "multipass", consent);

EXPECT_EQ(error, nullptr) << error;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

By construction if we're going to print the error, it has to be not null. I don't see an issue with passing a nullptr that is guaranteed not to be printed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

By construction if we're going to print the error, it has to be not null. I don't see an issue with passing a nullptr that is guaranteed not to be printed.

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.

4 participants