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

Add a deprecation warning for 'ENVIRONMENT' & env fallback #277

Merged
merged 1 commit into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions scripts/plugins/deploy_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,20 @@ def Deploy_Plugins():
os.environ["BITOPS_DEFAULT_ROOT_DIR"] = BITOPS_default_folder

# Global environment evaluation
# TODO: Drop support for 'ENVIRONMENT' env var
if 'ENVIRONMENT' in os.environ:
logger.warning(
"'ENVIRONMENT' var is deprecated in v2.0.0 and will be removed in the future versions! "
"Use the 'BITOPS_ENVIRONMENT' env var instead!"
Comment on lines +54 to +58
Copy link
Member Author

@arm4b arm4b Aug 11, 2022

Choose a reason for hiding this comment

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

Now that ENVIRONMENT is deprecated in v2.0.0 in favor of new BITOPS_ENVIRONMENT, but we're handling the case gracefully by merging the values.

The question though, in which BitOps version do we want to drop the ENVIRONMENT var completely?

Copy link
Contributor

Choose a reason for hiding this comment

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

i'd create an issue/discussion so we can discuss (also to add it to the roadmap)

Copy link
Member Author

Choose a reason for hiding this comment

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

Created a note here: #245 (comment) in the "Roadmap" Discussion so it's not lost.

)

if BITOPS_ENV_environment is None:
logger.error("The `BITOPS_ENVIRONMENT` variable must be set... Exiting.\n\t\tFor more information on this issue please checkout our doc [https://bitovi.github.io/bitops/configuration-base/#environment]")
logger.error(
"The 'BITOPS_ENVIRONMENT' variable must be set! Exiting...\n"
"For more information on this issue please check out [https://bitovi.github.io/bitops/configuration-base/#environment]"
)
quit(1)

# Move to temp directory
if not os.path.isdir(bitops_deployment_dir):
logger.error("An operations repo needs to be mounted to the Docker container with the path `/opt/bitops_deployment/`... Exiting.\n\t\tFor more information on this issue please checkout our doc [https://bitovi.github.io/bitops/about/#how-bitops-works]")
Expand All @@ -69,7 +79,7 @@ def Deploy_Plugins():
logger.info("\n\n\n~#~#~#~BITOPS DEPLOYMENT CONFIGURATION~#~#~#~ \
\n\t TEMP_DIR: [{temp_dir}] \
\n\t DEFAULT_FOLDER_NAME: [{default_folder_name}] \
\n\t ENVIRONMENT: [{env}] \
\n\t BITOPS_ENVIRONMENT: [{env}] \
\n\t TIMEOUT: [{timeout}] \
\n \
\n\t BITOPS_DIR: [{bitops_dir}] \
Expand Down
4 changes: 3 additions & 1 deletion scripts/plugins/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
BITOPS_ENV_plugin_dir = os.environ.get("BITOPS_PLUGIN_DIR")

BITOPS_ENV_default_folder = os.environ.get("BITOPS_DEFAULT_FOLDER")
BITOPS_ENV_environment = os.environ.get("BITOPS_ENVIRONMENT", None)
# v2.0.0: Fallback to 'ENVIRONMENT' in case when 'BITOPS_ENVIRONMENT' is not set
# TODO: Drop 'ENVIRONMENT' backward-compatibility in the future versions
BITOPS_ENV_environment = os.environ.get("BITOPS_ENVIRONMENT", os.environ.get("ENVIRONMENT", None))
BITOPS_ENV_timeout = os.environ.get("BITOPS_TIMEOUT")

if not bitops_build_configuration.bitops:
Expand Down