[infra] Use lucicfg for infra configuration

The generated files should match handwritten ones on infra/config branch.

Change-Id: Idbd59689afcfcd70c37f9a93a7ce672264df1bb7
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/11280
Commit-Queue: Petr Hosek <phosek@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
diff --git a/infra/config/generated/commit-queue.cfg b/infra/config/generated/commit-queue.cfg
new file mode 100644
index 0000000..9abfe96
--- /dev/null
+++ b/infra/config/generated/commit-queue.cfg
@@ -0,0 +1,46 @@
+# Auto-generated by lucicfg.
+# Do not modify manually.
+#
+# For the schema of this file, see Config message:
+#   https://luci-config.appspot.com/schemas/projects:commit-queue.cfg
+
+submit_options {
+  max_burst: 4
+  burst_delay {
+    seconds: 480
+  }
+}
+config_groups {
+  name: "gn"
+  gerrit {
+    url: "https://gn-review.googlesource.com"
+    projects {
+      name: "gn"
+      ref_regexp: "refs/heads/master"
+    }
+  }
+  verifiers {
+    gerrit_cq_ability {
+      committer_list: "project-gn-committers"
+      dry_run_access_list: "project-gn-tryjob-access"
+    }
+    tryjob {
+      builders {
+        name: "gn/try/linux"
+      }
+      builders {
+        name: "gn/try/mac"
+      }
+      builders {
+        name: "gn/try/win"
+      }
+      retry_config {
+        single_quota: 1
+        global_quota: 2
+        failure_weight: 1
+        transient_failure_weight: 1
+        timeout_weight: 2
+      }
+    }
+  }
+}
diff --git a/infra/config/generated/cr-buildbucket.cfg b/infra/config/generated/cr-buildbucket.cfg
new file mode 100644
index 0000000..ca250c4
--- /dev/null
+++ b/infra/config/generated/cr-buildbucket.cfg
@@ -0,0 +1,134 @@
+# Auto-generated by lucicfg.
+# Do not modify manually.
+#
+# For the schema of this file, see BuildbucketCfg message:
+#   https://luci-config.appspot.com/schemas/projects:buildbucket.cfg
+
+buckets {
+  name: "ci"
+  acls {
+    group: "all"
+  }
+  acls {
+    role: SCHEDULER
+    identity: "user:luci-scheduler@appspot.gserviceaccount.com"
+  }
+  swarming {
+    builders {
+      name: "linux"
+      swarming_host: "chromium-swarm.appspot.com"
+      dimensions: "cpu:x86-64"
+      dimensions: "os:Ubuntu-16.04"
+      dimensions: "pool:luci.flex.ci"
+      recipe {
+        name: "gn"
+        cipd_package: "infra/recipe_bundles/gn.googlesource.com/gn"
+        cipd_version: "refs/heads/master"
+      }
+      execution_timeout_secs: 3600
+      service_account: "gn-ci-builder@chops-service-accounts.iam.gserviceaccount.com"
+    }
+    builders {
+      name: "mac"
+      swarming_host: "chromium-swarm.appspot.com"
+      dimensions: "cpu:x86-64"
+      dimensions: "os:Mac-10.15"
+      dimensions: "pool:luci.flex.ci"
+      recipe {
+        name: "gn"
+        cipd_package: "infra/recipe_bundles/gn.googlesource.com/gn"
+        cipd_version: "refs/heads/master"
+      }
+      execution_timeout_secs: 3600
+      caches {
+        name: "macos_sdk"
+        path: "macos_sdk"
+      }
+      service_account: "gn-ci-builder@chops-service-accounts.iam.gserviceaccount.com"
+    }
+    builders {
+      name: "win"
+      swarming_host: "chromium-swarm.appspot.com"
+      dimensions: "cpu:x86-64"
+      dimensions: "os:Windows-10"
+      dimensions: "pool:luci.flex.ci"
+      recipe {
+        name: "gn"
+        cipd_package: "infra/recipe_bundles/gn.googlesource.com/gn"
+        cipd_version: "refs/heads/master"
+      }
+      execution_timeout_secs: 3600
+      caches {
+        name: "windows_sdk"
+        path: "windows_sdk"
+      }
+      service_account: "gn-ci-builder@chops-service-accounts.iam.gserviceaccount.com"
+    }
+  }
+}
+buckets {
+  name: "try"
+  acls {
+    group: "all"
+  }
+  acls {
+    role: SCHEDULER
+    group: "project-gn-tryjob-access"
+  }
+  acls {
+    role: SCHEDULER
+    group: "service-account-cq"
+  }
+  swarming {
+    builders {
+      name: "linux"
+      swarming_host: "chromium-swarm.appspot.com"
+      dimensions: "cpu:x86-64"
+      dimensions: "os:Ubuntu-16.04"
+      dimensions: "pool:luci.flex.try"
+      recipe {
+        name: "gn"
+        cipd_package: "infra/recipe_bundles/gn.googlesource.com/gn"
+        cipd_version: "refs/heads/master"
+      }
+      execution_timeout_secs: 3600
+      service_account: "gn-try-builder@chops-service-accounts.iam.gserviceaccount.com"
+    }
+    builders {
+      name: "mac"
+      swarming_host: "chromium-swarm.appspot.com"
+      dimensions: "cpu:x86-64"
+      dimensions: "os:Mac-10.15"
+      dimensions: "pool:luci.flex.try"
+      recipe {
+        name: "gn"
+        cipd_package: "infra/recipe_bundles/gn.googlesource.com/gn"
+        cipd_version: "refs/heads/master"
+      }
+      execution_timeout_secs: 3600
+      caches {
+        name: "macos_sdk"
+        path: "macos_sdk"
+      }
+      service_account: "gn-try-builder@chops-service-accounts.iam.gserviceaccount.com"
+    }
+    builders {
+      name: "win"
+      swarming_host: "chromium-swarm.appspot.com"
+      dimensions: "cpu:x86-64"
+      dimensions: "os:Windows-10"
+      dimensions: "pool:luci.flex.try"
+      recipe {
+        name: "gn"
+        cipd_package: "infra/recipe_bundles/gn.googlesource.com/gn"
+        cipd_version: "refs/heads/master"
+      }
+      execution_timeout_secs: 3600
+      caches {
+        name: "windows_sdk"
+        path: "windows_sdk"
+      }
+      service_account: "gn-try-builder@chops-service-accounts.iam.gserviceaccount.com"
+    }
+  }
+}
diff --git a/infra/config/generated/luci-logdog.cfg b/infra/config/generated/luci-logdog.cfg
new file mode 100644
index 0000000..adc75be
--- /dev/null
+++ b/infra/config/generated/luci-logdog.cfg
@@ -0,0 +1,9 @@
+# Auto-generated by lucicfg.
+# Do not modify manually.
+#
+# For the schema of this file, see ProjectConfig message:
+#   https://luci-config.appspot.com/schemas/projects:luci-logdog.cfg
+
+reader_auth_groups: "all"
+writer_auth_groups: "luci-logdog-chromium-writers"
+archive_gs_bucket: "chromium-luci-logdog"
diff --git a/infra/config/generated/luci-milo.cfg b/infra/config/generated/luci-milo.cfg
new file mode 100644
index 0000000..a649d0d
--- /dev/null
+++ b/infra/config/generated/luci-milo.cfg
@@ -0,0 +1,27 @@
+# Auto-generated by lucicfg.
+# Do not modify manually.
+#
+# For the schema of this file, see Project message:
+#   https://luci-config.appspot.com/schemas/projects:luci-milo.cfg
+
+consoles {
+  id: "gn"
+  name: "gn"
+  repo_url: "https://chromium.googlesource.com/external/github.com/llvm/llvm-project"
+  refs: "regexp:refs/heads/master"
+  manifest_name: "REVISION"
+  builders {
+    name: "buildbucket/luci.gn.ci/linux"
+    short_name: "linux"
+  }
+  builders {
+    name: "buildbucket/luci.gn.ci/mac"
+    short_name: "mac"
+  }
+  builders {
+    name: "buildbucket/luci.gn.ci/win"
+    short_name: "win"
+  }
+  favicon_url: "https://storage.googleapis.com/chrome-infra-public/logo/favicon.ico"
+}
+logo_url: "https://storage.googleapis.com/chrome-infra-public/logo/gn-logo.png"
diff --git a/infra/config/generated/luci-scheduler.cfg b/infra/config/generated/luci-scheduler.cfg
new file mode 100644
index 0000000..87b7d69
--- /dev/null
+++ b/infra/config/generated/luci-scheduler.cfg
@@ -0,0 +1,54 @@
+# Auto-generated by lucicfg.
+# Do not modify manually.
+#
+# For the schema of this file, see ProjectConfig message:
+#   https://luci-config.appspot.com/schemas/projects:luci-scheduler.cfg
+
+job {
+  id: "linux"
+  acl_sets: "ci"
+  buildbucket {
+    server: "cr-buildbucket.appspot.com"
+    bucket: "luci.gn.ci"
+    builder: "linux"
+  }
+}
+job {
+  id: "mac"
+  acl_sets: "ci"
+  buildbucket {
+    server: "cr-buildbucket.appspot.com"
+    bucket: "luci.gn.ci"
+    builder: "mac"
+  }
+}
+job {
+  id: "win"
+  acl_sets: "ci"
+  buildbucket {
+    server: "cr-buildbucket.appspot.com"
+    bucket: "luci.gn.ci"
+    builder: "win"
+  }
+}
+trigger {
+  id: "gn-trigger"
+  acl_sets: "ci"
+  triggers: "linux"
+  triggers: "mac"
+  triggers: "win"
+  gitiles {
+    repo: "https://gn.googlesource.com/gn"
+    refs: "regexp:refs/heads/master"
+  }
+}
+acl_sets {
+  name: "ci"
+  acls {
+    role: OWNER
+    granted_to: "group:group:project-gn-committers"
+  }
+  acls {
+    granted_to: "group:all"
+  }
+}
diff --git a/infra/config/generated/project.cfg b/infra/config/generated/project.cfg
new file mode 100644
index 0000000..0ac6951
--- /dev/null
+++ b/infra/config/generated/project.cfg
@@ -0,0 +1,8 @@
+# Auto-generated by lucicfg.
+# Do not modify manually.
+#
+# For the schema of this file, see ProjectCfg message:
+#   https://luci-config.appspot.com/schemas/projects:project.cfg
+
+name: "gn"
+access: "group:all"
diff --git a/infra/config/main.star b/infra/config/main.star
new file mode 100644
index 0000000..40b628b
--- /dev/null
+++ b/infra/config/main.star
@@ -0,0 +1,144 @@
+#!/usr/bin/env lucicfg
+
+lucicfg.config(
+    config_dir = "generated",
+    tracked_files = [
+        "commit-queue.cfg",
+        "cr-buildbucket.cfg",
+        "project.cfg",
+        "luci-logdog.cfg",
+        "luci-milo.cfg",
+        "luci-scheduler.cfg",
+    ],
+    fail_on_warnings = True,
+)
+
+luci.project(
+    name = "gn",
+    buildbucket = "cr-buildbucket.appspot.com",
+    logdog = "luci-logdog",
+    milo = "luci-milo",
+    scheduler = "luci-scheduler",
+    swarming = "chromium-swarm.appspot.com",
+    acls = [
+        acl.entry(
+            [
+                acl.BUILDBUCKET_READER,
+                acl.LOGDOG_READER,
+                acl.PROJECT_CONFIGS_READER,
+                acl.SCHEDULER_READER,
+            ],
+            groups = ["all"],
+        ),
+        acl.entry([acl.SCHEDULER_OWNER], groups = ["group:project-gn-committers"]),
+        acl.entry([acl.LOGDOG_WRITER], groups = ["luci-logdog-chromium-writers"]),
+    ],
+)
+
+def builder(name, bucket, os, caches = None, triggered_by = None):
+    luci.builder(
+        name = name,
+        bucket = bucket,
+        executable = luci.recipe(
+            name = "gn",
+            cipd_package = "infra/recipe_bundles/gn.googlesource.com/gn",
+            cipd_version = "refs/heads/master",
+        ),
+        caches = caches,
+        service_account = "gn-%s-builder@chops-service-accounts.iam.gserviceaccount.com" % bucket,
+        execution_timeout = 1 * time.hour,
+        dimensions = {"cpu": "x86-64", "os": os, "pool": "luci.flex.%s" % bucket},
+        triggered_by = triggered_by,
+    )
+
+luci.logdog(
+    gs_bucket = "chromium-luci-logdog",
+)
+
+luci.milo(
+    logo = "https://storage.googleapis.com/chrome-infra-public/logo/gn-logo.png",
+)
+
+luci.console_view(
+    name = "gn",
+    title = "gn",
+    repo = "https://chromium.googlesource.com/external/github.com/llvm/llvm-project",
+    refs = ["refs/heads/master"],
+    favicon = "https://storage.googleapis.com/chrome-infra-public/logo/favicon.ico",
+)
+
+luci.gitiles_poller(
+    name = "gn-trigger",
+    bucket = "ci",
+    repo = "https://gn.googlesource.com/gn",
+    refs = ["refs/heads/master"],
+)
+
+luci.bucket(name = "ci", acls = [
+    acl.entry(
+        [acl.BUILDBUCKET_TRIGGERER],
+        users = [
+            "luci-scheduler@appspot.gserviceaccount.com",
+        ],
+    ),
+])
+
+def ci_builder(name, os, caches = None):
+    builder(name, "ci", os, caches, triggered_by = ["gn-trigger"])
+    luci.console_view_entry(
+        console_view = "gn",
+        builder = "ci/" + name,
+        short_name = name,
+    )
+
+ci_builder("linux", "Ubuntu-16.04")
+ci_builder("mac", "Mac-10.15", caches = [swarming.cache("macos_sdk")])
+ci_builder("win", "Windows-10", caches = [swarming.cache("windows_sdk")])
+
+luci.cq(
+    submit_max_burst = 4,
+    submit_burst_delay = 8 * time.minute,
+)
+
+luci.cq_group(
+    name = "gn",
+    watch = cq.refset(
+        repo = "https://gn.googlesource.com/gn",
+        refs = ["refs/heads/master"],
+    ),
+    acls = [
+        acl.entry(
+            [acl.CQ_COMMITTER],
+            groups = ["project-gn-committers"],
+        ),
+        acl.entry(
+            [acl.CQ_DRY_RUNNER],
+            groups = ["project-gn-tryjob-access"],
+        ),
+    ],
+    retry_config = cq.retry_config(
+        single_quota = 1,
+        global_quota = 2,
+        failure_weight = 1,
+        transient_failure_weight = 1,
+        timeout_weight = 2,
+    ),
+)
+
+luci.bucket(name = "try", acls = [
+    acl.entry(
+        [acl.BUILDBUCKET_TRIGGERER],
+        groups = ["project-gn-tryjob-access", "service-account-cq"],
+    ),
+])
+
+def try_builder(name, os, caches = None):
+    builder(name, "try", os, caches)
+    luci.cq_tryjob_verifier(
+        builder = "try/" + name,
+        cq_group = "gn",
+    )
+
+try_builder("linux", "Ubuntu-16.04")
+try_builder("mac", "Mac-10.15", caches = [swarming.cache("macos_sdk")])
+try_builder("win", "Windows-10", caches = [swarming.cache("windows_sdk")])