Commit 512f92b7 authored by Garrett Beaty's avatar Garrett Beaty Committed by Commit Bot

Fetch the input commit ref when both ref and id are specified.

This causes --refs refs/head/master to be added to bot_update
calls when the input build message contains a commit id and the
refs/head/master ref. This is an effective no-op.

Bug: 922150
Change-Id: I119d9b3cede727713a0b66bff83b5ee4e1848790
Recipe-Nontrivial-Roll: build
Recipe-Nontrivial-Roll: infra
Recipe-Nontrivial-Roll: build_limited_scripts_slave
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1884457
Commit-Queue: Garrett Beaty <gbeaty@chromium.org>
Auto-Submit: Garrett Beaty <gbeaty@chromium.org>
Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@google.com>
parent 5eb757a7
......@@ -56,7 +56,7 @@ Recipe module to ensure a checkout is consistent on a bot.
Wrapper for easy calling of bot_update.
&mdash; **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#478)(self, bot_update_step):**
&mdash; **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.
&mdash; **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#455)(self, project_name, gclient_config=None):**
&mdash; **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
&emsp; **@property**<br>&mdash; **def [last\_returned\_properties](/recipes/recipe_modules/bot_update/api.py#36)(self):**
&mdash; **def [resolve\_fixed\_revision](/recipes/recipe_modules/bot_update/api.py#405)(self, bot_update_json, name):**
&mdash; **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.
......
......@@ -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
......
......@@ -16,6 +16,8 @@
"/path/to/tmp/json",
"--revision",
"src@2d72510e447ab60a9728aeea2362d8be2cbd7789",
"--refs",
"refs/heads/master",
"--disable-syntax-validation"
],
"env_suffixes": {
......
......@@ -16,6 +16,8 @@
"/path/to/tmp/json",
"--revision",
"src@2d72510e447ab60a9728aeea2362d8be2cbd7789",
"--refs",
"refs/heads/master",
"--disable-syntax-validation"
],
"env_suffixes": {
......
......@@ -16,6 +16,8 @@
"/path/to/tmp/json",
"--revision",
"src@2d72510e447ab60a9728aeea2362d8be2cbd7789",
"--refs",
"refs/heads/master",
"--with_branch_heads",
"--disable-syntax-validation"
],
......
......@@ -18,6 +18,8 @@
"got_revision@src",
"--revision",
"src@HEAD",
"--refs",
"refs/heads/master",
"--disable-syntax-validation"
],
"env_suffixes": {
......
......@@ -18,6 +18,8 @@
"got_revision@src",
"--revision",
"src@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"--refs",
"refs/heads/master",
"--disable-syntax-validation"
],
"env_suffixes": {
......
[
{
"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
......@@ -16,6 +16,8 @@
"/path/to/tmp/json",
"--revision",
"src@2d72510e447ab60a9728aeea2362d8be2cbd7789",
"--refs",
"refs/heads/master",
"--disable-syntax-validation"
],
"env_suffixes": {
......
......@@ -16,6 +16,8 @@
"/path/to/tmp/json",
"--revision",
"src@2d72510e447ab60a9728aeea2362d8be2cbd7789",
"--refs",
"refs/heads/master",
"--disable-syntax-validation"
],
"env_suffixes": {
......
......@@ -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') +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment