@@ -121,12 +121,60 @@ def run_remote_command_logic(args, project_name, project_version):
121121 profilers_enabled = args .enable_profilers
122122 keep_env_and_topo = args .keep_env_and_topo
123123
124+ if WH_TOKEN is not None :
125+ webhook_notifications_active = True
126+
124127 webhook_url = "https://hooks.slack.com/services/{}" .format (WH_TOKEN )
125128
126- if args .skip_env_vars_verify is False :
127- check_ec2_env ()
129+ ci_job_link = CIRCLE_BUILD_URL
130+ ci_job_name = CIRCLE_JOB
131+ failure_reason = ""
132+ webhook_client_slack = None
133+ if ci_job_link is None :
134+ webhook_notifications_active = False
135+ logging .warning (
136+ "Disabling webhook notificaitons given CIRCLE_BUILD_URL is None"
137+ )
138+
139+ if webhook_notifications_active is True :
140+ logging .info (
141+ "Detected where in a CI flow named {}. Here's the reference link: {}" .format (
142+ ci_job_name , ci_job_link
143+ )
144+ )
145+ webhook_client_slack = WebhookClient (webhook_url )
128146
129- redis_modules_check (local_module_files )
147+ if args .skip_env_vars_verify is False :
148+ env_check_status , failure_reason = check_ec2_env ()
149+ if env_check_status is False :
150+ if webhook_notifications_active :
151+ generate_failure_notification (
152+ webhook_client_slack ,
153+ ci_job_name ,
154+ ci_job_link ,
155+ failure_reason ,
156+ tf_github_org ,
157+ tf_github_repo ,
158+ tf_github_branch ,
159+ None ,
160+ )
161+ exit (1 )
162+
163+ module_check_status , error_message = redis_modules_check (local_module_files )
164+ if module_check_status is False :
165+ if webhook_notifications_active :
166+ failure_reason = error_message
167+ generate_failure_notification (
168+ webhook_client_slack ,
169+ ci_job_name ,
170+ ci_job_link ,
171+ failure_reason ,
172+ tf_github_org ,
173+ tf_github_repo ,
174+ tf_github_branch ,
175+ None ,
176+ )
177+ exit (1 )
130178
131179 common_properties_log (
132180 tf_bin_path ,
@@ -151,20 +199,6 @@ def run_remote_command_logic(args, project_name, project_version):
151199 clusterconfig ,
152200 ) = prepare_benchmark_definitions (args )
153201
154- ci_job_link = CIRCLE_BUILD_URL
155- ci_job_name = CIRCLE_JOB
156- failure_reason = ""
157- webhook_notifications_active = False
158- webhook_client_slack = None
159- if ci_job_link is not None :
160- logging .info (
161- "Detected where in a CI flow named {}. Here's the reference link: {}" .format (
162- ci_job_name , ci_job_link
163- )
164- )
165- webhook_notifications_active = True
166- webhook_client_slack = WebhookClient (webhook_url )
167-
168202 return_code = 0
169203 if benchmark_defs_result is False :
170204 return_code = 1
0 commit comments