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

Fix env parsing by placing it before executable parsing #81

Merged
merged 2 commits into from
Jan 8, 2021

Conversation

nkoenig
Copy link
Contributor

@nkoenig nkoenig commented Jan 6, 2021

The application of environment variables in launch files was broken due to incorrect order of operations. Environment variables need to be set before forking processes. This fixes the problem.

Example:

<ignition version='1.0'>
  <env>
    <name>IGN_TRANSPORT_TOPIC_STATISTICS</name>
    <value>1</value>
  </env>

  <plugin name="ignition::launch::GazeboServer" filename="libignition-launch-gazebo.so">...</plugin>
  
  <executable_wrapper>
    <plugin name="ignition::launch::GazeboGui" filename="libignition-launch-gazebogui.so">...</plugin>
  </executable_wrapper>

In the above example, the GazeboServer would have IGN_TRANSPORT_TOPIC_STATISTICS=1 but GazeboGui would have IGN_TRANSPORT_TOPIC_STATISTICS = undefined.

This is a behavior change from the currently release code, but this fix is fairly important.

Signed-off-by: Nate Koenig [email protected]

@nkoenig nkoenig requested a review from mjcarroll January 6, 2021 23:09
@github-actions github-actions bot added the 🔮 dome Ignition Dome label Jan 6, 2021
@nkoenig nkoenig changed the base branch from ign-launch3 to ign-launch2 January 6, 2021 23:16
@mjcarroll
Copy link
Contributor

This is a behavior change from the currently release code, but this fix is fairly important.

I think it makes sense, because it is the expected behavior here.

mjcarroll added a commit that referenced this pull request Jan 7, 2021
This adds a simple check to verify that the env directives apply
to everything in the ignition namespace, as fixed in #81.

The test itself is a bit of a workaround. We don't have a mechanism
for checking the manager output, and executable command directives
cannot expand environment variables.

This writes a script that is executed by the test to verify that a
file specified by an environment variable is touch-ed

Signed-off-by: Michael Carroll <[email protected]>
@mjcarroll mjcarroll mentioned this pull request Jan 7, 2021
Copy link
Contributor

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

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

LGTM, I have a proposed unit test in #82 if you want to take a look.

This adds a simple check to verify that the env directives apply
to everything in the ignition namespace, as fixed in #81.

The test itself is a bit of a workaround. We don't have a mechanism
for checking the manager output, and executable command directives
cannot expand environment variables.

This writes a script that is executed by the test to verify that a
file specified by an environment variable is touch-ed

Signed-off-by: Michael Carroll <[email protected]>
@codecov
Copy link

codecov bot commented Jan 8, 2021

Codecov Report

Merging #81 (44ce4e0) into ign-launch2 (0986169) will increase coverage by 1.22%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           ign-launch2      #81      +/-   ##
===============================================
+ Coverage        29.01%   30.24%   +1.22%     
===============================================
  Files                3        3              
  Lines              734      734              
===============================================
+ Hits               213      222       +9     
+ Misses             521      512       -9     
Impacted Files Coverage Δ
src/Manager.cc 56.01% <100.00%> (+2.84%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0986169...44ce4e0. Read the comment docs.

@nkoenig nkoenig merged commit 1870459 into ign-launch2 Jan 8, 2021
@nkoenig nkoenig deleted the reorder_env_parsing branch January 8, 2021 18:26
nkoenig added a commit that referenced this pull request Jan 8, 2021
* Fix env parsing by placing it before executable parsing

Signed-off-by: Nate Koenig <[email protected]>

* Add tests to #81 (#82)

This adds a simple check to verify that the env directives apply
to everything in the ignition namespace, as fixed in #81.

The test itself is a bit of a workaround. We don't have a mechanism
for checking the manager output, and executable command directives
cannot expand environment variables.

This writes a script that is executed by the test to verify that a
file specified by an environment variable is touch-ed

Signed-off-by: Michael Carroll <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: Michael Carroll <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: Michael Carroll <[email protected]>
nkoenig added a commit that referenced this pull request Jan 8, 2021
* Fix env parsing by placing it before executable parsing (#81)

* Fix env parsing by placing it before executable parsing

Signed-off-by: Nate Koenig <[email protected]>

* Add tests to #81 (#82)

This adds a simple check to verify that the env directives apply
to everything in the ignition namespace, as fixed in #81.

The test itself is a bit of a workaround. We don't have a mechanism
for checking the manager output, and executable command directives
cannot expand environment variables.

This writes a script that is executed by the test to verify that a
file specified by an environment variable is touch-ed

Signed-off-by: Michael Carroll <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: Michael Carroll <[email protected]>

* Prep for 2.2.1 release (#84)

Signed-off-by: Nate Koenig <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: Michael Carroll <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔮 dome Ignition Dome
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants