Пример #1
0
    def _close_fixed_builds(self, projects, build_type):
        """Close bugs for fixed builds."""
        issue_tracker = issue_tracker_utils.get_issue_tracker()
        if not issue_tracker:
            raise OssFuzzBuildStatusException('Failed to get issue tracker.')

        for project in projects:
            project_name = project['name']
            builds = project['history']
            if not builds:
                continue

            build_failure = get_build_failure(project_name, build_type)
            if not build_failure:
                continue

            build = builds[0]
            if not build['success']:
                continue

            if build_failure.last_checked_timestamp >= get_build_time(build):
                logs.log_error(
                    'Latest successful build time for %s in %s config is '
                    'older than or equal to last failure time.' %
                    (project_name, build_type))
                continue

            if build_failure.issue_id is not None:
                close_bug(issue_tracker, build_failure.issue_id, project_name)

            close_build_failure(build_failure)
Пример #2
0
    def _process_failures(self, projects, build_type):
        """Process failures."""
        issue_tracker = issue_tracker_utils.get_issue_tracker()
        if not issue_tracker:
            raise OssFuzzBuildStatusException('Failed to get issue tracker.')

        for project in projects:
            project_name = project['name']
            builds = project['history']
            if not builds:
                continue

            build = builds[0]
            if build['success']:
                continue

            project_name = project['name']

            # Do not file an issue for non-main build types, if there is a main build
            # failure for the same project, as the root cause might be the same.
            if build_type != MAIN_BUILD_TYPE:
                build_failure = get_build_failure(project_name,
                                                  MAIN_BUILD_TYPE)
                if build_failure:
                    continue

            build_failure = get_build_failure(project_name, build_type)

            build_time = get_build_time(build)
            if build_failure:
                if build_time <= build_failure.last_checked_timestamp:
                    # No updates.
                    continue
            else:
                build_failure = create_build_failure(project_name, build,
                                                     build_type)

            build_failure.last_checked_timestamp = build_time
            build_failure.consecutive_failures += 1
            if build_failure.consecutive_failures >= MIN_CONSECUTIVE_BUILD_FAILURES:
                if build_failure.issue_id is None:
                    oss_fuzz_project = _get_oss_fuzz_project(project_name)
                    if not oss_fuzz_project:
                        logs.log(
                            'Project %s is disabled, skipping bug filing.' %
                            project_name)
                        continue

                    build_failure.issue_id = file_bug(issue_tracker,
                                                      project_name,
                                                      build['build_id'],
                                                      oss_fuzz_project.ccs,
                                                      build_type)
                elif (build_failure.consecutive_failures -
                      MIN_CONSECUTIVE_BUILD_FAILURES) % REMINDER_INTERVAL == 0:
                    send_reminder(issue_tracker, build_failure.issue_id,
                                  build['build_id'])

            build_failure.put()