diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index 71f9a01057..5f0b787264 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -56,7 +56,7 @@ Recipe module to ensure a checkout is consistent on a bot. Wrapper for easy calling of bot_update. -— **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#478)(self, bot_update_step):** +— **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#480)(self, bot_update_step):** Deapplies a patch, taking care of DEPS and solution revisions properly. @@ -83,7 +83,7 @@ Args: step_test_data: a null function that returns test bot_update.py output. Use test_api.output_json to generate test data. -— **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#455)(self, project_name, gclient_config=None):** +— **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#457)(self, project_name, gclient_config=None):** Returns all property names used for storing the checked-out revision of a given project. @@ -101,7 +101,7 @@ Returns (list of str): All properties that'll hold the checked-out revision   **@property**
— **def [last\_returned\_properties](/recipes/recipe_modules/bot_update/api.py#36)(self):** -— **def [resolve\_fixed\_revision](/recipes/recipe_modules/bot_update/api.py#405)(self, bot_update_json, name):** +— **def [resolve\_fixed\_revision](/recipes/recipe_modules/bot_update/api.py#407)(self, bot_update_json, name):** Set a fixed revision for a single dependency using project revision properties. diff --git a/recipes/recipe_modules/bot_update/api.py b/recipes/recipe_modules/bot_update/api.py index 200da96425..0eaf05d4be 100644 --- a/recipes/recipe_modules/bot_update/api.py +++ b/recipes/recipe_modules/bot_update/api.py @@ -172,6 +172,8 @@ class BotUpdateApi(recipe_api.RecipeApi): # e.g. they want to force refs/heads/master at the config level. main_repo_path = self._get_commit_repo_path(in_commit, cfg) revisions[main_repo_path] = revisions.get(main_repo_path) or in_commit_rev + if in_commit.id and in_commit.ref: + refs = [in_commit.ref] + refs # Guarantee that first solution has a revision. # TODO(machenbach): We should explicitly pass HEAD for ALL solutions diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/basic.json b/recipes/recipe_modules/bot_update/examples/full.expected/basic.json index 89eab3c875..4faffbe178 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/basic.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/basic.json @@ -16,6 +16,8 @@ "/path/to/tmp/json", "--revision", "src@2d72510e447ab60a9728aeea2362d8be2cbd7789", + "--refs", + "refs/heads/master", "--disable-syntax-validation" ], "env_suffixes": { diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/basic_luci.json b/recipes/recipe_modules/bot_update/examples/full.expected/basic_luci.json index 89eab3c875..4faffbe178 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/basic_luci.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/basic_luci.json @@ -16,6 +16,8 @@ "/path/to/tmp/json", "--revision", "src@2d72510e447ab60a9728aeea2362d8be2cbd7789", + "--refs", + "refs/heads/master", "--disable-syntax-validation" ], "env_suffixes": { diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json b/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json index 4792337100..d0b552c018 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json @@ -16,6 +16,8 @@ "/path/to/tmp/json", "--revision", "src@2d72510e447ab60a9728aeea2362d8be2cbd7789", + "--refs", + "refs/heads/master", "--with_branch_heads", "--disable-syntax-validation" ], diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_HEAD.json b/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_HEAD.json index 9330bd043a..aec6ebe0ca 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_HEAD.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_HEAD.json @@ -18,6 +18,8 @@ "got_revision@src", "--revision", "src@HEAD", + "--refs", + "refs/heads/master", "--disable-syntax-validation" ], "env_suffixes": { diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_a_specific_commit.json b/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_a_specific_commit.json index 8d50705acf..f9a6f3a86a 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_a_specific_commit.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_a_specific_commit.json @@ -18,6 +18,8 @@ "got_revision@src", "--revision", "src@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "--refs", + "refs/heads/master", "--disable-syntax-validation" ], "env_suffixes": { diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_a_specific_commit_with_a_branch_head.json b/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_a_specific_commit_with_a_branch_head.json new file mode 100644 index 0000000000..f9b49a92ec --- /dev/null +++ b/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_a_specific_commit_with_a_branch_head.json @@ -0,0 +1,58 @@ +[ + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[depot_tools::bot_update]/resources/bot_update.py", + "--spec-path", + "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]", + "--revision_mapping_file", + "{\"got_angle_revision\": \"src/third_party/angle\", \"got_cr_revision\": \"src\", \"got_revision\": \"src\", \"got_v8_revision\": \"src/v8\"}", + "--git-cache-dir", + "[GIT_CACHE]", + "--cleanup-dir", + "[CLEANUP]/bot_update", + "--output_json", + "/path/to/tmp/json", + "--revision", + "got_revision@src", + "--revision", + "src@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "--refs", + "refs/branch-heads/x", + "--disable-syntax-validation" + ], + "env_suffixes": { + "PATH": [ + "RECIPE_REPO[depot_tools]" + ] + }, + "infra_step": true, + "name": "bot_update (without patch)", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"manifest\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"src\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"repository\": \"https://chromium.googlesource.com/chromium/src\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"properties\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"got_revision\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@SET_BUILD_PROPERTY@got_revision@\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"@@@" + ] + }, + { + "cmd": [], + "name": "set_output_gitiles_commit", + "~followup_annotations": [ + "@@@SET_BUILD_PROPERTY@$recipe_engine/buildbucket/output_gitiles_commit@{\"host\": \"chromium.googlesource.com\", \"id\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"project\": \"chromium/src\", \"ref\": \"refs/branch-heads/x\"}@@@" + ] + }, + { + "name": "$result" + } +] \ No newline at end of file diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/resolve_chromium_fixed_version.json b/recipes/recipe_modules/bot_update/examples/full.expected/resolve_chromium_fixed_version.json index 89eab3c875..4faffbe178 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/resolve_chromium_fixed_version.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/resolve_chromium_fixed_version.json @@ -16,6 +16,8 @@ "/path/to/tmp/json", "--revision", "src@2d72510e447ab60a9728aeea2362d8be2cbd7789", + "--refs", + "refs/heads/master", "--disable-syntax-validation" ], "env_suffixes": { diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/with_manifest_name.json b/recipes/recipe_modules/bot_update/examples/full.expected/with_manifest_name.json index 632a7c4448..4fa67c7556 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/with_manifest_name.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/with_manifest_name.json @@ -16,6 +16,8 @@ "/path/to/tmp/json", "--revision", "src@2d72510e447ab60a9728aeea2362d8be2cbd7789", + "--refs", + "refs/heads/master", "--disable-syntax-validation" ], "env_suffixes": { diff --git a/recipes/recipe_modules/bot_update/examples/full.py b/recipes/recipe_modules/bot_update/examples/full.py index 2531729970..c61b4cbbe4 100644 --- a/recipes/recipe_modules/bot_update/examples/full.py +++ b/recipes/recipe_modules/bot_update/examples/full.py @@ -311,6 +311,25 @@ def GenTests(api): ) ) + yield ( + api.test('no_cp_checkout_a_specific_commit_with_a_branch_head') + + ci_build(revision='a' * 40, git_ref='refs/branch-heads/x') + + api.properties( + revisions={'got_revision': 'src'}, + bot_update_output={ + 'properties': { + 'got_revision': 'a' * 40, + }, + 'manifest': { + 'src': { + 'revision': 'a' * 40, + 'repository': 'https://chromium.googlesource.com/chromium/src', + } + } + } + ) + ) + yield ( api.test('no_cp_checkout_HEAD') + ci_build(revision='HEAD') +