diff --git a/tasks/libs/notify/utils.py b/tasks/libs/notify/utils.py index d1d803f1b2d64..31066152f95c0 100644 --- a/tasks/libs/notify/utils.py +++ b/tasks/libs/notify/utils.py @@ -65,7 +65,7 @@ def notification_type(): """ Return the type of notification to send (related to the type of pipeline, amongst 'deploy', 'trigger' and 'merge') """ - if os.environ['DEPLOY_AGENT'] == 'true': + if os.environ.get('DEPLOY_AGENT', '') == 'true': return 'deploy' elif os.environ['CI_PIPELINE_SOURCE'] != 'push': return 'trigger' diff --git a/tasks/unit_tests/notify_tests.py b/tasks/unit_tests/notify_tests.py index 87c93d579c77d..2210da2132149 100644 --- a/tasks/unit_tests/notify_tests.py +++ b/tasks/unit_tests/notify_tests.py @@ -31,7 +31,7 @@ def get_github_slack_map(): class TestSendMessage(unittest.TestCase): - @patch.dict('os.environ', {'DEPLOY_AGENT': 'false', 'CI_PIPELINE_SOURCE': 'push', 'CI_PIPELINE_ID': '42'}) + @patch.dict('os.environ', {'CI_PIPELINE_SOURCE': 'push', 'CI_PIPELINE_ID': '42'}) @patch('tasks.libs.pipeline.notifications.get_pr_from_commit', new=MagicMock(return_value="")) @patch('builtins.print') @patch('tasks.libs.ciproviders.gitlab_api.get_gitlab_api')