From f4597a4f9132895ea4787304c8c38c657942d784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Hajdan=2C=20Jr?= Date: Wed, 12 Apr 2017 18:13:31 +0200 Subject: [PATCH] bot_update: add with_tags argument to ensure_checkout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: 710817 Change-Id: Ifb2a9abe605d9e403c55ec1360d186af12dd2f34 Reviewed-on: https://chromium-review.googlesource.com/475775 Reviewed-by: Michael Moss Commit-Queue: Paweł Hajdan Jr. --- recipes/recipe_modules/bot_update/api.py | 4 +- .../example.expected/with_tags.json | 105 ++++++++++++++++++ recipes/recipe_modules/bot_update/example.py | 3 + 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 recipes/recipe_modules/bot_update/example.expected/with_tags.json diff --git a/recipes/recipe_modules/bot_update/api.py b/recipes/recipe_modules/bot_update/api.py index d964927f0..a52ec88e3 100644 --- a/recipes/recipe_modules/bot_update/api.py +++ b/recipes/recipe_modules/bot_update/api.py @@ -74,7 +74,7 @@ class BotUpdateApi(recipe_api.RecipeApi): def ensure_checkout(self, gclient_config=None, suffix=None, patch=True, update_presentation=True, patch_root=None, no_shallow=False, - with_branch_heads=False, refs=None, + with_branch_heads=False, with_tags=False, refs=None, patch_oauth2=False, oauth2_json=False, use_site_config_creds=True, output_manifest=True, clobber=False, @@ -236,6 +236,8 @@ class BotUpdateApi(recipe_api.RecipeApi): cmd.append('--output_manifest') if with_branch_heads or cfg.with_branch_heads: cmd.append('--with_branch_heads') + if with_tags: + cmd.append('--with_tags') if gerrit_no_reset: cmd.append('--gerrit_no_reset') if gerrit_no_rebase_patch_ref: diff --git a/recipes/recipe_modules/bot_update/example.expected/with_tags.json b/recipes/recipe_modules/bot_update/example.expected/with_tags.json new file mode 100644 index 000000000..d7a2c12a9 --- /dev/null +++ b/recipes/recipe_modules/bot_update/example.expected/with_tags.json @@ -0,0 +1,105 @@ +[ + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[depot_tools::bot_update]/resources/bot_update.py", + "--spec", + "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]", + "--patch_root", + "src", + "--revision_mapping_file", + "{\"src\": \"got_cr_revision\"}", + "--git-cache-dir", + "[GIT_CACHE]", + "--output_json", + "/path/to/tmp/json", + "--revision", + "src@HEAD", + "--with_tags" + ], + "env": { + "GIT_HTTP_LOW_SPEED_LIMIT": "1000", + "GIT_HTTP_LOW_SPEED_TIME": "300", + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "bot_update", + "~followup_annotations": [ + "@@@STEP_TEXT@Some step text@@@", + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"did_run\": true, @@@", + "@@@STEP_LOG_LINE@json.output@ \"fixed_revisions\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"src\": \"HEAD\"@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"patch_failure\": false, @@@", + "@@@STEP_LOG_LINE@json.output@ \"patch_root\": \"src\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"properties\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"got_cr_revision\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"root\": \"src\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"step_text\": \"Some step text\"@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@SET_BUILD_PROPERTY@got_cr_revision@\"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@", + "@@@SET_BUILD_PROPERTY@got_cr_revision_cp@\"refs/heads/master@{#170242}\"@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[depot_tools::bot_update]/resources/bot_update.py", + "--spec", + "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]", + "--patch_root", + "src", + "--revision_mapping_file", + "{\"src\": \"got_cr_revision\"}", + "--git-cache-dir", + "[GIT_CACHE]", + "--output_json", + "/path/to/tmp/json", + "--revision", + "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9", + "--output_manifest" + ], + "env": { + "GIT_HTTP_LOW_SPEED_LIMIT": "1000", + "GIT_HTTP_LOW_SPEED_TIME": "300", + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "bot_update (without patch)", + "~followup_annotations": [ + "@@@STEP_TEXT@Some step text@@@", + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"did_run\": true, @@@", + "@@@STEP_LOG_LINE@json.output@ \"fixed_revisions\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"src\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"manifest\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"src\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"repository\": \"https://fake.org/src.git\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"patch_failure\": false, @@@", + "@@@STEP_LOG_LINE@json.output@ \"patch_root\": \"src\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"properties\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"got_cr_revision\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"got_cr_revision_cp\": \"refs/heads/master@{#170242}\"@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"root\": \"src\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"step_text\": \"Some step text\"@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@" + ] + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +] \ No newline at end of file diff --git a/recipes/recipe_modules/bot_update/example.py b/recipes/recipe_modules/bot_update/example.py index 103fe0045..219f7cc1b 100644 --- a/recipes/recipe_modules/bot_update/example.py +++ b/recipes/recipe_modules/bot_update/example.py @@ -29,6 +29,7 @@ def RunSteps(api): no_shallow = True if api.properties.get('no_shallow') else False output_manifest = api.properties.get('output_manifest', False) with_branch_heads = api.properties.get('with_branch_heads', False) + with_tags = api.properties.get('with_tags', False) refs = api.properties.get('refs', []) oauth2 = api.properties.get('oauth2', False) oauth2_json = api.properties.get('oauth2_json', False) @@ -48,6 +49,7 @@ def RunSteps(api): no_shallow=no_shallow, patch=patch, with_branch_heads=with_branch_heads, + with_tags=with_tags, output_manifest=output_manifest, refs=refs, patch_oauth2=oauth2, oauth2_json=oauth2_json, @@ -77,6 +79,7 @@ def GenTests(api): yield api.test('basic_output_manifest') + api.properties( output_manifest=True, ) + yield api.test('with_tags') + api.properties(with_tags=True) yield api.test('tryjob') + api.properties( issue=12345, patchset=654321,