Skip to content

Augment Local Env With Coordinator-side Remote Env#1889

Draft
Bastian-Krause wants to merge 6 commits into
labgrid-project:masterfrom
Bastian-Krause:bst/coordinator-remote-env
Draft

Augment Local Env With Coordinator-side Remote Env#1889
Bastian-Krause wants to merge 6 commits into
labgrid-project:masterfrom
Bastian-Krause:bst/coordinator-remote-env

Conversation

@Bastian-Krause
Copy link
Copy Markdown
Member

@Bastian-Krause Bastian-Krause commented Jun 5, 2026

Description
In larger labs, maintaining and distributing environment configs for all the different places can become cumbersome. Defining resources, drivers, feature and options per place in the coordinator could help solve that problem.

This prototype adds a remote_env attribute to the Place class, a SetPlaceRemoteEnv method to the Coordinator class and a new sub command labgrid-client edit to edit the remote environment. The remote environment is printed in labgrid-client show and labgrid-client env. The RemotePlaceManager creates resources and drivers after expanding resource matches. If a local environment exists, it is augmented with the remote environment.

This is a prototype. Open tasks:

  • Decide how to store configs on the coordinator (DB, git, yaml?)
  • Allow defining features and options on target level
  • Ignore RemotePlace resource in remote env
  • Ignore/override drivers from the coordinator in the local env via RemotePlace.ignore_drivers/RemotePlace.ignore_resources
  • Add tests
  • Add documentation

Follow-up tasks could be

  • Allow editing tags via labgrid-client edit
  • Allow editing matches via labgrid-client edit
  • Maybe allow imports in remote env

Minimal test with labgrid-client

$ export LG_PLACE=test
$ labgrid-client create
$ labgrid-client edit

Save this in your editor:

resources:          
- NetworkService:
    address: mydut.lab.example.com
    username: user
drivers:
- SSHDriver: {}
$ labgrid-client lock
$ labgrid-client ssh

Minimal test with pytest (using the place created above in "Minimal test with labgrid-client")
env.yaml:

targets:                          
  main:
    resources:
      RemotePlace:
        name: "test"
$ pytest --lg-env env.yaml

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • Add a section on how to use the feature to doc/usage.rst
  • Add a section on how to use the feature to doc/development.rst
  • PR has been tested
  • Man pages have been regenerated

Related to #1866

…ed methods

Signed-off-by: Bastian Krause <bst@pengutronix.de>
Signed-off-by: Bastian Krause <bst@pengutronix.de>
Signed-off-by: Bastian Krause <bst@pengutronix.de>
Signed-off-by: Bastian Krause <bst@pengutronix.de>
…nfig()

Signed-off-by: Bastian Krause <bst@pengutronix.de>
Signed-off-by: Bastian Krause <bst@pengutronix.de>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 78 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.8%. Comparing base (915b591) to head (2c4f2dc).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
labgrid/remote/client.py 6.8% 54 Missing ⚠️
labgrid/remote/coordinator.py 0.0% 16 Missing ⚠️
labgrid/remote/common.py 58.3% 5 Missing ⚠️
labgrid/factory.py 80.0% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1889     +/-   ##
========================================
- Coverage    46.0%   45.8%   -0.2%     
========================================
  Files         180     180             
  Lines       14464   14561     +97     
========================================
+ Hits         6654    6674     +20     
- Misses       7810    7887     +77     
Flag Coverage Δ
3.10 45.8% <25.0%> (-0.2%) ⬇️
3.11 45.8% <25.0%> (-0.2%) ⬇️
3.12 45.8% <25.0%> (-0.2%) ⬇️
3.13 ?
3.14 45.8% <25.0%> (-0.2%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

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.

1 participant