def find_current_step_failures(fetch_function, recent_build_ids): step_failures = [] completed_step_names = set() for build_id in recent_build_ids: build = fetch_function(build_id)[0] if not build: # fetch_build_json will already log critical in this case. continue passing, failing = complete_steps_by_type(build) passing_names = set([s['name'] for s in passing]) completed_step_names.update(passing_names) for step in failing: name = step['name'] if name in completed_step_names: logging.debug('%s ran more recently, ignoring.', name) continue # Add this here so that the if-check above doesn't skip failures # from the current build we're processing. completed_step_names.add(name) step_failures.append({ 'build_number': build_id, 'step_name': name, }) if not buildbot.is_in_progress(build): break # Some builders use a sub-step pattern which just generates noise. # FIXME: This code shouldn't contain constants like these. IGNORED_STEP_NAMES = ['steps', 'trigger', 'slave_steps', 'recipe failure reason'] ignored_failures = [s for s in step_failures if s['step_name'] in IGNORED_STEP_NAMES] non_ignored_failures = [s for s in step_failures if s['step_name'] not in IGNORED_STEP_NAMES] if len(non_ignored_failures): return non_ignored_failures return ignored_failures
def find_current_step_failures(fetch_function, recent_build_ids): step_failures = [] completed_step_names = set() for build_id in recent_build_ids: build = fetch_function(build_id)[0] if not build: # fetch_build_json will already log critical in this case. continue passing, failing = complete_steps_by_type(build) passing_names = set([s['name'] for s in passing]) completed_step_names.update(passing_names) for step in failing: name = step['name'] if name in completed_step_names: logging.debug('%s ran more recently, ignoring.', name) continue # Add this here so that the if-check above doesn't skip failures # from the current build we're processing. completed_step_names.add(name) step_failures.append({ 'build_number': build_id, 'step_name': name, }) if not buildbot.is_in_progress(build): break # Some builders use a sub-step pattern which just generates noise. # FIXME: This code shouldn't contain constants like these. IGNORED_STEP_NAMES = ['steps', 'trigger', 'slave_steps'] ignored_failures = [s for s in step_failures if s['step_name'] in IGNORED_STEP_NAMES] non_ignored_failures = [s for s in step_failures if s['step_name'] not in IGNORED_STEP_NAMES] if len(non_ignored_failures): return non_ignored_failures return ignored_failures
def test_is_in_progress(self): self.assertEqual(buildbot.is_in_progress({'results': None}), True) self.assertEqual(buildbot.is_in_progress({'results': 2}), False)
def test_is_in_progress(self): self.assertEqual(buildbot.is_in_progress({'results': None}), True) self.assertEqual(buildbot.is_in_progress({'results': 2}), False)