Skip to content

feat: sm-plugin for flows #4037

Merged
rina23q merged 3 commits intothin-edge:mainfrom
rina23q:feat/3986/flow-sm-plugin
Mar 20, 2026
Merged

feat: sm-plugin for flows #4037
rina23q merged 3 commits intothin-edge:mainfrom
rina23q:feat/3986/flow-sm-plugin

Conversation

@rina23q
Copy link
Copy Markdown
Member

@rina23q rina23q commented Mar 11, 2026

Proposed changes

This pull request introduces the new tedge-flows-plugin package and a binary symlinked to /etc/tedge/sm-plugin/flow.

The plugin supports only 3 commands:

  1. list
  2. install
  3. remove

Note: update-list is unsupported, therefore, it returns 1 as in the sm-plugin specification.

Naming rules

Look at #4037 (comment).

Installation rules

  • No hard check for the given --module-version <version>. If given, it will be used to check the provided version equals to the one installed.
  • Installing a flow onto the top level is unsupported whilst nested layers are possible; simply, because it's impossible to distinguish if user wants it at the top level or second level, from the naming rule local/toplevel and local/second.
  • Attempts to unpack if a provided file path doesn't have .tar or .tar.gz. At first, I didn't implement this fallback, however, I found that the file extension is missing while downloading a file... If there was no fallback, integration with c8y won't work :/

Removal rules

  • ignores --module-version <version>.
  • params.toml will be kept only if flows.params.keep_on_delete is true (default: false).

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue

#3986

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s. You can activate automatic signing by running just prepare-dev once)
  • I ran just format as mentioned in CODING_GUIDELINES
  • I used just check as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 80.21828% with 145 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
plugins/tedge_flows_plugin/src/lib.rs 45.37% 63 Missing and 2 partials ⚠️
plugins/tedge_flows_plugin/src/install.rs 80.50% 38 Missing and 8 partials ⚠️
plugins/tedge_flows_plugin/src/list.rs 93.90% 14 Missing and 1 partial ⚠️
plugins/tedge_flows_plugin/src/remove.rs 93.33% 2 Missing and 6 partials ⚠️
plugins/tedge_flows_plugin/src/error.rs 0.00% 6 Missing ⚠️
crates/core/tedge/src/main.rs 16.66% 0 Missing and 5 partials ⚠️

📢 Thoughts on this report? Let us know!

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

Comment thread tests/RobotFramework/tests/plugin_flows/test_plugin.robot Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 12, 2026

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
879 0 3 879 100 2h50m37.039040999s

Comment thread tests/RobotFramework/tests/plugin_flows/test_plugin.robot Outdated
@rina23q rina23q force-pushed the feat/3986/flow-sm-plugin branch from 49b4598 to 6f72139 Compare March 13, 2026 14:53
@rina23q rina23q had a problem deploying to Test Pull Request March 13, 2026 14:53 — with GitHub Actions Failure
@rina23q rina23q temporarily deployed to Test Pull Request March 13, 2026 16:00 — with GitHub Actions Inactive
@rina23q
Copy link
Copy Markdown
Member Author

rina23q commented Mar 19, 2026

The system test Install fails with an invalid flow requires a change on the exit code of tedge flows list.
=> Solved by #4060. Now rebased to apply the upstream change.

@didier-wenzek didier-wenzek mentioned this pull request Mar 20, 2026
13 tasks
@rina23q rina23q force-pushed the feat/3986/flow-sm-plugin branch from fb7b092 to 06f9499 Compare March 20, 2026 09:25
@rina23q rina23q temporarily deployed to Test Pull Request March 20, 2026 09:25 — with GitHub Actions Inactive
didier-wenzek added a commit to didier-wenzek/thin-edge.io that referenced this pull request Mar 20, 2026
see crates/extensions/tedge_flowshttps://github.com/thin-edge/pull/4037#issuecomment-4074367221

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Copy link
Copy Markdown
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

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

Approved. A great addition that will support users writing, sharing and deploying domain specific flows. Thank you.

Copy link
Copy Markdown
Member

@Bravo555 Bravo555 left a comment

Choose a reason for hiding this comment

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

All the feedback addressed, with a very comprehensive set of tests.

Comment on lines +82 to +85
let output = match std::process::Command::new("tedge")
.args(["flows", "list", "--flows-dir"])
.arg(tmp_dest.as_str())
.output()
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.

thought: A bit annoying that we have to spawn a process instead of directly using the same function that tedge flows list does, but there shouldn't be a problem either way.

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.

Calling the binary is ok, though we need to make sure we pass the loaded config_dir (that the agent is using), and pass it to the tedge flows list command, e.g.

tedge flows list --flows-dir "foo" --config-dir /tmp/tedge

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Commited here: 8be1996

Copy link
Copy Markdown
Contributor

@reubenmiller reubenmiller left a comment

Choose a reason for hiding this comment

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

Approved. Really nice addition. Thanks for updating the log messages to be more verbose as this will be extremely helpful when reading the operation logs for installing and removing flows from the cloud

rina23q added 3 commits March 20, 2026 15:36
Signed-off-by: Rina Fujino <rina.fujino.23@gmail.com>
Signed-off-by: Rina Fujino <rina.fujino.23@gmail.com>
Signed-off-by: Rina Fujino <rina.fujino.23@gmail.com>
@rina23q rina23q force-pushed the feat/3986/flow-sm-plugin branch from 8be1996 to eafe2b7 Compare March 20, 2026 15:36
@rina23q rina23q temporarily deployed to Test Pull Request March 20, 2026 15:36 — with GitHub Actions Inactive
@rina23q rina23q enabled auto-merge March 20, 2026 16:11
@rina23q rina23q added this pull request to the merge queue Mar 20, 2026
Merged via the queue into thin-edge:main with commit 403b3f1 Mar 20, 2026
34 checks passed
@rina23q rina23q deleted the feat/3986/flow-sm-plugin branch March 21, 2026 13:40
didier-wenzek added a commit to didier-wenzek/thin-edge.io that referenced this pull request Mar 24, 2026
see crates/extensions/tedge_flowshttps://github.com/thin-edge/pull/4037#issuecomment-4074367221

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants