Skip to content

gh-819: Simplify devcontainer setup#820

Merged
pnoltes merged 14 commits intomasterfrom
feature/819-simplify-devcontainer-setup
Feb 24, 2026
Merged

gh-819: Simplify devcontainer setup#820
pnoltes merged 14 commits intomasterfrom
feature/819-simplify-devcontainer-setup

Conversation

@pnoltes
Copy link
Contributor

@pnoltes pnoltes commented Feb 6, 2026

This PR simplifies the devcontainer setup.

@rlenferink: Could you test if this setup also works for you?

This PR closes #819

Remove the build script and conan profiles.
Change the setup to support Conan
@pnoltes pnoltes requested a review from PengZheng February 6, 2026 17:27
@codecov-commenter
Copy link

codecov-commenter commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.50%. Comparing base (effe33a) to head (a8196ee).
⚠️ Report is 12 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #820   +/-   ##
=======================================
  Coverage   91.50%   91.50%           
=======================================
  Files         235      235           
  Lines       28686    28686           
=======================================
+ Hits        26248    26249    +1     
+ Misses       2438     2437    -1     

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rlenferink
Copy link
Member

rlenferink commented Feb 7, 2026

Good idea to simplify this! The current setup on the master branch is not as easy as it should be for new (or existing) contributors.

I tested this on Fedora 43 with rootless podman and CLion 2025.3.

The first attempt on running this branch the container build fails with the following failure:

Unpacking gh (2.86.0) ...
Setting up gh (2.86.0) ...
/tmp/jb-devcontainer-features/ghcr.io-devcontainers-features-github-cli-1
COMMIT jb-devcontainer-apache_celix_dev_container
--> 9b5711e397e2
Successfully tagged localhost/jb-devcontainer-apache_celix_dev_container:latest
9b5711e397e252880285297a87cf831cb4cdf8a43c888bd8f1edc846315ae3ee
Creating container…
Container Id: 82f761ec4ae509cbd02c45d1a0acac202e271389a6e64c921c02d10c5d70ba09
Container name: '/youthful_gould'
Starting container '/youthful_gould'
Status 500: Status 500: {"cause":"no matching entries in passwd file","message":"unable to find user celixdev: no matching entries in passwd file","response":500}

It seems that the user celixdev cannot be found. After a quick check this seems to be correct, since the celixdev user is created in the conan-build stage and not in the conan-dev stage.

This might be an accidental error, so I tried changes the conan-dev stage to inherit from the conan-build stage instead by applying the following patch:

diff --git a/.devcontainer/Containerfile b/.devcontainer/Containerfile
index 21b3f8bfb..c4dc6c953 100644
--- a/.devcontainer/Containerfile
+++ b/.devcontainer/Containerfile
@@ -59,10 +59,12 @@ RUN pipx install conan && \
     sed -i 's/^build_type=.*/build_type=Release/' /home/${USERNAME}/.conan2/profiles/release && \
     sed -i 's/^build_type=.*/build_type=Debug/' /home/${USERNAME}/.conan2/profiles/debug
 
-FROM base as conan-dev
+FROM conan-build as conan-dev
 
+USER root
 RUN DEBIAN_FRONTEND="noninteractive" apt-get update && \
     DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
     gnupg2 dos2unix locales-all ssh rsync tar tzdata sudo vim cmake-curses-gui gdb \
     wget curl && \
-    apt-get clean \
+    apt-get clean
+USER ${USERNAME}

With that change CLion succesfully opens the celix project using the devcontainer approach.

After selecting the conan-debug profile, the project its auto-completion works and can successfully build, with a few warnings given:

====================[ Build | all | conan-debug ]===============================
/.jbdevcontainer/JetBrains/RemoteDev/dist/05b70c3c26068_CLion-2025.3.2/bin/cmake/linux/x64/bin/cmake --build /IdeaProjects/celix-container/build --target all -j 18
[421/1164] Linking CXX executable libs/utils/gtest/test_utilsd
/usr/bin/ld: warning: libs/utils/gtest/CMakeFiles/test_utils.dir/__/__/__/embed_zip_linux.s.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
[811/1164] Linking C shared library examples/celix-examples/services_example_c/libdynamic_consumer_exampled.so.1.0.0
/usr/bin/ld: warning: examples/celix-examples/services_example_c/CMakeFiles/dynamic_consumer_example.dir/src/dynamic_consumer_example.c.o: requires executable stack (because the .note.GNU-stack section is executable)
[1164/1164] Linking CXX executable deploy/ReadmeCxxExamplesContainer/ReadmeCxxExamplesContainerd

Build finished

Are these warnings expected?

Running All CTest results in the following:

The following tests FAILED:
	 12 - test_framework (Failed)
	 13 - test_framework_with_ei (Failed)
	 14 - test_framework_with_curl_ei (Failed)
	 15 - http_websocket_tests (Failed)
	 16 - test_log_helper (Failed)
	 17 - test_log_admin (Failed)
	 18 - test_syslog_writer (Failed)
	 19 - test_shell (Failed)
	 20 - test_cxx_shell (Failed)
	 21 - test_shell_tui (Failed)
	 22 - run_unit_test_rsa_common (Failed)
	 23 - test_rsa_utils (Failed)
	 24 - test_rsa_utils_ei (Failed)
	 25 - run_test_rsa_dfi_utils (Failed)
	 26 - run_integration_test_discovery_zeroconf (Failed)
	 27 - run_unit_test_discovery_zeroconf (Failed)
	 28 - run_test_tm_scoped (Failed)
	 29 - run_unit_test_tm (Failed)
	 30 - run_unit_test_tm_with_error_injection (Failed)
	 31 - run_test_rsa_dfi (Failed)
	 32 - run_integration_test_rsa_json_rpc (Failed)
	 33 - run_unit_test_rsa_json_rpc (Failed)
	 35 - run_integration_test_rsa_shm (Failed)
	 36 - run_unit_test_rsa_shm (Failed)
	 37 - test_cxx_remote_service_admin (Failed)
	 38 - test_cxx_rsa_configured_discovery (Failed)
Errors while running CTest
	 39 - test_cxx_remote_services_integration (Failed)
	 40 - test_components_ready (Failed)
	 41 - test_components_ready_with_ei (Failed)
Output from these tests are in: /IdeaProjects/celix-container/build/Testing/Temporary/LastTest.log
	 42 - run_integration_test_event_admin (Failed)
	 43 - run_unit_test_event_admin (Failed)
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
	 44 - run_unit_test_event_admin_with_error_injection (Failed)
	 45 - run_integration_test_event_admin_remote_provider_mqtt (Failed)
	 46 - run_unit_test_event_admin_remote_provider_mqtt (Failed)
	 47 - run_unit_test_event_admin_remote_provider_mqtt_with_error_injection (Failed)
Process finished with exit code 8

Quickly scanning through the test output, it seems that every failing test fails with the following output:

12: Test command: /IdeaProjects/celix-container/build/libs/framework/gtest/test_frameworkd
12: Working Directory: /IdeaProjects/celix-container/build/libs/framework/gtest
12: Test timeout computed to be: 10000000
12: /IdeaProjects/celix-container/build/libs/framework/gtest/test_frameworkd: /lib/x86_64-linux-gnu/libcrypto.so.3: version `OPENSSL_3.4.0' not found (required by /home/celixdev/.conan2/p/b/libcu09ad2ef619b4f/p/lib/libcurl.so.4)
12: /IdeaProjects/celix-container/build/libs/framework/gtest/test_frameworkd: /lib/x86_64-linux-gnu/libssl.so.3: version `OPENSSL_3.2.0' not found (required by /home/celixdev/.conan2/p/b/libcu09ad2ef619b4f/p/lib/libcurl.so.4)
Failed

(the same is true when running the ctest --output-on-failure --test-dir build command in a terminal within CLion)

More info:

celixdev@ac8cda07f34b:/IdeaProjects/celix-container$ ldd build/bundles/event_admin/remote_provider/remote_provider_mqtt/gtest/unit_test_event_admin_remote_provider_mqtt_with_error_injectiond
build/bundles/event_admin/remote_provider/remote_provider_mqtt/gtest/unit_test_event_admin_remote_provider_mqtt_with_error_injectiond: /lib/x86_64-linux-gnu/libcrypto.so.3: version `OPENSSL_3.4.0' not found (required by /home/celixdev/.conan2/p/b/libcu09ad2ef619b4f/p/lib/libcurl.so.4)
build/bundles/event_admin/remote_provider/remote_provider_mqtt/gtest/unit_test_event_admin_remote_provider_mqtt_with_error_injectiond: /lib/x86_64-linux-gnu/libssl.so.3: version `OPENSSL_3.2.0' not found (required by /home/celixdev/.conan2/p/b/libcu09ad2ef619b4f/p/lib/libcurl.so.4)
        linux-vdso.so.1 (0x00007f8756a90000)
        libasan.so.8 => /lib/x86_64-linux-gnu/libasan.so.8 (0x00007f875592f000)
        libmosquitto.so.1 => /home/celixdev/.conan2/p/b/mosqubd83ff621e16a/p/lib/libmosquitto.so.1 (0x00007f8756a64000)
        libjansson.so.4 => /home/celixdev/.conan2/p/b/janss374a24077760d/p/lib/libjansson.so.4 (0x00007f8756a4e000)
        libuuid.so.1 => /home/celixdev/.conan2/p/b/util-c892553d99b97/p/lib/libuuid.so.1 (0x00007f8756a40000)
        libcelix_frameworkd.so.3 => /IdeaProjects/celix-container/build/libs/framework/libcelix_frameworkd.so.3 (0x00007f87557dd000)
        libcelix_utilsd.so.3 => /IdeaProjects/celix-container/build/libs/utils/libcelix_utilsd.so.3 (0x00007f8755715000)
        libuv.so.1 => /home/celixdev/.conan2/p/b/libuvf16e0e2de2b3a/p/lib/libuv.so.1 (0x00007f87569f9000)
        libgtest_maind.so => /home/celixdev/.conan2/p/b/gtest69153696c0e82/p/lib/libgtest_maind.so (0x00007f87569f4000)
        libgtestd.so => /home/celixdev/.conan2/p/b/gtest69153696c0e82/p/lib/libgtestd.so (0x00007f875561c000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f875539e000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f87552b5000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f87569c4000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f87550a3000)
        libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007f8754ff9000)
        libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007f8754ae5000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f8756a92000)
        libcurl.so.4 => /home/celixdev/.conan2/p/b/libcu09ad2ef619b4f/p/lib/libcurl.so.4 (0x00007f875492c000)
        libzip.so.5 => /home/celixdev/.conan2/p/b/libzi76a9c0f1ba7ae/p/lib/libzip.so.5 (0x00007f8754600000)

@pnoltes
Copy link
Contributor Author

pnoltes commented Feb 8, 2026

@rlenferink Thanks for the feedback. I forgot te retest the devcontainer IDE setup after updating the conan-build stage to also use the celixdev user. I try to recheck the IDE usage next week.

@pnoltes
Copy link
Contributor Author

pnoltes commented Feb 15, 2026

/usr/bin/ld: warning: libs/utils/gtest/CMakeFiles/test_utils.dir///__/embed_zip_linux.s.o: missing .note.GNU-stack section implies executable stack

This is unrelated for this PR.

@pnoltes pnoltes marked this pull request as draft February 15, 2026 21:29
@pnoltes
Copy link
Contributor Author

pnoltes commented Feb 15, 2026

Improve the Containerfile and updated some setup to better support ctest with conan.
But there are still issues when running test from the CLion IDE directly.

@pnoltes
Copy link
Contributor Author

pnoltes commented Feb 22, 2026

@rlenferink Could you recheck? Things should be better, but please aware that the conan <-> CLion integration is not yet ideal; At least in my experience.

I still having trouble running gtest directly from the file editor, it is possible but by always selecting configure and add the build/Debug/generators/conanrun.sh as environment list.

@pnoltes
Copy link
Contributor Author

pnoltes commented Feb 22, 2026

I also change a bit of the conanfile.py setup.

@pnoltes pnoltes requested a review from rlenferink February 22, 2026 19:27
@pnoltes pnoltes marked this pull request as ready for review February 23, 2026 11:54
@rlenferink
Copy link
Member

I have just re-ran these steps with a clean repo and clean container cache, and I can safely say that the projects opens, builds, a full re-build works as well and following the steps in the README, the All CTest works as well:

100% tests passed, 0 tests failed out of 47

Total Test time (real) = 228.63 sec

Following the steps to run an individual test work as well. I couldn't get it to work that the configuration is applied to multiple tests, but IMO that is a real nice-to-have.

With that I think this is ready to be merged.

@PengZheng
Copy link
Contributor

PengZheng commented Feb 24, 2026

Things should be better, but please aware that the conan <-> CLion integration is not yet ideal; At least in my experience.

Yeah. That has to do with how ctest-debug is implemented in CLion:

If you start a debug session for a CTest test, CLion will run the test itself under debug instead of launching the ctest child process.

```sh
./build/bundles/components_ready_check/tests/components_ready_check_test
```bash
ctest --preset conan-debug --output-on-failure --test-dir build/Debug/bundles/shell
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't have preset for a plain cmake build.

## Running Tests
```bash
# Run tests whose names match "MyTestName"
ctest --preset conan-debug --test-dir build/Debug -R shell --output-on-failure -j1
Copy link
Contributor

Choose a reason for hiding this comment

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

Is --test-dir build/Debug unnecessary?

Example (configure & build only):
```bash
cmake -DENABLE_TESTING=ON -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_UNDEFINED_SANITIZER=ON -DCMAKE_BUILD_TYPE=Debug -G Ninja -S . -B build
cmake --build . --parallel
Copy link
Contributor

@PengZheng PengZheng Feb 24, 2026

Choose a reason for hiding this comment

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

Should it be build rather than .?
Normally we use separate binary directory.

It also applies to the following ctest command.

Build can be done from the root workspace dir:

```shell
cmake --build build/Debug --parallel
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use --preset instead.

Copy link
Contributor

@PengZheng PengZheng left a comment

Choose a reason for hiding this comment

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

LGTM. Only some minor remarks are left.

@pnoltes pnoltes merged commit 5030f27 into master Feb 24, 2026
22 checks passed
@pnoltes pnoltes deleted the feature/819-simplify-devcontainer-setup branch February 24, 2026 21:37
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.

Simplify the devcontainer setup

4 participants