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

Override env vars #241

Merged
merged 7 commits into from
Feb 3, 2025
Merged

Override env vars #241

merged 7 commits into from
Feb 3, 2025

Conversation

al1img
Copy link
Collaborator

@al1img al1img commented Jan 23, 2025

No description provided.

const EnvVarsArray& GetOverrideEnvVars() const { return mOverrideEnvVars; };

/**
* Sets
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Sets
* Sets instance override env vars.

/**
* Returns instance override env vars.
*
* @return EnvVarsArray.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @return EnvVarsArray.
* @return const EnvVarsArray&.

mCurrentInstances.RemoveIf(
[&info](const Instance& instance) { return instance.InstanceID() == info.mInstanceID; });
// Skip already stopped instances
if (GetInstance(info.mInstanceID) == mCurrentInstances.end()) {
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a typo:
I've expected the next condition:

Suggested change
if (GetInstance(info.mInstanceID) == mCurrentInstances.end()) {
if (GetInstance(info.mInstanceID) != mCurrentInstances.end()) {

@al1img al1img force-pushed the override_env_vars branch from ddd3606 to 8e6f4c2 Compare January 29, 2025 15:30
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 14.79592% with 167 lines in your changes missing coverage. Please review.

Project coverage is 83.58%. Comparing base (d615de5) to head (36b8ae5).
Report is 393 commits behind head on develop.

Files with missing lines Patch % Lines
src/sm/launcher/launcher.cpp 11.04% 153 Missing ⚠️
include/aos/common/cloudprotocol/cloudprotocol.hpp 0.00% 11 Missing ⚠️
include/aos/sm/launcher/instance.hpp 50.00% 1 Missing ⚠️
src/sm/launcher/instance.cpp 66.66% 1 Missing ⚠️
tests/sm/stubs/launcherstub.hpp 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #241      +/-   ##
===========================================
- Coverage    86.56%   83.58%   -2.98%     
===========================================
  Files           85      157      +72     
  Lines         7448    13712    +6264     
  Branches         0     1709    +1709     
===========================================
+ Hits          6447    11461    +5014     
- Misses        1001     2251    +1250     

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


Error Launcher::UpdateInstancesEnvVars()
{
auto restartInstances = SharedPtr<Array<InstanceData>>(&mAllocator, new (&mAllocator) InstanceDataStaticArray());
Copy link
Member

Choose a reason for hiding this comment

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

Can we use make shared?

Suggested change
auto restartInstances = SharedPtr<Array<InstanceData>>(&mAllocator, new (&mAllocator) InstanceDataStaticArray());
auto restartInstances = MakeShared<InstanceDataStaticArray>(mAllocator);

@al1img al1img force-pushed the override_env_vars branch from 12f45f9 to 3ffd482 Compare January 30, 2025 17:34
Instance should be remove in current instances map, as this method will be used
for restart instances as well.

Signed-off-by: Oleksandr Grytsov <[email protected]>
Using value in list node requires list element to always have default
constructor. It is not possible in some cases. Use buffer and cast it to value
to properly handle items without default constructor.

Signed-off-by: Oleksandr Grytsov <[email protected]>
During process instances (namely stop instances) concurrently, we remove
instances from array. It leads to array rearrangement, as result currently
processed instances may point to wrong place. Use list instead of array to avoid
this issue.

Signed-off-by: Oleksandr Grytsov <[email protected]>
@al1img al1img force-pushed the override_env_vars branch from 3ffd482 to 36b8ae5 Compare January 30, 2025 17:36
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
4.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@al1img al1img merged commit f4f9d92 into aosedge:develop Feb 3, 2025
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants