def get_bug_run_info()

in treeherder/intermittents_commenter/commenter.py [0:0]


    def get_bug_run_info(self, bug):
        all_platforms = ["linux", "mac", "windows", "android"]
        info = BugRunInfo()
        raw_data = bug["job__signature__job_type_name"]
        # platform, os, version
        info.platform = "linux"
        info.os_name = "linux"
        for substr in raw_data.split("-"):
            if any((current_platform := platform) in substr for platform in all_platforms):
                info.platform = substr
                info.os_name = current_platform
                info.os_version = substr.replace(info.os_name, "")
                break
        # architecture
        info.arch = "x86"
        if "-64" in raw_data:
            info.arch = "x86_64"
        elif "-aarch64" in raw_data:
            info.arch = "aarch64"
        # variant
        info.current_variant = self.get_test_variant(raw_data)
        info.variants.add(info.current_variant)
        # build_type
        # build types can be asan/opt, etc.,
        # so make sure that we search for 'debug' and 'opt' after other build_types
        build_types = ["asan", "tsan", "ccov", "debug", "opt"]
        for b_type in build_types:
            if b_type in raw_data:
                info.build_type = b_type
                break
        if not info.build_type:
            info.build_type = "unknown build"
        return info