From 2025b98401191bbba581a07fa1f7572cc0b75493 Mon Sep 17 00:00:00 2001 From: Andrii Shyshkalov Date: Wed, 2 Oct 2019 07:11:17 +0000 Subject: [PATCH] recipes: update to stop using legacy properties. The only exception is 'revision' of gclient's weird RevisionResolver, which will be tackled in https://crbug.com/949334 R=ehmaldonado Bug: 877161 Change-Id: Ic65a2d13578802cf093f2a1cfb4002fe97509b3b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1818973 Reviewed-by: Edward Lesmes Commit-Queue: Andrii Shyshkalov --- recipes/README.recipes.md | 8 +- recipes/recipe_modules/bot_update/api.py | 2 +- recipes/recipe_modules/gclient/api.py | 2 +- .../examples/full.expected/revision.json | 2 - .../recipe_modules/gclient/examples/full.py | 7 +- .../gclient/tests/patch_project.py | 24 +--- .../recipe_modules/osx_sdk/examples/full.py | 3 +- .../full.expected/with_git_patch.json | 108 ------------------ .../full.expected/with_git_patch_luci.json | 108 ------------------ .../recipe_modules/tryserver/examples/full.py | 22 +--- .../windows_sdk/examples/full.py | 7 +- 11 files changed, 20 insertions(+), 273 deletions(-) delete mode 100644 recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch.json delete mode 100644 recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch_luci.json diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index d29820c9a..7ab47b427 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -322,7 +322,7 @@ Args: — **def [set\_patch\_repo\_revision](/recipes/recipe_modules/gclient/api.py#349)(self, gclient_config=None):** -Updates config revision corresponding to patch_project. +Updates config revision corresponding to patched project. Useful for bot_update only, as this is the only consumer of gclient's config revision map. This doesn't overwrite the revision if it was already set. @@ -979,14 +979,14 @@ Raises: — **def [RunSteps](/recipes/recipes/fetch_end_to_end_test.py#16)(api):** ### *recipes* / [gclient:examples/full](/recipes/recipe_modules/gclient/examples/full.py) -[DEPS](/recipes/recipe_modules/gclient/examples/full.py#5): [gclient](#recipe_modules-gclient), [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/step][recipe_engine/recipe_modules/step] +[DEPS](/recipes/recipe_modules/gclient/examples/full.py#5): [gclient](#recipe_modules-gclient), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/step][recipe_engine/recipe_modules/step] -— **def [RunSteps](/recipes/recipe_modules/gclient/examples/full.py#53)(api):** +— **def [RunSteps](/recipes/recipe_modules/gclient/examples/full.py#54)(api):** ### *recipes* / [gclient:tests/patch\_project](/recipes/recipe_modules/gclient/tests/patch_project.py) [DEPS](/recipes/recipe_modules/gclient/tests/patch_project.py#9): [gclient](#recipe_modules-gclient), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/properties][recipe_engine/recipe_modules/properties] -— **def [RunSteps](/recipes/recipe_modules/gclient/tests/patch_project.py#22)(api, patch_project, patch_repository_url):** +— **def [RunSteps](/recipes/recipe_modules/gclient/tests/patch_project.py#16)(api):** ### *recipes* / [gerrit:examples/full](/recipes/recipe_modules/gerrit/examples/full.py) [DEPS](/recipes/recipe_modules/gerrit/examples/full.py#5): [gerrit](#recipe_modules-gerrit), [recipe\_engine/step][recipe_engine/recipe_modules/step] diff --git a/recipes/recipe_modules/bot_update/api.py b/recipes/recipe_modules/bot_update/api.py index abf6475a3..715bb24f4 100644 --- a/recipes/recipe_modules/bot_update/api.py +++ b/recipes/recipe_modules/bot_update/api.py @@ -119,7 +119,7 @@ class BotUpdateApi(recipe_api.RecipeApi): patch_root = patch_root or self.m.gclient.get_gerrit_patch_root( gclient_config=cfg) - # Allow patch_project's revision if necessary. + # Allow patched project's revision if necessary. # This is important for projects which are checked out as DEPS of the # gclient solution. self.m.gclient.set_patch_repo_revision(cfg) diff --git a/recipes/recipe_modules/gclient/api.py b/recipes/recipe_modules/gclient/api.py index 25e646876..6a8e31fba 100644 --- a/recipes/recipe_modules/gclient/api.py +++ b/recipes/recipe_modules/gclient/api.py @@ -347,7 +347,7 @@ class GclientApi(recipe_api.RecipeApi): return None def set_patch_repo_revision(self, gclient_config=None): - """Updates config revision corresponding to patch_project. + """Updates config revision corresponding to patched project. Useful for bot_update only, as this is the only consumer of gclient's config revision map. This doesn't overwrite the revision if it was already set. diff --git a/recipes/recipe_modules/gclient/examples/full.expected/revision.json b/recipes/recipe_modules/gclient/examples/full.expected/revision.json index fc6c155e6..f4ec3f49d 100644 --- a/recipes/recipe_modules/gclient/examples/full.expected/revision.json +++ b/recipes/recipe_modules/gclient/examples/full.expected/revision.json @@ -128,8 +128,6 @@ "--with_tags", "--delete_unversioned_trees", "--revision", - "Angle@abc", - "--revision", "src/third_party/angle@refs/heads/lkgr", "--output-json", "/path/to/tmp/json" diff --git a/recipes/recipe_modules/gclient/examples/full.py b/recipes/recipe_modules/gclient/examples/full.py index be06dc158..b7d482559 100644 --- a/recipes/recipe_modules/gclient/examples/full.py +++ b/recipes/recipe_modules/gclient/examples/full.py @@ -4,6 +4,7 @@ DEPS = [ 'gclient', + 'recipe_engine/buildbucket', 'recipe_engine/context', 'recipe_engine/path', 'recipe_engine/properties', @@ -58,7 +59,7 @@ def RunSteps(api): soln = src_cfg.solutions.add() soln.name = 'src' soln.url = 'https://chromium.googlesource.com/chromium/src.git' - soln.revision = api.properties.get('revision') + soln.revision = api.buildbucket.gitiles_commit.id soln.custom_vars = {'string_var': 'string_val', 'true_var': True} src_cfg.parent_got_revision_mapping['parent_got_revision'] = 'got_revision' api.gclient.c = src_cfg @@ -90,6 +91,6 @@ def GenTests(api): yield api.test('buildbot') + api.properties(path_config='buildbot') - yield api.test('revision') + api.properties(revision='abc') + yield api.test('revision') + api.buildbucket.ci_build(revision='abc') - yield api.test('tryserver') + api.properties.tryserver() + yield api.test('tryserver') + api.buildbucket.try_build() diff --git a/recipes/recipe_modules/gclient/tests/patch_project.py b/recipes/recipe_modules/gclient/tests/patch_project.py index 047a641f0..c118974a1 100644 --- a/recipes/recipe_modules/gclient/tests/patch_project.py +++ b/recipes/recipe_modules/gclient/tests/patch_project.py @@ -13,13 +13,7 @@ DEPS = [ ] -PROPERTIES = { - 'patch_project': recipe_api.Property(None), - 'patch_repository_url': recipe_api.Property(None), -} - - -def RunSteps(api, patch_project, patch_repository_url): +def RunSteps(api): src_cfg = api.gclient.make_config(CACHE_DIR='[ROOT]/git_cache') soln = src_cfg.solutions.add() soln.name = 'src' @@ -61,9 +55,7 @@ def GenTests(api): project='chromium', builder='linux', git_repo='https://chromium.googlesource.com/src') + - api.properties( - expected_patch_root=None, - patch_project='chromium') + + api.properties(expected_patch_root=None) + api.post_process(post_process.DropExpectation) ) @@ -73,9 +65,7 @@ def GenTests(api): project='chromium', builder='linux', git_repo='https://chromium.googlesource.com/src') + - api.properties( - expected_patch_root='src', - patch_project='chromium') + + api.properties(expected_patch_root='src') + api.post_process(post_process.DropExpectation) ) @@ -85,9 +75,7 @@ def GenTests(api): project='chromium', builder='linux', git_repo='https://chromium.googlesource.com/v8/v8') + - api.properties( - expected_patch_root='src/v8', - patch_project='v8') + + api.properties(expected_patch_root='src/v8') + api.post_process(post_process.DropExpectation) ) @@ -97,8 +85,6 @@ def GenTests(api): project='chromium', builder='linux', git_repo='https://webrtc.googlesource.com/src') + - api.properties( - expected_patch_root='src/third_party/webrtc', - patch_project='webrtc') + + api.properties(expected_patch_root='src/third_party/webrtc')+ api.post_process(post_process.DropExpectation) ) diff --git a/recipes/recipe_modules/osx_sdk/examples/full.py b/recipes/recipe_modules/osx_sdk/examples/full.py index f28a5e428..0775384f4 100644 --- a/recipes/recipe_modules/osx_sdk/examples/full.py +++ b/recipes/recipe_modules/osx_sdk/examples/full.py @@ -19,5 +19,4 @@ def RunSteps(api): def GenTests(api): for platform in ('linux', 'mac', 'win'): yield (api.test(platform) + - api.platform.name(platform) + - api.properties.generic(buildername='test_builder')) + api.platform.name(platform)) diff --git a/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch.json b/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch.json deleted file mode 100644 index 159125597..000000000 --- a/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch.json +++ /dev/null @@ -1,108 +0,0 @@ -[ - { - "cmd": [ - "git", - "-c", - "core.quotePath=false", - "diff", - "--cached", - "--name-only" - ], - "cwd": "[START_DIR]/v8", - "infra_step": true, - "name": "git diff to analyze patch", - "~followup_annotations": [ - "@@@STEP_LOG_LINE@files@v8/foo.cc@@@", - "@@@STEP_LOG_END@files@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB SET SUBPROJECT_TAG", - "~followup_annotations": [ - "@@@STEP_TEXT@v8@@@", - "@@@SET_BUILD_PROPERTY@subproject_tag@\"v8\"@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB FAILURE", - "~followup_annotations": [ - "@@@STEP_TEXT@PATCH_FAILURE@@@", - "@@@SET_BUILD_PROPERTY@failure_type@\"PATCH_FAILURE\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB DO NOT RETRY", - "~followup_annotations": [ - "@@@SET_BUILD_PROPERTY@do_not_retry@true@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB FAILURE (2)", - "~followup_annotations": [ - "@@@STEP_TEXT@COMPILE_FAILURE@@@", - "@@@SET_BUILD_PROPERTY@failure_type@\"COMPILE_FAILURE\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB FAILURE (3)", - "~followup_annotations": [ - "@@@STEP_TEXT@TEST_FAILURE@@@", - "@@@SET_BUILD_PROPERTY@failure_type@\"TEST_FAILURE\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB FAILURE (4)", - "~followup_annotations": [ - "@@@STEP_TEXT@INVALID_TEST_RESULTS@@@", - "@@@SET_BUILD_PROPERTY@failure_type@\"INVALID_TEST_RESULTS\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB FAILURE (5)", - "~followup_annotations": [ - "@@@STEP_TEXT@TEST_TIMEOUT@@@", - "@@@SET_BUILD_PROPERTY@failure_type@\"TEST_TIMEOUT\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB FAILURE (6)", - "~followup_annotations": [ - "@@@STEP_TEXT@TEST_EXPIRED@@@", - "@@@SET_BUILD_PROPERTY@failure_type@\"TEST_EXPIRED\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "cmd": [ - "python", - "-u", - "import sys; sys.exit(1)" - ], - "name": "fail", - "~followup_annotations": [ - "@@@STEP_TEXT@foo@@@", - "@@@SET_BUILD_PROPERTY@failure_hash@\"622c0c52e65e6d0dc78957dd113ad343e57ae6d2\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "failure": { - "failure": {}, - "humanReason": "Step('fail') (retcode: 1)" - }, - "name": "$result" - } -] \ No newline at end of file diff --git a/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch_luci.json b/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch_luci.json deleted file mode 100644 index 159125597..000000000 --- a/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch_luci.json +++ /dev/null @@ -1,108 +0,0 @@ -[ - { - "cmd": [ - "git", - "-c", - "core.quotePath=false", - "diff", - "--cached", - "--name-only" - ], - "cwd": "[START_DIR]/v8", - "infra_step": true, - "name": "git diff to analyze patch", - "~followup_annotations": [ - "@@@STEP_LOG_LINE@files@v8/foo.cc@@@", - "@@@STEP_LOG_END@files@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB SET SUBPROJECT_TAG", - "~followup_annotations": [ - "@@@STEP_TEXT@v8@@@", - "@@@SET_BUILD_PROPERTY@subproject_tag@\"v8\"@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB FAILURE", - "~followup_annotations": [ - "@@@STEP_TEXT@PATCH_FAILURE@@@", - "@@@SET_BUILD_PROPERTY@failure_type@\"PATCH_FAILURE\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB DO NOT RETRY", - "~followup_annotations": [ - "@@@SET_BUILD_PROPERTY@do_not_retry@true@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB FAILURE (2)", - "~followup_annotations": [ - "@@@STEP_TEXT@COMPILE_FAILURE@@@", - "@@@SET_BUILD_PROPERTY@failure_type@\"COMPILE_FAILURE\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB FAILURE (3)", - "~followup_annotations": [ - "@@@STEP_TEXT@TEST_FAILURE@@@", - "@@@SET_BUILD_PROPERTY@failure_type@\"TEST_FAILURE\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB FAILURE (4)", - "~followup_annotations": [ - "@@@STEP_TEXT@INVALID_TEST_RESULTS@@@", - "@@@SET_BUILD_PROPERTY@failure_type@\"INVALID_TEST_RESULTS\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB FAILURE (5)", - "~followup_annotations": [ - "@@@STEP_TEXT@TEST_TIMEOUT@@@", - "@@@SET_BUILD_PROPERTY@failure_type@\"TEST_TIMEOUT\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "cmd": [], - "name": "TRYJOB FAILURE (6)", - "~followup_annotations": [ - "@@@STEP_TEXT@TEST_EXPIRED@@@", - "@@@SET_BUILD_PROPERTY@failure_type@\"TEST_EXPIRED\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "cmd": [ - "python", - "-u", - "import sys; sys.exit(1)" - ], - "name": "fail", - "~followup_annotations": [ - "@@@STEP_TEXT@foo@@@", - "@@@SET_BUILD_PROPERTY@failure_hash@\"622c0c52e65e6d0dc78957dd113ad343e57ae6d2\"@@@", - "@@@STEP_FAILURE@@@" - ] - }, - { - "failure": { - "failure": {}, - "humanReason": "Step('fail') (retcode: 1)" - }, - "name": "$result" - } -] \ No newline at end of file diff --git a/recipes/recipe_modules/tryserver/examples/full.py b/recipes/recipe_modules/tryserver/examples/full.py index 27e7e7024..8913de5ba 100644 --- a/recipes/recipe_modules/tryserver/examples/full.py +++ b/recipes/recipe_modules/tryserver/examples/full.py @@ -34,7 +34,8 @@ def RunSteps(api): assert (api.tryserver.gerrit_change_repo_url == 'https://chromium.googlesource.com/chromium/src') assert api.tryserver.gerrit_change_fetch_ref == 'refs/changes/27/91827/1' - expected_target_ref = api.properties.get('target_ref', 'refs/heads/master') + expected_target_ref = api.properties.get( + 'expected_target_ref', 'refs/heads/master') assert api.tryserver.gerrit_change_target_ref == expected_target_ref if api.tryserver.is_gerrit_issue: @@ -65,23 +66,6 @@ def GenTests(api): # The 'test_patch_root' property used below is just so that these # tests can avoid using the gclient module to calculate the # patch root. Normal users would use gclient.get_gerrit_patch_root(). - yield (api.test('with_git_patch') + - api.properties( - path_config='buildbot', - patch_storage='git', - patch_project='v8', - patch_repo_url='http://patch.url/', - patch_ref='johndoe#123.diff', - test_patch_root='v8')) - - yield (api.test('with_git_patch_luci') + - api.properties( - patch_storage='git', - patch_project='v8', - patch_repo_url='http://patch.url/', - patch_ref='johndoe#123.diff', - test_patch_root='v8')) - yield (api.test('with_wrong_patch') + api.platform('win', 32) + api.properties(test_patch_root='')) @@ -101,7 +85,7 @@ def GenTests(api): git_repo='https://chromium.googlesource.com/chromium/src', change_number=91827, patch_set=1) + - api.properties(target_ref='refs/heads/experiment') + + api.properties(expected_target_ref='refs/heads/experiment') + api.tryserver.gerrit_change_target_ref('refs/heads/experiment')) yield (api.test('with_wrong_patch_new') + api.platform('win', 32) + diff --git a/recipes/recipe_modules/windows_sdk/examples/full.py b/recipes/recipe_modules/windows_sdk/examples/full.py index 4bac4123b..3326e324f 100644 --- a/recipes/recipe_modules/windows_sdk/examples/full.py +++ b/recipes/recipe_modules/windows_sdk/examples/full.py @@ -18,9 +18,4 @@ def RunSteps(api): def GenTests(api): for platform in ('linux', 'mac', 'win'): - properties = { - 'buildername': 'test_builder', - } - yield (api.test(platform) + - api.platform.name(platform) + - api.properties.generic(**properties)) + yield api.test(platform) + api.platform.name(platform)