blurstudio / hab

A application environment and launcher
GNU Lesser General Public License v3.0
25 stars 3 forks source link

[Bug]: distro environment variables not always set #107

Open MHendricks opened 3 days ago

MHendricks commented 3 days ago

Summary

If distros are not defined on the config being processed, environment variables added by distros get lost. This can be replicated using the place-holder configs in the test suite.

Using the test suite if you call hab -v dump place-holder/inherits -vvv it incorrectly resolves the environment :

environment:  HAB_URI:  place-holder/inherits
              TEST:  case

This is missing the DCC_CONFIG_PATH and DCC_MODULE_PATH env vars defined by the distros.

Expected Behavior

It should include the env vars defined by the included distros and look like this:

environment:  DCC_CONFIG_PATH:  C:/blur/dev/hab_/tests/distros/the_dcc_plugin_b/1.1
                                         C:/blur/dev/hab_/tests/distros/the_dcc_plugin_d/1.1
                                         C:/blur/dev/hab_/tests/distros/the_dcc_plugin_a/1.1
                                         C:/blur/dev/hab_/tests/distros/the_dcc_plugin_e/1.1
              DCC_MODULE_PATH:  C:/blur/dev/hab_/tests/distros/the_dcc_plugin_a/1.1
                                C:/blur/dev/hab_/tests/distros/the_dcc_plugin_e/1.1
                                C:/blur/dev/hab_/tests/distros/the_dcc_plugin_d/1.1
                                C:/blur/dev/hab_/tests/distros/the_dcc_plugin_b/1.1
                                C:/blur/dev/hab_/tests/distros/the_dcc_plugin_c/1.1
              HAB_URI:  place-holder/inherits
              TEST:  case

Steps to Reproduce Behavior

Set your HAB_PATHS to point to tests\site_main.json and run hab -v dump place-holder/inherits -vvv. You can also see similar behavior with the URI place-holder/undefined. It does not happen for place-holder/child.

Solution

No response

Environment

Probably present in most previous versions of hab.

Additional Context

I discovered this issue while working on https://github.com/blurstudio/hab/pull/105 and the fix should be included in it.