xref: /aosp_15_r20/external/perfetto/infra/luci/main.star (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1#!/usr/bin/env lucicfg
2# Copyright (C) 2021 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16lucicfg.check_version("1.30.9", "Please update depot_tools")
17
18# Use LUCI Scheduler BBv2 names and add Scheduler realms configs.
19lucicfg.enable_experiment("crbug.com/1182002")
20
21# Enable bbagent.
22luci.recipe.defaults.use_bbagent.set(True)
23
24lucicfg.config(
25    config_dir = "generated",
26    fail_on_warnings = True,
27)
28
29luci.project(
30    name = "perfetto",
31    buildbucket = "cr-buildbucket.appspot.com",
32    logdog = "luci-logdog",
33    milo = "luci-milo",
34    scheduler = "luci-scheduler",
35    swarming = "chrome-swarming.appspot.com",
36    acls = [
37        acl.entry(
38            [
39                acl.BUILDBUCKET_READER,
40                acl.LOGDOG_READER,
41                acl.PROJECT_CONFIGS_READER,
42                acl.SCHEDULER_READER,
43            ],
44            groups = ["all"],
45        ),
46        acl.entry(roles = acl.SCHEDULER_OWNER, groups = "mdb/perfetto-cloud-infra"),
47        acl.entry([acl.LOGDOG_WRITER], groups = ["luci-logdog-chromium-writers"]),
48    ],
49)
50
51# Use the default Chromium logdog instance as:
52# a) we expect our logs to be very minimal
53# b) we are open source so there's nothing special in our logs.
54luci.logdog(
55    gs_bucket = "chromium-luci-logdog",
56)
57
58# Create a realm for the official pool.
59# Used by LUCI infra (Googlers: see pools.cfg) to enforce ACLs.
60luci.realm(name = "pools/official")
61
62# Bucket used by all official builders.
63luci.bucket(
64    name = "official",
65    acls = [
66        acl.entry(
67            roles = [acl.BUILDBUCKET_TRIGGERER],
68            groups = ["mdb/perfetto-cloud-infra"],
69        ),
70        acl.entry(
71            roles = [acl.SCHEDULER_TRIGGERER, acl.BUILDBUCKET_TRIGGERER],
72            groups = ["mdb/chrome-troopers"],
73        ),
74    ],
75)
76
77def official_builder(name, os, caches=[]):
78    luci.builder(
79        name = name,
80        bucket = "official",
81        executable = luci.recipe(
82            name = "perfetto",
83            cipd_package = "infra/recipe_bundles/android.googlesource.com/platform/external/perfetto",
84            cipd_version = "refs/heads/master",
85            use_python3 = True,
86        ),
87        dimensions = {
88            "pool": "luci.perfetto.official",
89            "os": os,
90            "cpu": "x86-64",
91        },
92        service_account = "perfetto-luci-official-builder@chops-service-accounts.iam.gserviceaccount.com",
93        triggered_by = [
94            luci.gitiles_poller(
95                name = "perfetto-gitiles-trigger",
96                bucket = "official",
97                repo = "https://android.googlesource.com/platform/external/perfetto",
98                refs = ["refs/tags/v.+"],
99            ),
100        ],
101        caches = [
102            swarming.cache(cache, name = cache)
103            for cache in caches
104        ]
105    )
106
107official_builder("perfetto-official-builder-linux", "Linux")
108official_builder("perfetto-official-builder-mac", "Mac", ["macos_sdk"])
109official_builder("perfetto-official-builder-windows", "Windows", ["windows_sdk"])
110official_builder("perfetto-official-builder-android", "Linux")
111