1#!/usr/bin/env lucicfg 2 3lucicfg.check_version("1.30.9", "Please update depot_tools") 4 5# Use LUCI Scheduler BBv2 names and add Scheduler realms configs. 6lucicfg.enable_experiment("crbug.com/1182002") 7 8lucicfg.config( 9 config_dir = "generated", 10 tracked_files = ["*.cfg"], 11 fail_on_warnings = True, 12 lint_checks = ["default", "-module-docstring"], 13) 14 15luci.project( 16 name = "crosvm", 17 buildbucket = "cr-buildbucket.appspot.com", 18 logdog = "luci-logdog.appspot.com", 19 milo = "luci-milo.appspot.com", 20 notify = "luci-notify.appspot.com", 21 scheduler = "luci-scheduler.appspot.com", 22 swarming = "chromium-swarm.appspot.com", 23 tricium = "tricium-prod.appspot.com", 24 bindings = [ 25 # Allow owners to submit any task in any pool. 26 luci.binding( 27 roles = [ 28 "role/swarming.poolOwner", 29 "role/swarming.poolUser", 30 "role/swarming.taskTriggerer", 31 ], 32 groups = "mdb/crosvm-acl-luci-admin", 33 ), 34 35 # Allow any googler to see all bots and tasks there. 36 luci.binding( 37 roles = "role/swarming.poolViewer", 38 groups = "googlers", 39 ), 40 41 # Allow any googler to read/validate/reimport the project configs. 42 luci.binding( 43 roles = "role/configs.developer", 44 groups = "googlers", 45 ), 46 ], 47 acls = [ 48 # Publicly readable. 49 acl.entry( 50 roles = [ 51 acl.BUILDBUCKET_READER, 52 acl.LOGDOG_READER, 53 acl.PROJECT_CONFIGS_READER, 54 acl.SCHEDULER_READER, 55 ], 56 groups = "all", 57 ), 58 # Allow committers to use CQ and to force-trigger and stop CI builds. 59 acl.entry( 60 roles = [ 61 acl.SCHEDULER_OWNER, 62 acl.CQ_COMMITTER, 63 ], 64 groups = ["googlers", "project-crosvm-committers"], 65 ), 66 # Group with bots that have write access to the Logdog prefix. 67 acl.entry( 68 roles = acl.LOGDOG_WRITER, 69 groups = "luci-logdog-chromium-writers", 70 ), 71 ], 72) 73 74# Per-service tweaks. 75luci.logdog(gs_bucket = "logdog-crosvm-archive") 76 77# Realms with ACLs for corresponding Swarming pools. 78luci.realm(name = "pools/ci") 79luci.realm(name = "pools/try") 80 81# Global recipe defaults 82luci.recipe.defaults.cipd_version.set("refs/heads/main") 83luci.recipe.defaults.cipd_package.set("infra/recipe_bundles/chromium.googlesource.com/crosvm/crosvm") 84 85# The try bucket will include builders which work on pre-commit or pre-review 86# code. 87luci.bucket(name = "try") 88 89# The ci bucket will include builders which work on post-commit code. 90luci.bucket( 91 name = "ci", 92 acls = [ 93 acl.entry( 94 roles = acl.BUILDBUCKET_TRIGGERER, 95 groups = [ 96 "mdb/crosvm-acl-luci-admin", 97 ], 98 ), 99 ], 100) 101 102# The prod bucket will include builders which work on post-commit code and 103# generate executable artifacts used by other users or machines. 104luci.bucket(name = "prod") 105 106# This sets the default CIPD ref to use in builds to get the right version of 107# recipes for the build. 108# 109# The recipe bundler sets CIPD refs equal in name to the git refs that it 110# processed the recipe code from. 111# 112# Note: This will cause all recipe commits to automatically deploy as soon 113# as the recipe bundler compiles them from your refs/heads/main branch. 114cipd_version = "refs/heads/main" 115 116# Configure Change Verifier to watch crosvm 117luci.cq( 118 status_host = "chromium-cq-status.appspot.com", 119) 120luci.cq_group( 121 name = "main", 122 watch = cq.refset( 123 repo = "https://chromium.googlesource.com/crosvm/crosvm", 124 refs = ["refs/heads/.+"], # will watch all branches 125 ), 126 # Allows us to submit chains of commits with a single CQ run. 127 allow_submit_with_open_deps = True, 128) 129 130# Console showing all postsubmit verify builders 131luci.console_view( 132 name = "Postsubmit", 133 repo = "https://chromium.googlesource.com/crosvm/crosvm", 134) 135 136# View showing all presubmit builders 137luci.list_view( 138 name = "Presubmit", 139) 140 141# View showing all infra builders 142luci.list_view( 143 name = "Infra", 144) 145 146# Allows builders to send email notifications on failures. 147luci.notifier( 148 name = "postsubmit-failures", 149 on_status_change = True, 150 notify_emails = [ 151 "crosvm-uprev@grotations.appspotmail.com", 152 "crosvm-uprev-apac@grotations.appspotmail.com", 153 "denniskempin@google.com", 154 ], 155) 156luci.notifier( 157 name = "infra-failures", 158 on_status_change = True, 159 notify_emails = [ 160 "denniskempin@google.com", 161 "keiichiw@google.com", 162 ], 163) 164 165def verify_builder( 166 name, 167 dimensions, 168 presubmit = True, 169 postsubmit = True, 170 properties = dict(), 171 presubmit_properties = dict(), 172 postsubmit_properties = dict(), 173 category = "generic", 174 **args): 175 """Creates both a CI and try builder with the same properties. 176 177 The CI builder is attached to the gitlies poller and console view, and the try builder 178 is added to the change verifier. 179 180 Args: 181 name: Name of the builder 182 dimensions: Passed to luci.builder 183 presubmit: Create a presubmit builder (defaults to True) 184 postsubmit: Create a postsubmit builder (defaults to True) 185 category: Category of this builder in the concole view 186 properties: Builder properties for both presubmit and postsubmit 187 presubmit_properties: Builder properties for only presubmit 188 postsubmit_properties: Builder properties for only postsubmit 189 **args: Passed to luci.builder 190 """ 191 192 # CI builder 193 if postsubmit: 194 props = dict(**properties) 195 props.update(postsubmit_properties) 196 luci.builder( 197 name = name, 198 bucket = "ci", 199 service_account = "crosvm-luci-ci-builder@crosvm-infra.iam.gserviceaccount.com", 200 dimensions = dict(pool = "luci.crosvm.ci", **dimensions), 201 notifies = ["postsubmit-failures"], 202 properties = props, 203 **args 204 ) 205 luci.gitiles_poller( 206 name = "main source", 207 bucket = "ci", 208 repo = "https://chromium.googlesource.com/crosvm/crosvm", 209 triggers = ["ci/%s" % name], 210 ) 211 luci.console_view_entry( 212 console_view = "Postsubmit", 213 builder = "ci/%s" % name, 214 category = category, 215 ) 216 217 # Try builder 218 if presubmit: 219 props = dict(**properties) 220 props.update(presubmit_properties) 221 luci.builder( 222 name = name, 223 bucket = "try", 224 service_account = "crosvm-luci-try-builder@crosvm-infra.iam.gserviceaccount.com", 225 dimensions = dict(pool = "luci.crosvm.try", **dimensions), 226 properties = props, 227 **args 228 ) 229 luci.list_view_entry( 230 list_view = "Presubmit", 231 builder = "try/%s" % name, 232 ) 233 234 # Attach try builder to Change Verifier 235 luci.cq_tryjob_verifier( 236 builder = "try/%s" % name, 237 cq_group = "main", 238 ) 239 240def verify_linux_builder(arch, crosvm_direct = False, **kwargs): 241 """Creates a verify builder that builds crosvm on linux 242 243 Args: 244 arch: Architecture to build and test 245 crosvm_direct: Test crosvm-direct instead of crosvm 246 coverage: Disable coverage collection 247 **kwargs: Passed to verify_builder 248 """ 249 name = "linux_%s" % arch 250 if crosvm_direct: 251 name += "_direct" 252 verify_builder( 253 name = name, 254 dimensions = { 255 "os": "Ubuntu", 256 "cpu": "x86-64", 257 }, 258 executable = luci.recipe( 259 name = "build_linux", 260 ), 261 properties = { 262 "test_arch": arch, 263 "crosvm_direct": crosvm_direct, 264 }, 265 postsubmit_properties = { 266 "profile": "postsubmit", 267 }, 268 presubmit_properties = { 269 "profile": "presubmit", 270 }, 271 caches = [ 272 swarming.cache("builder", name = "linux_builder_cache"), 273 ], 274 category = "linux", 275 **kwargs 276 ) 277 278def infra_builder(name, postsubmit, **args): 279 """Creates a ci job to run infra recipes that are not involved in verifying changes. 280 281 The builders are added to a separate infra dashboard. 282 283 Args: 284 name: Name of the builder 285 postsubmit: True if the builder should run after each submitted commit. 286 **args: Passed to luci.builder 287 """ 288 luci.builder( 289 name = name, 290 bucket = "ci", 291 service_account = "crosvm-luci-ci-builder@crosvm-infra.iam.gserviceaccount.com", 292 dimensions = { 293 "pool": "luci.crosvm.ci", 294 "os": "Ubuntu", 295 "cpu": "x86-64", 296 }, 297 notifies = ["infra-failures"], 298 **args 299 ) 300 if postsubmit: 301 luci.gitiles_poller( 302 name = "main source", 303 bucket = "ci", 304 repo = "https://chromium.googlesource.com/crosvm/crosvm", 305 triggers = ["ci/%s" % name], 306 ) 307 luci.list_view_entry( 308 list_view = "Infra", 309 builder = "ci/%s" % name, 310 ) 311 312verify_linux_builder("x86_64") 313verify_linux_builder("x86_64", crosvm_direct = True) 314verify_linux_builder("aarch64") 315verify_linux_builder("armhf") 316verify_linux_builder("mingw64") 317 318verify_builder( 319 name = "chromeos_hatch", 320 dimensions = { 321 "os": "Ubuntu", 322 "cpu": "x86-64", 323 }, 324 executable = luci.recipe( 325 name = "build_chromeos_hatch", 326 ), 327 category = "linux", 328 presubmit = False, 329) 330 331verify_builder( 332 name = "windows", 333 dimensions = { 334 "os": "Windows", 335 "cpu": "x86-64", 336 }, 337 executable = luci.recipe( 338 name = "build_windows", 339 ), 340 category = "windows", 341) 342 343verify_builder( 344 name = "health_check", 345 dimensions = { 346 "os": "Ubuntu", 347 "cpu": "x86-64", 348 }, 349 executable = luci.recipe( 350 name = "health_check", 351 ), 352 caches = [ 353 swarming.cache("builder", name = "linux_builder_cache"), 354 ], 355 category = "linux", 356) 357 358infra_builder( 359 name = "push_to_github", 360 executable = luci.recipe( 361 name = "push_to_github", 362 ), 363 postsubmit = True, 364) 365 366infra_builder( 367 name = "build_docs", 368 executable = luci.recipe( 369 name = "build_docs", 370 ), 371 postsubmit = True, 372) 373 374infra_builder( 375 name = "update_chromeos_merges", 376 executable = luci.recipe( 377 name = "update_chromeos_merges", 378 ), 379 schedule = "0,30 * * * *", # Run every 30 minutes 380 postsubmit = False, 381) 382