Set up recipe and various configs for git-repo
For running presubmit tests on https://gerrit.googlesource.com/git-repo.
Google-Bug-Id: b/266734831
Change-Id: Id077d2e827ee5de24d68cab82759d3a54a316074
diff --git a/generated/commit-queue.cfg b/generated/commit-queue.cfg
index 59baa0f..b659916 100644
--- a/generated/commit-queue.cfg
+++ b/generated/commit-queue.cfg
@@ -37,6 +37,38 @@
}
}
config_groups {
+ name: "git-repo_repo"
+ gerrit {
+ url: "https://gerrit-review.googlesource.com"
+ projects {
+ name: "git-repo"
+ ref_regexp: "refs/heads/.+"
+ }
+ }
+ verifiers {
+ gerrit_cq_ability {
+ committer_list: "googlers"
+ dry_run_access_list: "all"
+ new_patchset_run_access_list: "all"
+ }
+ tryjob {
+ builders {
+ name: "gerrit/try/Verify git-repo CL"
+ mode_allowlist: "DRY_RUN"
+ mode_allowlist: "FULL_RUN"
+ mode_allowlist: "NEW_PATCHSET_RUN"
+ }
+ retry_config {
+ single_quota: 1
+ global_quota: 2
+ failure_weight: 100
+ transient_failure_weight: 1
+ timeout_weight: 100
+ }
+ }
+ }
+}
+config_groups {
name: "luci-test_repo"
gerrit {
url: "https://gerrit-review.googlesource.com"
diff --git a/generated/cr-buildbucket.cfg b/generated/cr-buildbucket.cfg
index 008c696..d28d78b 100644
--- a/generated/cr-buildbucket.cfg
+++ b/generated/cr-buildbucket.cfg
@@ -35,6 +35,27 @@
}
}
builders {
+ name: "Verify git-repo CL"
+ swarming_host: "chromium-swarm.appspot.com"
+ dimensions: "cpu:x86-64"
+ dimensions: "os:Ubuntu"
+ dimensions: "pool:luci.gerrit.try"
+ exe {
+ cipd_package: "infra/recipe_bundles/gerrit.googlesource.com/luci-config"
+ cipd_version: "refs/heads/main"
+ cmd: "luciexe"
+ }
+ properties:
+ '{'
+ ' "recipe": "git-repo"'
+ '}'
+ service_account: "gerrit-luci-try-builder@gerritcodereview-ci.iam.gserviceaccount.com"
+ experiments {
+ key: "luci.recipes.use_python3"
+ value: 100
+ }
+ }
+ builders {
name: "Verify luci-test CL"
swarming_host: "chromium-swarm.appspot.com"
dimensions: "cpu:x86-64"
diff --git a/generated/project.cfg b/generated/project.cfg
index 511f23f..4c4aa57 100644
--- a/generated/project.cfg
+++ b/generated/project.cfg
@@ -7,7 +7,7 @@
name: "gerrit"
access: "group:all"
lucicfg {
- version: "1.35.2"
+ version: "1.37.0"
package_dir: ".."
config_dir: "generated"
entry_point: "main.star"
diff --git a/generated/realms.cfg b/generated/realms.cfg
index 93b9117..102f2ad 100644
--- a/generated/realms.cfg
+++ b/generated/realms.cfg
@@ -53,4 +53,8 @@
role: "role/buildbucket.builderServiceAccount"
principals: "user:gerrit-luci-try-builder@gerritcodereview-ci.iam.gserviceaccount.com"
}
+ bindings {
+ role: "role/swarming.taskTriggerer"
+ principals: "group:chrome-ops-source"
+ }
}
diff --git a/main.star b/main.star
index 37680a6..5ff5279 100755
--- a/main.star
+++ b/main.star
@@ -117,4 +117,5 @@
# Per-repo configurations
exec("//repos/gerrit.star")
+exec("//repos/git-repo.star")
exec("//repos/luci-test.star")
\ No newline at end of file
diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md
index 862ade3..8563f24 100644
--- a/recipes/README.recipes.md
+++ b/recipes/README.recipes.md
@@ -7,6 +7,7 @@
**[Recipes](#Recipes)**
* [gerrit](#recipes-gerrit) (Python3 ✅)
+ * [git-repo](#recipes-git-repo) (Python3 ✅)
* [luci-test](#recipes-luci-test) (Python3 ✅)
* [zip:examples/full](#recipes-zip_examples_full) (Python3 ✅)
## Recipe Modules
@@ -102,6 +103,11 @@
PYTHON_VERSION_COMPATIBILITY: PY3
— **def [RunSteps](/recipes/recipes/gerrit.py#23)(api):**
+### *recipes* / [git-repo](/recipes/recipes/git-repo.py)
+
+PYTHON_VERSION_COMPATIBILITY: PY3
+
+— **def [RunSteps](/recipes/recipes/git-repo.py#21)(api):**
### *recipes* / [luci-test](/recipes/recipes/luci-test.py)
[DEPS](/recipes/recipes/luci-test.py#7): [depot\_tools/bot\_update][depot_tools/recipe_modules/bot_update], [depot\_tools/gclient][depot_tools/recipe_modules/gclient], [depot\_tools/gsutil][depot_tools/recipe_modules/gsutil], [zip](#recipe_modules-zip), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/file][recipe_engine/recipe_modules/file], [recipe\_engine/nodejs][recipe_engine/recipe_modules/nodejs], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/step][recipe_engine/recipe_modules/step]
diff --git a/recipes/recipes/git-repo.expected/basic.json b/recipes/recipes/git-repo.expected/basic.json
new file mode 100644
index 0000000..b6042b6
--- /dev/null
+++ b/recipes/recipes/git-repo.expected/basic.json
@@ -0,0 +1,5 @@
+[
+ {
+ "name": "$result"
+ }
+]
\ No newline at end of file
diff --git a/recipes/recipes/git-repo.py b/recipes/recipes/git-repo.py
new file mode 100644
index 0000000..ce868dd
--- /dev/null
+++ b/recipes/recipes/git-repo.py
@@ -0,0 +1,26 @@
+# Copyright (C) 2023 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+DEPS = []
+
+PYTHON_VERSION_COMPATIBILITY = 'PY3'
+
+
+# TODO(b/266734831): Implement recipe and tests.
+def RunSteps(api):
+ pass
+
+
+def GenTests(api):
+ yield api.test('basic')
diff --git a/repos/git-repo.star b/repos/git-repo.star
new file mode 100644
index 0000000..6358e95
--- /dev/null
+++ b/repos/git-repo.star
@@ -0,0 +1,49 @@
+# This is configuration for LUCI for the git-repo repo
+# https://gerrit.googlesource.com/git-repo
+
+luci.binding(
+ realm = "try",
+ roles = "role/swarming.taskTriggerer",
+ groups = "chrome-ops-source",
+)
+
+luci.builder(
+ name = "Verify git-repo CL",
+ bucket = "try",
+ executable = luci.recipe(
+ name = "git-repo",
+ ),
+ service_account = "gerrit-luci-try-builder@gerritcodereview-ci.iam.gserviceaccount.com",
+ dimensions = {
+ "os": "Ubuntu",
+ "cpu": "x86-64",
+ "pool": "luci.gerrit.try",
+ },
+)
+
+luci.cq_group(
+ name = "git-repo_repo",
+ acls = [
+ acl.entry(
+ roles = [acl.CQ_DRY_RUNNER, acl.CQ_NEW_PATCHSET_RUN_TRIGGERER],
+ groups = "all",
+ ),
+ acl.entry(
+ acl.CQ_COMMITTER,
+ groups = "googlers",
+ ),
+ ],
+ watch = cq.refset(
+ repo = "https://gerrit.googlesource.com/git-repo",
+ refs = ["refs/heads/.+"],
+ ),
+)
+
+luci.cq_tryjob_verifier(
+ builder = "try/Verify git-repo CL",
+ cq_group = "git-repo_repo",
+ # Add NEW_PATCHSET_RUN to the defaults DRY_RUN and FULL_RUN
+ mode_allowlist = [
+ cq.MODE_DRY_RUN, cq.MODE_FULL_RUN, cq.MODE_NEW_PATCHSET_RUN
+ ],
+)
\ No newline at end of file