Skip to content

Support deployment_config/working_dir value - #356

Open
TimoSteuerwaldETAS wants to merge 20 commits into
eclipse-score:mainfrom
etas-contrib:feature/honor-deployment-config-working-dir
Open

Support deployment_config/working_dir value#356
TimoSteuerwaldETAS wants to merge 20 commits into
eclipse-score:mainfrom
etas-contrib:feature/honor-deployment-config-working-dir

Conversation

@TimoSteuerwaldETAS

@TimoSteuerwaldETAS TimoSteuerwaldETAS commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This fixes #343 .
Furthermore the config mapping tests have been fixed and are executed on the pipeline.
A feature integration test has been also added which is testing various options, not only working dir.

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: 64781860-f88f-483a-8aab-f144a023c9a0
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (37 packages loaded, 10 targets configured)

Analyzing: target //:license-check (81 packages loaded, 10 targets configured)

Analyzing: target //:license-check (142 packages loaded, 2266 targets configured)

Analyzing: target //:license-check (152 packages loaded, 5310 targets configured)

Analyzing: target //:license-check (163 packages loaded, 6531 targets configured)

Analyzing: target //:license-check (163 packages loaded, 8263 targets configured)

Analyzing: target //:license-check (164 packages loaded, 8271 targets configured)

Analyzing: target //:license-check (164 packages loaded, 8271 targets configured)

Analyzing: target //:license-check (164 packages loaded, 8271 targets configured)

Analyzing: target //:license-check (167 packages loaded, 10159 targets configured)

Analyzing: target //:license-check (168 packages loaded, 10283 targets configured)

INFO: Analyzed target //:license-check (169 packages loaded, 10409 targets configured).
[6 / 15] checking cached actions
[12 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions running)
[14 / 16] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar; 0s disk-cache, processwrapper-sandbox
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 25.504s, Critical Path: 2.74s
INFO: 16 processes: 12 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

Comment thread patches/score_itf_docker_cap_add.patch Outdated
environment=_docker_configuration["environment"],
volumes=_docker_configuration["volumes"],
shm_size=_docker_configuration["shm_size"],
+ privileged=_docker_configuration.get("privileged", False),

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.

Any plan to bring these changes to ITF repo?

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.

Something similar is already there. Because today the itf_score version has been increased to 0.5.0, I reverted the patch.

if "initial_run_target" in config or "initial_run_target" in merged_defaults:
new_config["initial_run_target"] = config.get(
"initial_run_target", merged_defaults.get("initial_run_target")
)

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.

I think this change it redundant. There is a validation that ensures that initial_run_target must always be defined (to Startup state)

"working_dir": depl_cfg["working_dir"],
# Default the working directory to bin_dir (the directory the
# executable lives in) when not set explicitly.
"working_dir": depl_cfg.get("working_dir", depl_cfg["bin_dir"]),

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.

This decision to use bin_dir as default exists in two different places, can this be moved to a single function (e.g. get_working_dir)?

],
"security_policy_details": "policy_name",
"number_of_restart_attempts": 1,
"working_dir": "/tmp",

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.

Could you adapt one of the configs so that we have all cases covered?

  1. Taking the default working dir (as bin dir)
  2. Setting the working_dir in the defaults section
  3. Setting the working dir explicitly on the component (overwriting the default)

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.

Done.

@@ -35,6 +36,8 @@ def run_until_file_deployed(
:param file_path: path of the file to wait for on the target.
:param timeout_s: maximum seconds to wait for the file (default: 30).
:param poll_interval_s: seconds between file-existence checks (default: 0.5).

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.

Maybe update the documentation that poll_interval_s is also used to poll process state

time.sleep(poll_interval_s)

assert not proc.is_running(), (
f"LCM still running {stop_timeout_s}s after SIGTERM"

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.

What happens to other tests when the Process does not shutdown on receiving SIGTERM?
Is the process then killed with -9 to force termination so the next tests are not affected by this?

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.

I have added a kill -9 to not influence other tests.

Comment thread tests/integration/sandbox_options/BUILD Outdated
load("//tests/utils/bazel:integration.bzl", "integration_test")

exports_files(
["lm_demo.json"],

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.

I don't understand where is this file and why is it visible for examples folder?

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.

Me neither. Removed.

case SCHED_FIFO:
return "SCHED_FIFO";
case SCHED_RR:
return "SCHED_RR";

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.

I think SCHED_RR was not tested.


const uid_t expected_uid = 666;
const gid_t expected_gid = 666;
const std::array<gid_t, 3> expected_supp_groups = {123, 321, 456};

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.

I think we cover at least the cases:

  • No supplementary group ids configured
  • Some supplementary group ids configured

const uid_t expected_uid = 666;
const gid_t expected_gid = 666;
const std::array<gid_t, 3> expected_supp_groups = {123, 321, 456};
const std::string expected_cwd = "/tmp";

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.

I think we should at least cover the cases:

  • A specific working_dir configured
  • The default working_dir is used

{
bool all_pass = true;

const uid_t expected_uid = 666;

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.

Can this be a reusable process, where you pass the expected values via CLI flags?

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.

Sure. Fixed.

TEST_STEP("Activate RunTarget Startup")
{
score::cpp::stop_token stop_token;
auto result = client.ActivateRunTarget("Startup").Get(stop_token);

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.

Launch Manager goes to Startup by default. I think this is redundant.
Looks like we can remove the whole control_daemon_mock from this test

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.

"gid": 666,
"supplementary_group_ids": [123, 321, 456],
"scheduling_policy": "SCHED_FIFO",
"scheduling_priority": 10

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.

I think we should also assert some default priority if not configured

Copied smoke test and renamed accordingly.
Allow execution of sched_setscheduler call by adding SYS_NICE capability to the docker environment
With new version 0.5.0 this is no longer needed.
@TimoSteuerwaldETAS
TimoSteuerwaldETAS force-pushed the feature/honor-deployment-config-working-dir branch from dad60c7 to 71264de Compare July 24, 2026 09:45
Two test modifications:
- If no working_dir is defined, bin directory is used.
- A working dir defined on deployment config level can be overridden on component level
@@ -28,6 +28,7 @@
script_dir.parent.parent

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.

I think because this file is referenced like this I wonder if the bazel test might not recognise cache misses correctly 🤔. I also don't like storing all of the location of these files as these variables.

I think we can use pytest args and make a custom conftest.py so that the location of this is taken from the args of the pytest command.

I tested this idea out with this patch and the test passes, do you think it would make sense to do it this way?
staged-changes.patch

"bin_dir": depl_cfg["bin_dir"],
"working_dir": depl_cfg["working_dir"],
# Default the working directory to bin_dir (the directory the
# executable lives in) when not set explicitly.

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.

TEST_STEP("Activate RunTarget Startup")
{
score::cpp::stop_token stop_token;
auto result = client.ActivateRunTarget("Startup").Get(stop_token);

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.

return pass;
}

bool verify_sandbox_options()

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.

I think this is a bit long for thet test, can you separate this into another header file like verify_sandbox.hpp

Then would be nice if the API was

::testing::AssertionResult verifySandbox(ExpectedValues)

And the test logic would simply be

EXPECT_TRUE(verifySandbox(ExpectedValues {
    .uid = xxx,
    .gid = xxx
     ...
}));

while proc.is_running() and time.monotonic() < stop_deadline:
time.sleep(poll_interval_s)

if proc.is_running():

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.

I think there is a proc.stop() method that handles the SIGTERM -> SIGKILL escalation. This is also being changed in https://github.com/eclipse-score/lifecycle/pull/328/changes#diff-5a2398a3ecf6f7c0d805b90182ce8c998bee6de87256a9379052fb919e55c202

would it be breaking to not do this change for now, and let the subsequent PR handle that?

// Populate 'out' from the command line arguments. Only the options that are actually present are
// set; any option left out stays unset and is therefore not verified. Returns false if an
// unrecognized option is encountered.
bool parse_arguments(int argc, char** argv, ExpectedValues& out)

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.

Are you sure you want to have the process sandbox configs parsed from args?

Feel like making the ExpectedValue struct hard coded in the test code basically does the same thing, otherwise the values are just hard coded in the json config and you also need logic to parse the args.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[launch_manager] Honor deployment_config.working_dir as the spawned process cwd

3 participants