From 179c2a12d25560f6e160eedc991678760053e36c Mon Sep 17 00:00:00 2001 From: Justintime50 <39606064+Justintime50@users.noreply.github.com> Date: Mon, 11 Jul 2022 20:34:25 -0600 Subject: [PATCH] fix: deployment_type catch errors --- CHANGELOG.md | 4 +++- harvey/deployments.py | 2 ++ setup.py | 2 +- test/unit/test_deployments.py | 2 ++ uwsgi.ini | 2 +- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46f9266..bce68e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,11 @@ # CHANGELOG -## NEXT RELEASE +## v0.20.0 (2022-07-11) - Swaps `gunicorn` for `uwsgi` for better performance. This switch also fixes the concurrency deadlock in production - Harvey now runs as a daemon which should drastically improve performance +- Drops default processes running from 4 to 2 +- Adds a check to ensure the `deployment_type` passed was valid and fails if not ## v0.19.0 (2022-05-22) diff --git a/harvey/deployments.py b/harvey/deployments.py index 10c02be..cc71dc6 100644 --- a/harvey/deployments.py +++ b/harvey/deployments.py @@ -137,6 +137,8 @@ def run_deployment(webhook: Dict[str, Any]): logger.info(pull_success_message) final_output = f'{webhook_output}\n{pull_success_message}' Utils.success(final_output, webhook) + else: + Utils.kill(f'deployment_type invalid, must be one of {Config.supported_deployments}', webhook) @staticmethod def open_project_config(webhook: Dict[str, Any]): diff --git a/setup.py b/setup.py index 986bea6..d70e4bc 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ setuptools.setup( name='harvey-cd', - version='0.19.0', + version='0.20.0', description='The lightweight Docker Compose deployment platform.', long_description=long_description, long_description_content_type="text/markdown", diff --git a/test/unit/test_deployments.py b/test/unit/test_deployments.py index 8d8732c..f5946ed 100644 --- a/test/unit/test_deployments.py +++ b/test/unit/test_deployments.py @@ -81,6 +81,7 @@ def test_open_project_config_not_found(mock_utils_kill, mock_webhook): return_value=[mock_config(deployment_type='pull'), MOCK_OUTPUT, MOCK_TIME], ) def test_run_deployment_pull(mock_initialize_deployment, mock_utils_success, mock_path_exists, mock_exit, mock_webhook): + # TODO: This test requires the Docker daemon to be running, refactor so it can run without _ = Deployment.run_deployment(mock_webhook) mock_initialize_deployment.assert_called_once_with(mock_webhook) @@ -97,6 +98,7 @@ def test_run_deployment_pull(mock_initialize_deployment, mock_utils_success, moc def test_run_deployment_deploy( mock_initialize_deployment, mock_deploy_deployment, mock_healthcheck, mock_utils_success, mock_webhook ): + # TODO: This test requires the Docker daemon to be running, refactor so it can run without _ = Deployment.run_deployment(mock_webhook) mock_initialize_deployment.assert_called_once_with(mock_webhook) diff --git a/uwsgi.ini b/uwsgi.ini index 77e9a87..f5a47bb 100644 --- a/uwsgi.ini +++ b/uwsgi.ini @@ -7,7 +7,7 @@ die-on-term = true need-app = true ; concurrency -processes = 4 +processes = 2 threads = 2 ; app setup