def get_tests_groups_from_jenkins(runner_name, build_number, distros): runner_build = Build(runner_name, build_number) res = {} sub_builds = \ runner_build.build_data.get('subBuilds', [runner_build.build_data]) for b in sub_builds: if b['result'] is None: logger.debug("Skipping '{0}' job (build #{1}) because it's still " "running...".format( b['jobName'], b['buildNumber'], )) continue # Get the test group from the console of the job # Get the job suffix if b.get('jobName'): z = Build(b['jobName'], b['buildNumber']) console = z.get_job_console() job_name = b['jobName'] job_info = z.job_info env_vars = z.injected_vars else: console = runner_build.get_job_console() job_name = runner_build.name job_info = runner_build.job_info env_vars = runner_build.injected_vars groups = re.findall(TEST_GROUP_PATTERN, console) if not groups: # maybe it's failed baremetal job? # because of a design baremetal tests run pre-setup job # and when it fails there are no test groups in common meaning: # groups which could be parsed by TEST_GROUP_PATTERN baremetal_pattern = re.compile(r'Jenkins Build.*jenkins-(.*)-\d+') baremetal_groups = re.findall(baremetal_pattern, console) if not baremetal_groups: logger.error( "No test group found in console of the job {0}/{1}".format( b['jobName'], b['buildNumber'])) continue # we should get the group via jobName because the test group name # inside the log could be cut and some symbols will be changed to * groups = b['jobName'].split('.') # Use the last group (there can be several groups in upgrade jobs) test_group = groups[-1] for distro in distros: if distro in job_name: sep = '.' + distro + '.' job_suffix = job_name.split(sep)[-1] break else: job_suffix = job_name.split('.')[-1] res[job_suffix] = \ {'group': test_group, 'job_info': job_info, 'env_vars': env_vars} return res
def get_tests_groups_from_jenkins(runner_name, build_number, distros): runner_build = Build(runner_name, build_number) res = {} for b in runner_build.build_data['subBuilds']: if b['result'] is None: logger.debug("Skipping '{0}' job (build #{1}) because it's still " "running...".format(b['jobName'], b['buildNumber'],)) continue # Get the test group from the console of the job z = Build(b['jobName'], b['buildNumber']) console = z.get_job_console() groups = [keyword.split('=')[1] for line in console for keyword in line.split() if 'run_system_test.py' in line and '--group=' in keyword] if not groups: logger.error("No test group found in console of the job {0}/{1}" .format(b['jobName'], b['buildNumber'])) continue # Use the last group (there can be several groups in upgrade jobs) test_group = groups[-1] # Get the job suffix job_name = b['jobName'] for distro in distros: if distro in job_name: sep = '.' + distro + '.' job_suffix = job_name.split(sep)[-1] break else: job_suffix = job_name.split('.')[-1] res[job_suffix] = test_group return res
def get_tests_groups_from_jenkins(runner_name, build_number, distros): runner_build = Build(runner_name, build_number) res = {} sub_builds = \ runner_build.build_data.get('subBuilds', [runner_build.build_data]) for b in sub_builds: if b['result'] is None: logger.debug("Skipping '{0}' job (build #{1}) because it's still " "running...".format(b['jobName'], b['buildNumber'],)) continue # Get the test group from the console of the job # Get the job suffix if b.get('jobName'): z = Build(b['jobName'], b['buildNumber']) console = z.get_job_console() job_name = b['jobName'] job_info = z.job_info env_vars = z.injected_vars else: console = runner_build.get_job_console() job_name = runner_build.name job_info = runner_build.job_info env_vars = runner_build.injected_vars groups = re.findall(TEST_GROUP_PATTERN, console) if not groups: logger.error("No test group found in console of the job {0}/{1}" .format(b['jobName'], b['buildNumber'])) continue # Use the last group (there can be several groups in upgrade jobs) test_group = groups[-1] for distro in distros: if distro in job_name: sep = '.' + distro + '.' job_suffix = job_name.split(sep)[-1] break else: job_suffix = job_name.split('.')[-1] res[job_suffix] = \ {'group': test_group, 'job_info': job_info, 'env_vars': env_vars} return res
def get_tests_groups_from_jenkins(runner_name, build_number, distros): runner_build = Build(runner_name, build_number) res = {} for b in runner_build.build_data['subBuilds']: if b['result'] is None: logger.debug("Skipping '{0}' job (build #{1}) because it's still " "running...".format( b['jobName'], b['buildNumber'], )) continue # Get the test group from the console of the job z = Build(b['jobName'], b['buildNumber']) console = z.get_job_console() groups = [ keyword.split('=')[1] for line in console for keyword in line.split() if 'run_system_test.py' in line and '--group=' in keyword ] if not groups: logger.error( "No test group found in console of the job {0}/{1}".format( b['jobName'], b['buildNumber'])) continue # Use the last group (there can be several groups in upgrade jobs) test_group = groups[-1] # Get the job suffix job_name = b['jobName'] for distro in distros: if distro in job_name: sep = '.' + distro + '.' job_suffix = job_name.split(sep)[-1] break else: job_suffix = job_name.split('.')[-1] res[job_suffix] = test_group return res