Use recipes from release candidate branches.
This is to ensure we are using the correct version of recipes for builds
in the release candidate branches.
Bug: https://github.com/flutter/flutter/issues/114943
Change-Id: I2a032a8587b2399bc62f3374867e9d8097e99627
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/36263
Reviewed-by: Ricardo Amador <ricardoamador@google.com>
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
diff --git a/recipe_modules/repo_util/api.py b/recipe_modules/repo_util/api.py
index 9a40b57..eaf1810 100644
--- a/recipe_modules/repo_util/api.py
+++ b/recipe_modules/repo_util/api.py
@@ -423,3 +423,10 @@
if branch.startswith('flutter-'):
return True
return False
+
+ def release_candidate_branch(self, checkout_path):
+ """Returns the first branch that starts with "flutter-"."""
+ commit_branches = self.current_commit_branches(checkout_path)
+ for branch in commit_branches:
+ if branch.startswith('flutter-'):
+ return branch
diff --git a/recipe_modules/repo_util/examples/full.expected/basic.json b/recipe_modules/repo_util/examples/full.expected/basic.json
index 74a95a4..9ff6ce2 100644
--- a/recipe_modules/repo_util/examples/full.expected/basic.json
+++ b/recipe_modules/repo_util/examples/full.expected/basic.json
@@ -65,6 +65,38 @@
},
{
"cmd": [],
+ "name": "Identify branches (3)"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "Identify branches (3).git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "Identify branches (3).git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
"name": "Checkout flutter/flutter"
},
{
@@ -629,38 +661,6 @@
},
{
"cmd": [],
- "name": "Identify branches (3)"
- },
- {
- "cmd": [
- "git",
- "rev-parse",
- "HEAD"
- ],
- "cwd": "[START_DIR]/flutter/flutter",
- "infra_step": true,
- "name": "Identify branches (3).git rev-parse",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [
- "git",
- "branch",
- "-a",
- "--contains",
- "12345abcde12345abcde12345abcde12345abcde"
- ],
- "cwd": "[START_DIR]/flutter/flutter",
- "infra_step": true,
- "name": "Identify branches (3).git branch",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [],
"name": "Identify branches (4)"
},
{
@@ -669,7 +669,7 @@
"rev-parse",
"HEAD"
],
- "cwd": "[START_DIR]/flutter",
+ "cwd": "[START_DIR]/flutter/flutter",
"infra_step": true,
"name": "Identify branches (4).git rev-parse",
"~followup_annotations": [
@@ -684,7 +684,7 @@
"--contains",
"12345abcde12345abcde12345abcde12345abcde"
],
- "cwd": "[START_DIR]/flutter",
+ "cwd": "[START_DIR]/flutter/flutter",
"infra_step": true,
"name": "Identify branches (4).git branch",
"~followup_annotations": [
@@ -692,16 +692,6 @@
]
},
{
- "cmd": [
- "git",
- "rev-parse",
- "HEAD"
- ],
- "cwd": "[START_DIR]/flutter",
- "infra_step": true,
- "name": "git rev-parse"
- },
- {
"cmd": [],
"name": "Identify branches (5)"
},
@@ -735,6 +725,48 @@
},
{
"cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "git rev-parse"
+ },
+ {
+ "cmd": [],
+ "name": "Identify branches (6)"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "Identify branches (6).git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "Identify branches (6).git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
"vpython3",
"-u",
"RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
diff --git a/recipe_modules/repo_util/examples/full.expected/bot_update.json b/recipe_modules/repo_util/examples/full.expected/bot_update.json
index aa27bf9..3cefdd9 100644
--- a/recipe_modules/repo_util/examples/full.expected/bot_update.json
+++ b/recipe_modules/repo_util/examples/full.expected/bot_update.json
@@ -33,6 +33,38 @@
},
{
"cmd": [],
+ "name": "Identify branches (2)"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "Identify branches (2).git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "Identify branches (2).git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
"name": "Checkout flutter/flutter"
},
{
diff --git a/recipe_modules/repo_util/examples/full.expected/failed_flutter_environment.json b/recipe_modules/repo_util/examples/full.expected/failed_flutter_environment.json
index 6ed758f..af3deec 100644
--- a/recipe_modules/repo_util/examples/full.expected/failed_flutter_environment.json
+++ b/recipe_modules/repo_util/examples/full.expected/failed_flutter_environment.json
@@ -33,6 +33,38 @@
},
{
"cmd": [],
+ "name": "Identify branches (2)"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "Identify branches (2).git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "Identify branches (2).git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
"name": "Checkout flutter/flutter"
},
{
diff --git a/recipe_modules/repo_util/examples/full.expected/first_bot_update_failed.json b/recipe_modules/repo_util/examples/full.expected/first_bot_update_failed.json
index da8bb2d..7cf482f 100644
--- a/recipe_modules/repo_util/examples/full.expected/first_bot_update_failed.json
+++ b/recipe_modules/repo_util/examples/full.expected/first_bot_update_failed.json
@@ -33,6 +33,38 @@
},
{
"cmd": [],
+ "name": "Identify branches (2)"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "Identify branches (2).git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "Identify branches (2).git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
"name": "Checkout flutter/flutter"
},
{
diff --git a/recipe_modules/repo_util/examples/full.expected/first_bot_update_revision_not_found.json b/recipe_modules/repo_util/examples/full.expected/first_bot_update_revision_not_found.json
index c1f6632..68d43a7 100644
--- a/recipe_modules/repo_util/examples/full.expected/first_bot_update_revision_not_found.json
+++ b/recipe_modules/repo_util/examples/full.expected/first_bot_update_revision_not_found.json
@@ -33,6 +33,38 @@
},
{
"cmd": [],
+ "name": "Identify branches (2)"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "Identify branches (2).git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "Identify branches (2).git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
"name": "Checkout flutter/flutter"
},
{
diff --git a/recipe_modules/repo_util/examples/full.expected/monorepo.json b/recipe_modules/repo_util/examples/full.expected/monorepo.json
index 45ef3be..894479e 100644
--- a/recipe_modules/repo_util/examples/full.expected/monorepo.json
+++ b/recipe_modules/repo_util/examples/full.expected/monorepo.json
@@ -57,6 +57,62 @@
},
{
"cmd": [],
+ "name": "Identify branches (2)"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches (2).git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches (2).git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
"name": "Checkout flutter/flutter"
},
{
diff --git a/recipe_modules/repo_util/examples/full.expected/monorepo_first_bot_update_failed.json b/recipe_modules/repo_util/examples/full.expected/monorepo_first_bot_update_failed.json
index b563b55..a32f325 100644
--- a/recipe_modules/repo_util/examples/full.expected/monorepo_first_bot_update_failed.json
+++ b/recipe_modules/repo_util/examples/full.expected/monorepo_first_bot_update_failed.json
@@ -57,6 +57,62 @@
},
{
"cmd": [],
+ "name": "Identify branches (2)"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches (2).git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches (2).git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
"name": "Checkout flutter/flutter"
},
{
diff --git a/recipe_modules/repo_util/examples/full.expected/monorepo_release.json b/recipe_modules/repo_util/examples/full.expected/monorepo_release.json
index 86d3ddd..2e2170a 100644
--- a/recipe_modules/repo_util/examples/full.expected/monorepo_release.json
+++ b/recipe_modules/repo_util/examples/full.expected/monorepo_release.json
@@ -113,6 +113,62 @@
},
{
"cmd": [],
+ "name": "Identify branches (3)"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches (3).git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches (3).git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
"name": "Checkout flutter/flutter"
},
{
@@ -1108,62 +1164,6 @@
},
{
"cmd": [],
- "name": "Identify branches (3)"
- },
- {
- "cmd": [
- "git",
- "rev-parse",
- "HEAD"
- ],
- "cwd": "[START_DIR]/flutter/flutter",
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:ci"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "Identify branches (3).git rev-parse",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [
- "git",
- "branch",
- "-a",
- "--contains",
- "12345abcde12345abcde12345abcde12345abcde"
- ],
- "cwd": "[START_DIR]/flutter/flutter",
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:ci"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "Identify branches (3).git branch",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [],
"name": "Identify branches (4)"
},
{
@@ -1172,7 +1172,7 @@
"rev-parse",
"HEAD"
],
- "cwd": "[START_DIR]/flutter",
+ "cwd": "[START_DIR]/flutter/flutter",
"infra_step": true,
"luci_context": {
"realm": {
@@ -1199,7 +1199,7 @@
"--contains",
"12345abcde12345abcde12345abcde12345abcde"
],
- "cwd": "[START_DIR]/flutter",
+ "cwd": "[START_DIR]/flutter/flutter",
"infra_step": true,
"luci_context": {
"realm": {
@@ -1219,28 +1219,6 @@
]
},
{
- "cmd": [
- "git",
- "rev-parse",
- "HEAD"
- ],
- "cwd": "[START_DIR]/flutter",
- "infra_step": true,
- "luci_context": {
- "realm": {
- "name": "project:ci"
- },
- "resultdb": {
- "current_invocation": {
- "name": "invocations/build:8945511751514863184",
- "update_token": "token"
- },
- "hostname": "rdbhost"
- }
- },
- "name": "git rev-parse"
- },
- {
"cmd": [],
"name": "Identify branches (5)"
},
@@ -1298,6 +1276,84 @@
},
{
"cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "git rev-parse"
+ },
+ {
+ "cmd": [],
+ "name": "Identify branches (6)"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches (6).git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches (6).git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
"vpython3",
"-u",
"RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
diff --git a/recipe_modules/repo_util/examples/full.expected/monorepo_wrong_host.json b/recipe_modules/repo_util/examples/full.expected/monorepo_wrong_host.json
index e284c1b..b7d221f 100644
--- a/recipe_modules/repo_util/examples/full.expected/monorepo_wrong_host.json
+++ b/recipe_modules/repo_util/examples/full.expected/monorepo_wrong_host.json
@@ -57,6 +57,62 @@
},
{
"cmd": [],
+ "name": "Identify branches (2)"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches (2).git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "project:ci"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches (2).git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
"name": "Checkout flutter/flutter"
},
{
@@ -1107,7 +1163,7 @@
"The recipe has crashed at point 'Uncaught exception'!",
"",
"Traceback (most recent call last):",
- " File \"RECIPE_REPO[flutter]/recipe_modules/repo_util/examples/full.py\", line 46, in RunSteps",
+ " File \"RECIPE_REPO[flutter]/recipe_modules/repo_util/examples/full.py\", line 47, in RunSteps",
" api.repo_util.monorepo_checkout(checkout_path, {}, {})",
" File \"RECIPE_REPO[flutter]/recipe_modules/repo_util/api.py\", line 144, in monorepo_checkout",
" raise ValueError(",
diff --git a/recipe_modules/repo_util/examples/full.py b/recipe_modules/repo_util/examples/full.py
index 4dd6b6f..877066b 100644
--- a/recipe_modules/repo_util/examples/full.py
+++ b/recipe_modules/repo_util/examples/full.py
@@ -18,6 +18,7 @@
flutter_checkout_path = api.path['start_dir'].join('flutter')
api.repo_util.get_branch(flutter_checkout_path)
api.repo_util.is_release_candidate_branch(flutter_checkout_path)
+ api.repo_util.release_candidate_branch(flutter_checkout_path)
api.repo_util.checkout(
'flutter', flutter_checkout_path, ref='refs/heads/master'
)
diff --git a/recipe_modules/shard_util_v2/api.py b/recipe_modules/shard_util_v2/api.py
index bdfca30..04f3394 100644
--- a/recipe_modules/shard_util_v2/api.py
+++ b/recipe_modules/shard_util_v2/api.py
@@ -104,16 +104,18 @@
"""
return collections.OrderedDict((k, v) for k, v in struct.items())
- def schedule_builds(self, builds, presentation):
+ def schedule_builds(self, builds, presentation, branch='main'):
"""Schedule builds using the builds configurations.
Args:
builds(dict): The build configurations to be passed to BuildBucket or led.
presentation(StepPresentation): The step object used to add links and/or logs.
+ branch(String): The current branch name.
Returns:
A dictionary with a long build_id as key and SubbuildResult as value.
"""
- return self.schedule(builds, 'engine_v2/builder', presentation)
+ return self.schedule(builds, 'engine_v2/builder', presentation,
+ branch=branch)
def schedule_tests(self, tests, build_results, presentation):
"""Schedule tests using build_results for dependencies.
@@ -140,13 +142,14 @@
updated_tests.append(test)
return self.schedule(updated_tests, 'engine_v2/tester', presentation)
- def schedule(self, builds, recipe_name, presentation):
+ def schedule(self, builds, recipe_name, presentation, branch='main'):
"""Schedules one subbuild per build configuration.
Args:
builds(dict): The build/test configurations to be passed to BuildBucket or led.
recipe_name(str): A string with the recipe name to use.
presentation(StepPresentation): The step object used to add links and/or logs.
+ branch(String): The current branch name.
Returns:
A dictionary with a long build_id as key and SubbuildResult as value.
"""
@@ -154,7 +157,7 @@
if self.m.led.launched_by_led:
builds = self._schedule_with_led(build_list, recipe_name)
else:
- builds = self._schedule_with_bb(build_list, recipe_name)
+ builds = self._schedule_with_bb(build_list, recipe_name, branch=branch)
return builds
def _schedule_with_led(self, builds, recipe_name):
@@ -185,9 +188,6 @@
platform_name = build.get('platform') or PLATFORM_TO_NAME.get(
self.m.platform.name
)
- #for d in drone_dimensions:
- # k, v = d.split('=')
- # task_dimensions.append(common_pb2.RequestedDimension(key=k, value=v))
# Override recipe.
drone_properties['recipe'] = recipe_name
@@ -228,12 +228,13 @@
)
return results
- def _schedule_with_bb(self, builds, recipe_name):
+ def _schedule_with_bb(self, builds, recipe_name, branch='main'):
"""Schedules builds using builbbucket.
Args:
builds(dict): The build/test configurations to be passed to BuildBucket or led.
recipe_name(str): A string with the recipe name to use.
+ branch(String): The current branch name.
Returns:
A dictionary with a long build_id as key and SubbuildResult as value.
"""
@@ -285,7 +286,8 @@
# situation less unlikely.
# https://github.com/flutter/flutter/issues/59169.
priority=25,
- exe_cipd_version=self.m.properties.get('exe_cipd_version', 'refs/heads/main')
+ exe_cipd_version=self.m.properties.get('exe_cipd_version',
+ 'refs/heads/%s' % branch)
)
# Increase timeout if no_goma, since the runtime is going to
# be much longer.
diff --git a/recipes/engine_v2/engine_v2.expected/config_from_file.json b/recipes/engine_v2/engine_v2.expected/config_from_file.json
index 11eac2a..b1723f8 100644
--- a/recipes/engine_v2/engine_v2.expected/config_from_file.json
+++ b/recipes/engine_v2/engine_v2.expected/config_from_file.json
@@ -251,6 +251,62 @@
},
{
"cmd": [],
+ "name": "Identify branches"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/engine",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "proj:try"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches.git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/engine",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "proj:try"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches.git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
"name": "launch builds"
},
{
diff --git a/recipes/engine_v2/engine_v2.expected/monorepo_config_file.json b/recipes/engine_v2/engine_v2.expected/monorepo_config_file.json
index 0feaf3a..eb579bb 100644
--- a/recipes/engine_v2/engine_v2.expected/monorepo_config_file.json
+++ b/recipes/engine_v2/engine_v2.expected/monorepo_config_file.json
@@ -244,6 +244,118 @@
},
{
"cmd": [],
+ "name": "Identify branches"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/monorepo",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "dart:ci.sandbox"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches.git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/monorepo",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "dart:ci.sandbox"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches.git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "Identify branches (2)"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/monorepo",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "dart:ci.sandbox"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches (2).git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/monorepo",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "dart:ci.sandbox"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches (2).git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
"name": "launch builds"
},
{
@@ -267,7 +379,7 @@
}
},
"name": "launch builds.schedule",
- "stdin": "{\"requests\": [{\"scheduleBuild\": {\"builder\": {\"bucket\": \"ci.sandbox\", \"builder\": \"Linux Engine Drone\", \"project\": \"dart\"}, \"exe\": {\"cipdVersion\": \"refs/heads/main\"}, \"experimental\": \"NO\", \"experiments\": {\"luci.buildbucket.parent_tracking\": false}, \"fields\": \"builder,createTime,createdBy,critical,endTime,id,infra,input,number,output,startTime,status,updateTime\", \"gitilesCommit\": {\"host\": \"dart.googlesource.com\", \"id\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"project\": \"monorepo\", \"ref\": \"refs/heads/main\"}, \"priority\": 25, \"properties\": {\"build\": {\"generators\": [{\"name\": \"generator1\", \"script\": \"script1.sh\"}], \"gn\": [\"--ios\"], \"name\": \"ios_debug\", \"ninja\": {\"config\": \"ios_debug\", \"targets\": []}}, \"config_name\": \"config_name\", \"recipe\": \"engine_v2/builder\"}, \"requestId\": \"8945511751514863184-00000000-0000-0000-0000-000000001337\", \"swarming\": {\"parentRunId\": \"fake-task-id\"}, \"tags\": [{\"key\": \"parent_buildbucket_id\", \"value\": \"8945511751514863184\"}, {\"key\": \"user_agent\", \"value\": \"recipe\"}]}}]}",
+ "stdin": "{\"requests\": [{\"scheduleBuild\": {\"builder\": {\"bucket\": \"ci.sandbox\", \"builder\": \"Linux Engine Drone\", \"project\": \"dart\"}, \"exe\": {\"cipdVersion\": \"refs/heads/None\"}, \"experimental\": \"NO\", \"experiments\": {\"luci.buildbucket.parent_tracking\": false}, \"fields\": \"builder,createTime,createdBy,critical,endTime,id,infra,input,number,output,startTime,status,updateTime\", \"gitilesCommit\": {\"host\": \"dart.googlesource.com\", \"id\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"project\": \"monorepo\", \"ref\": \"refs/heads/main\"}, \"priority\": 25, \"properties\": {\"build\": {\"generators\": [{\"name\": \"generator1\", \"script\": \"script1.sh\"}], \"gn\": [\"--ios\"], \"name\": \"ios_debug\", \"ninja\": {\"config\": \"ios_debug\", \"targets\": []}}, \"config_name\": \"config_name\", \"recipe\": \"engine_v2/builder\"}, \"requestId\": \"8945511751514863184-00000000-0000-0000-0000-000000001337\", \"swarming\": {\"parentRunId\": \"fake-task-id\"}, \"tags\": [{\"key\": \"parent_buildbucket_id\", \"value\": \"8945511751514863184\"}, {\"key\": \"user_agent\", \"value\": \"recipe\"}]}}]}",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@",
"@@@STEP_LOG_LINE@json.output@{@@@",
@@ -295,7 +407,7 @@
"@@@STEP_LOG_LINE@request@ \"project\": \"dart\"@@@",
"@@@STEP_LOG_LINE@request@ }, @@@",
"@@@STEP_LOG_LINE@request@ \"exe\": {@@@",
- "@@@STEP_LOG_LINE@request@ \"cipdVersion\": \"refs/heads/main\"@@@",
+ "@@@STEP_LOG_LINE@request@ \"cipdVersion\": \"refs/heads/None\"@@@",
"@@@STEP_LOG_LINE@request@ }, @@@",
"@@@STEP_LOG_LINE@request@ \"experimental\": \"NO\", @@@",
"@@@STEP_LOG_LINE@request@ \"experiments\": {@@@",
diff --git a/recipes/engine_v2/engine_v2.expected/overridden_config_from_file.json b/recipes/engine_v2/engine_v2.expected/overridden_config_from_file.json
index f0e4a78..d2781f3 100644
--- a/recipes/engine_v2/engine_v2.expected/overridden_config_from_file.json
+++ b/recipes/engine_v2/engine_v2.expected/overridden_config_from_file.json
@@ -233,6 +233,62 @@
},
{
"cmd": [],
+ "name": "Identify branches"
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/engine",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "proj:try"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches.git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "branch",
+ "-a",
+ "--contains",
+ "12345abcde12345abcde12345abcde12345abcde"
+ ],
+ "cwd": "[START_DIR]/engine",
+ "infra_step": true,
+ "luci_context": {
+ "realm": {
+ "name": "proj:try"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Identify branches.git branch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
"name": "launch builds"
},
{
diff --git a/recipes/engine_v2/engine_v2.py b/recipes/engine_v2/engine_v2.py
index bb63f64..a745043 100644
--- a/recipes/engine_v2/engine_v2.py
+++ b/recipes/engine_v2/engine_v2.py
@@ -55,6 +55,7 @@
tests = api.properties.get('tests')
generators = api.properties.get('generators')
archives = api.properties.get('archives')
+ checkout_path = None
if config_name:
# Read builds configuration from repository under test.
if api.buildbucket.gitiles_commit.project == 'monorepo':
@@ -92,8 +93,12 @@
if archives is None:
archives = []
+ current_branch = 'main'
+ if checkout_path and api.repo_util.is_release_candidate_branch(checkout_path):
+ current_branch = api.repo_util.release_candidate_branch(checkout_path)
with api.step.nest('launch builds') as presentation:
- tasks = api.shard_util_v2.schedule_builds(builds, presentation)
+ tasks = api.shard_util_v2.schedule_builds(builds, presentation,
+ branch=current_branch)
with api.step.nest('collect builds') as presentation:
build_results = api.shard_util_v2.collect(tasks, presentation)
@@ -357,4 +362,8 @@
'Read build config file',
api.file.read_json({'builds': builds})
),
+ api.step_data(
+ 'Identify branches.git branch',
+ stdout=api.raw_io.output_text('branch1\nbranch2\nflutter-3.2-candidate.5')
+ ),
)