Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#432] Implement CLI iox2-config #468

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

brosier01
Copy link

@brosier01 brosier01 commented Oct 14, 2024

Notes for Reviewer

  1. Create a new CLI for iceoryx2 : iox2-config
  2. iox2-config can show the configuration currently in use and generate a new configuration file at the default location iceoryx2 is looking for.
  3. Remove the print_system_configuration() function in iceoryx2-bb/posix/src/system_configuration.rs file and move it into the CLI iox2-config

Pre-Review Checklist for the PR Author

  1. Add sensible notes for the reviewer
  2. PR title is short, expressive and meaningful
  3. Relevant issues are linked in the References section
  4. Every source code file has a copyright header with SPDX-License-Identifier: Apache-2.0 OR MIT
  5. Branch follows the naming format (iox2-123-introduce-posix-ipc-example)
  6. Commits messages are according to this guideline
  7. Tests follow the best practice for testing
  8. Changelog updated in the unreleased section including API breaking changes
  9. Assign PR to reviewer
  10. All checks have passed (except task-list-completed)

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Unit tests have been written for new behavior
  • Public API is documented
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

Relates to #432

@brosier01 brosier01 closed this Oct 14, 2024
@brosier01 brosier01 deleted the iox2-432-CLI-displaying-full-system-configuration branch October 14, 2024 22:27
@brosier01 brosier01 restored the iox2-432-CLI-displaying-full-system-configuration branch October 14, 2024 22:28
@elfenpiff
Copy link
Contributor

@brosier01 don't close it - it looked good!

@brosier01 brosier01 reopened this Oct 14, 2024
Copy link
Contributor

@orecham orecham left a comment

Choose a reason for hiding this comment

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

In general looks pretty good, just one real blocker re: config location and also you'll need to address the static analysis CI findings.

Thanks for getting involved and welcome!

doc/release-notes/iceoryx2-unreleased.md Outdated Show resolved Hide resolved
doc/release-notes/iceoryx2-unreleased.md Outdated Show resolved Hide resolved
doc/release-notes/iceoryx2-unreleased.md Outdated Show resolved Hide resolved
iceoryx2-cli/iox2-config/src/commands.rs Show resolved Hide resolved
iceoryx2-cli/iox2-config/src/commands.rs Outdated Show resolved Hide resolved
@orecham orecham changed the title [eclipse-iceoryx#432] Implement CLI iox2-config [#432] Implement CLI iox2-config Oct 15, 2024
@brosier01 brosier01 force-pushed the iox2-432-CLI-displaying-full-system-configuration branch from ff8654f to 973c574 Compare October 15, 2024 22:28
Copy link
Contributor

@orecham orecham left a comment

Choose a reason for hiding this comment

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

I tested the CLI on the different platforms. A few more things to resolve before it can be merged.

iceoryx2-cli/iox2-config/src/commands.rs Outdated Show resolved Hide resolved
iceoryx2-cli/iox2-config/src/commands.rs Outdated Show resolved Hide resolved
iceoryx2-cli/iox2-config/src/commands.rs Show resolved Hide resolved
iceoryx2-cli/iox2-config/src/commands.rs Show resolved Hide resolved
iceoryx2-cli/iox2-config/src/commands.rs Show resolved Hide resolved
@brosier01 brosier01 requested a review from orecham October 23, 2024 17:26
Copy link
Contributor

@orecham orecham left a comment

Choose a reason for hiding this comment

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

The generated configs are now being used and there is a confirmation message for overwriting a pre-existing generated config - nice.

Some more things left to address, see unresolved threads.

iceoryx2/src/config.rs Outdated Show resolved Hide resolved
iceoryx2/src/config.rs Outdated Show resolved Hide resolved
iceoryx2/src/config.rs Outdated Show resolved Hide resolved
iceoryx2-cli/iox2-config/src/commands.rs Show resolved Hide resolved
iceoryx2-cli/iox2-config/src/commands.rs Show resolved Hide resolved
iceoryx2-cli/iox2-config/src/commands.rs Show resolved Hide resolved
iceoryx2/src/config.rs Outdated Show resolved Hide resolved
@brosier01 brosier01 requested a review from elBoberido November 19, 2024 20:40
@brosier01 brosier01 force-pushed the iox2-432-CLI-displaying-full-system-configuration branch from e7798a3 to 037781e Compare November 19, 2024 21:07
@brosier01
Copy link
Author

Hi @orecham @elfenpiff, is there any way to run CI locally?

@brosier01 brosier01 force-pushed the iox2-432-CLI-displaying-full-system-configuration branch from 037781e to 82f5387 Compare November 19, 2024 21:27
@elfenpiff
Copy link
Contributor

@brosier01 Yes there is. You can use the ./internal/scripts/iceoryx2_env.sh to enter the right docker container, depending on what target fails. The syntax is ./internal/scripts/iceoryx2_env.sh enter ubuntu:22.04 to start the ubuntu docker container for instance.

When you entered it you can run the usual cargo commands. Under .github/workflows/build-test.yml you find the test definitions. It is a bit hands on but we did not yet have time to add individual build & test scripts to ./internal/scripts/.

@brosier01 brosier01 force-pushed the iox2-432-CLI-displaying-full-system-configuration branch 2 times, most recently from 08a4135 to 41d20b8 Compare November 26, 2024 18:48
@brosier01
Copy link
Author

Hi @orecham, I think I've implemented all the elements described in the original problem. Do you see any other features I need to work on ?

@orecham
Copy link
Contributor

orecham commented Nov 27, 2024

Hi @orecham, I think I've implemented all the elements described in the original problem. Do you see any other features I need to work on ?

@brosier01 I will be able to review sometime today or tomorrow, apologies for the delay.

Copy link
Contributor

@orecham orecham left a comment

Choose a reason for hiding this comment

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

Sorry for taking so long to get back to you on this - had too much on my plate the last few weeks. I should be more responsive from now though.

PR is almost done! Can be merged after:

  1. Rebasing on main
  2. Addressing the remaining open conversations (I have resolved all not relevant for this PR)

iceoryx2/src/config.rs Outdated Show resolved Hide resolved
iceoryx2/src/config.rs Outdated Show resolved Hide resolved
iceoryx2-cal/src/config_path/mod.rs Outdated Show resolved Hide resolved
iceoryx2-cal/src/config_path/mod.rs Outdated Show resolved Hide resolved
iceoryx2-cli/iox2-config/src/commands.rs Show resolved Hide resolved
iceoryx2-cli/iox2-config/src/commands.rs Outdated Show resolved Hide resolved
doc/release-notes/iceoryx2-unreleased.md Outdated Show resolved Hide resolved
doc/release-notes/iceoryx2-unreleased.md Outdated Show resolved Hide resolved
doc/release-notes/iceoryx2-unreleased.md Outdated Show resolved Hide resolved
@orecham
Copy link
Contributor

orecham commented Dec 22, 2024

@brosier01 Back to you.

@orecham
Copy link
Contributor

orecham commented Dec 23, 2024

@brosier01

Some conflicts need resolving:

image

Also, these duplicate commits should be squashed into single commits.

image
image

@brosier01 brosier01 force-pushed the iox2-432-CLI-displaying-full-system-configuration branch 4 times, most recently from d28c6fb to 613a2e0 Compare December 24, 2024 23:21
Copy link

codecov bot commented Dec 24, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 9 lines in your changes missing coverage. Please review.

Project coverage is 79.49%. Comparing base (f4931fd) to head (836b7c4).

Files with missing lines Patch % Lines
iceoryx2/src/config.rs 50.00% 9 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #468      +/-   ##
==========================================
+ Coverage   79.25%   79.49%   +0.23%     
==========================================
  Files         203      205       +2     
  Lines       25230    25179      -51     
==========================================
+ Hits        19995    20015      +20     
+ Misses       5235     5164      -71     
Files with missing lines Coverage Δ
iceoryx2-bb/posix/src/system_configuration.rs 11.34% <ø> (+4.59%) ⬆️
iceoryx2-cal/src/config_path/dirs.rs 100.00% <100.00%> (ø)
iceoryx2-cal/src/config_path/mod.rs 100.00% <100.00%> (ø)
iceoryx2/src/config.rs 77.33% <50.00%> (-0.45%) ⬇️

... and 3 files with indirect coverage changes

@brosier01 brosier01 force-pushed the iox2-432-CLI-displaying-full-system-configuration branch from 613a2e0 to 836b7c4 Compare December 24, 2024 23:49
Copy link
Contributor

@elfenpiff elfenpiff left a comment

Choose a reason for hiding this comment

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

I need to review the last 3 files but I left some comments. The review of the next 3 files will follow soon.

NOTE: Add new entries sorted by issue number to minimize the possibility of
conflicts when merging.
-->
Create a new CLI for iceoryx2 `iox2-config`
Copy link
Contributor

Choose a reason for hiding this comment

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

Please summarize everything into one sentence and put everything in one bullet point as you did in line 15. If someone is interested in the details, they can follow the provided issue link.

-->

* Example text [#1](https://github.com/eclipse-iceoryx/iceoryx2/issues/1)
Remove the `print_system_configuration()` function in
Copy link
Contributor

Choose a reason for hiding this comment

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

Please put everything into one bullet point.


1. Example
iox2 config show system
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you put every command into an

```sh
```

environment and explain with one sentence what it does.

@@ -26,6 +26,7 @@ iceoryx2-bb-memory = { workspace = true }
iceoryx2-bb-lock-free = { workspace = true }
iceoryx2-pal-concurrency-sync = { workspace = true }

dirs = { workspace = true }
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this and the config_path component from iceoryx2_cal. This is not a iceoryx2 concept. The mistake is on our side since we did not yet had the time to document the iceoryx2 concept pattern in detail, what it is, what problem it solves and how it shall be implemented.

A concept is an abstract mechanism:

  1. That has multiple implementations.
  2. Can be constructed and used via the traits of the concepts
  3. Comes with a generic test suite to verify the same behavior of all concept implementations.

One example is the communication channel.

  • it has a receiver and a sender
  • it comes with a builder trait
  • the sender sends data, the receiver receives data
  • it can be implemented by a UNIX domain socket, message queue, named pipe or a shared memory queue
  • it comes with a test suite that verifies that the sent data can be retrieved with the corresponding receiver.

I agree that you require a way of acquiring the config directory and your approach seems valid but this should be part of the iceoryx2/src/config.rs

@@ -0,0 +1,29 @@
// Copyright (c) 2024 Contributors to the Eclipse Foundation
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this

@@ -0,0 +1,22 @@
// Copyright (c) 2024 Contributors to the Eclipse Foundation
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this

@brosier01 brosier01 force-pushed the iox2-432-CLI-displaying-full-system-configuration branch from 836b7c4 to 92982fb Compare December 26, 2024 07:13
… subcommand to display the contents of the configuration file + added configuration file standard location
@brosier01 brosier01 force-pushed the iox2-432-CLI-displaying-full-system-configuration branch from 92982fb to c66b7d9 Compare December 26, 2024 07:31
@brosier01 brosier01 requested a review from elfenpiff December 31, 2024 14:20
Err(ConfigCreationError::FailedToReadConfigFileContents) => {
warn!(from "Config::global_config()", "Default config file found but unable to read content, populate config with default values.");
ICEORYX2_CONFIG.set_value(Config::default());
match config_dir() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I took a deep dive into the dirs crate and the config_dir function and I realized that it depends on dirs-rs which requires a $HOME env variable that is available on linux and some unix systems - not Windows. But we must have a solution that is extendable to other platforms and works out of the box on Linux, Windows, Mac OS and FreeBSD.

So the best solution would be to add this functionality to the iceoryx2_pal layer. I will take care of this in the next days and make it available to you.
We have to be careful with introducing new dependencies to iceoryx2. They must work on all our target platforms and we also need to have a strategy on how to handle software certification later.

But please do not let this discourage you! You did a great job with the CLI so far and the crate-dependency thing was also nowhere documented (so its on me). I'll try to add this to the platform and then we can merge this hopefully latest next week.

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