Provide ref explicitly.
Most of the recipe modules have already migrated to a main branch and
they are using head/refs/main by default.
Change-Id: Ifc56b23d8c979e2703df1075acf205df63301775
Bug: https://github.com/flutter/flutter/issues/82918
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/13660
Reviewed-by: Christopher Fujino <fujino@google.com>
diff --git a/recipes/recipes.expected/ci.json b/recipes/recipes.expected/ci.json
index 3ca3d02..f5ab687 100644
--- a/recipes/recipes.expected/ci.json
+++ b/recipes/recipes.expected/ci.json
@@ -214,7 +214,7 @@
"fetch",
"--tags",
"origin",
- "main"
+ "master"
],
"cwd": "[START_DIR]/recipes",
"name": "git fetch"
diff --git a/recipes/recipes.expected/cq_try.json b/recipes/recipes.expected/cq_try.json
index 0a06b65..054d1c0 100644
--- a/recipes/recipes.expected/cq_try.json
+++ b/recipes/recipes.expected/cq_try.json
@@ -1,7 +1,7 @@
[
{
"cmd": [],
- "name": "fetch refs/heads/main"
+ "name": "fetch refs/heads/master"
},
{
"cmd": [
@@ -16,7 +16,7 @@
"[START_DIR]/recipes"
],
"infra_step": true,
- "name": "fetch refs/heads/main.makedirs",
+ "name": "fetch refs/heads/master.makedirs",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
@@ -27,7 +27,7 @@
"init"
],
"cwd": "[START_DIR]/recipes",
- "name": "fetch refs/heads/main.git init",
+ "name": "fetch refs/heads/master.git init",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
@@ -41,7 +41,7 @@
"https://flutter.googlesource.com/recipes"
],
"cwd": "[START_DIR]/recipes",
- "name": "fetch refs/heads/main.git remote",
+ "name": "fetch refs/heads/master.git remote",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
@@ -54,14 +54,14 @@
"https"
],
"cwd": "[START_DIR]/recipes",
- "name": "fetch refs/heads/main.set fetch.uriprotocols",
+ "name": "fetch refs/heads/master.set fetch.uriprotocols",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "fetch refs/heads/main.cache",
+ "name": "fetch refs/heads/master.cache",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
@@ -79,7 +79,7 @@
],
"cwd": "[START_DIR]/recipes",
"infra_step": true,
- "name": "fetch refs/heads/main.cache.write guard file",
+ "name": "fetch refs/heads/master.cache.write guard file",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@2@@@",
"@@@STEP_LOG_END@.GUARD_FILE@@@"
@@ -99,7 +99,7 @@
],
"cwd": "[START_DIR]/recipes",
"infra_step": true,
- "name": "fetch refs/heads/main.cache.makedirs",
+ "name": "fetch refs/heads/master.cache.makedirs",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@2@@@"
]
@@ -111,7 +111,7 @@
"--bare"
],
"cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
- "name": "fetch refs/heads/main.cache.git init",
+ "name": "fetch refs/heads/master.cache.git init",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@2@@@"
]
@@ -124,7 +124,7 @@
"https://flutter.googlesource.com/recipes"
],
"cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
- "name": "fetch refs/heads/main.cache.remote set-url",
+ "name": "fetch refs/heads/master.cache.remote set-url",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@2@@@"
]
@@ -137,7 +137,7 @@
"https"
],
"cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
- "name": "fetch refs/heads/main.cache.set fetch.uriprotocols",
+ "name": "fetch refs/heads/master.cache.set fetch.uriprotocols",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@2@@@"
]
@@ -152,7 +152,7 @@
"\\+refs/heads/\\*:.*"
],
"cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
- "name": "fetch refs/heads/main.cache.replace fetch configs",
+ "name": "fetch refs/heads/master.cache.replace fetch configs",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@2@@@"
]
@@ -166,7 +166,7 @@
"origin"
],
"cwd": "[CACHE]/git/flutter.googlesource.com-recipes",
- "name": "fetch refs/heads/main.cache.git fetch",
+ "name": "fetch refs/heads/master.cache.git fetch",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@2@@@"
]
@@ -185,7 +185,7 @@
],
"cwd": "[START_DIR]/recipes",
"infra_step": true,
- "name": "fetch refs/heads/main.cache.makedirs object/info",
+ "name": "fetch refs/heads/master.cache.makedirs object/info",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@2@@@"
]
@@ -203,7 +203,7 @@
],
"cwd": "[START_DIR]/recipes",
"infra_step": true,
- "name": "fetch refs/heads/main.cache.alternates",
+ "name": "fetch refs/heads/master.cache.alternates",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@2@@@",
"@@@STEP_LOG_LINE@alternates@[CACHE]/git/flutter.googlesource.com-recipes/objects@@@",
@@ -222,7 +222,7 @@
],
"cwd": "[START_DIR]/recipes",
"infra_step": true,
- "name": "fetch refs/heads/main.cache.remove guard file",
+ "name": "fetch refs/heads/master.cache.remove guard file",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@2@@@"
]
@@ -233,10 +233,10 @@
"fetch",
"--tags",
"origin",
- "main"
+ "master"
],
"cwd": "[START_DIR]/recipes",
- "name": "fetch refs/heads/main.git fetch",
+ "name": "fetch refs/heads/master.git fetch",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
@@ -249,7 +249,7 @@
"FETCH_HEAD"
],
"cwd": "[START_DIR]/recipes",
- "name": "fetch refs/heads/main.git checkout",
+ "name": "fetch refs/heads/master.git checkout",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
@@ -261,7 +261,7 @@
"HEAD"
],
"cwd": "[START_DIR]/recipes",
- "name": "fetch refs/heads/main.git rev-parse",
+ "name": "fetch refs/heads/master.git rev-parse",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
@@ -275,14 +275,14 @@
"-x"
],
"cwd": "[START_DIR]/recipes",
- "name": "fetch refs/heads/main.git clean",
+ "name": "fetch refs/heads/master.git clean",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [],
- "name": "fetch refs/heads/main.submodule",
+ "name": "fetch refs/heads/master.submodule",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
@@ -294,7 +294,7 @@
"sync"
],
"cwd": "[START_DIR]/recipes",
- "name": "fetch refs/heads/main.submodule.git submodule sync",
+ "name": "fetch refs/heads/master.submodule.git submodule sync",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@2@@@"
]
@@ -307,7 +307,7 @@
"--init"
],
"cwd": "[START_DIR]/recipes",
- "name": "fetch refs/heads/main.submodule.git submodule update",
+ "name": "fetch refs/heads/master.submodule.git submodule update",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@2@@@"
]
diff --git a/recipes/recipes.py b/recipes/recipes.py
index 31a766a..9475073 100644
--- a/recipes/recipes.py
+++ b/recipes/recipes.py
@@ -1,6 +1,7 @@
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+
"""Recipe for testing recipes."""
from recipe_engine.recipe_api import Property
@@ -104,11 +105,13 @@
checkout_path = api.path['start_dir'].join('recipes')
bb_input = api.buildbucket.build.input
if bb_input.gerrit_changes:
- api.git.checkout_cl(bb_input.gerrit_changes[0], checkout_path)
+ api.git.checkout_cl(
+ bb_input.gerrit_changes[0], checkout_path, onto='refs/heads/master'
+ )
with api.context(cwd=checkout_path):
api.git('log', 'log', '--oneline', '-n', '10')
else:
- api.git.checkout(remote)
+ api.git.checkout(remote, ref='refs/heads/master')
with api.context(cwd=checkout_path):
api.git('log', 'log', '--oneline', '-n', '10')
api.recipe_testing.projects = ('flutter',)
@@ -120,23 +123,26 @@
def GenTests(api):
- yield (api.status_check.test('ci') + api.properties(unittest_only=False) +
- api.commit_queue.test_data('flutter', COMMIT_QUEUE_CFG) +
- api.recipe_testing.affected_recipes_data(['none']) +
- api.recipe_testing.build_data(
- 'flutter/try/flutter-foo', 'flutter', skip=True) +
- api.recipe_testing.build_data(
- 'flutter/try/flutter-bar', 'flutter', skip=True) +
- api.recipe_testing.build_data(
- 'flutter/try/flutter-baz', 'project', skip=True))
- yield (api.status_check.test('cq_try') + api.properties(unittest_only=False) +
- api.commit_queue.test_data('flutter', COMMIT_QUEUE_CFG) +
- api.recipe_testing.affected_recipes_data(['none']) +
- api.recipe_testing.build_data(
- 'flutter/try/flutter-foo', 'flutter', skip=True) +
- api.recipe_testing.build_data(
- 'flutter/try/flutter-bar', 'flutter', skip=True) +
- api.recipe_testing.build_data(
- 'flutter/try/flutter-baz', 'project', skip=True) +
- api.buildbucket.try_build(
- git_repo='https://flutter.googlesource.com/recipes'))
+ yield (
+ api.status_check.test('ci') + api.properties(unittest_only=False) +
+ api.commit_queue.test_data('flutter', COMMIT_QUEUE_CFG) +
+ api.recipe_testing.affected_recipes_data(['none']) + api.recipe_testing
+ .build_data('flutter/try/flutter-foo', 'flutter', skip=True) +
+ api.recipe_testing
+ .build_data('flutter/try/flutter-bar', 'flutter', skip=True) +
+ api.recipe_testing
+ .build_data('flutter/try/flutter-baz', 'project', skip=True)
+ )
+ yield (
+ api.status_check.test('cq_try') + api.properties(unittest_only=False) +
+ api.commit_queue.test_data('flutter', COMMIT_QUEUE_CFG) +
+ api.recipe_testing.affected_recipes_data(['none']) + api.recipe_testing
+ .build_data('flutter/try/flutter-foo', 'flutter', skip=True) +
+ api.recipe_testing
+ .build_data('flutter/try/flutter-bar', 'flutter', skip=True) +
+ api.recipe_testing
+ .build_data('flutter/try/flutter-baz', 'project', skip=True) +
+ api.buildbucket.try_build(
+ git_repo='https://flutter.googlesource.com/recipes'
+ )
+ )