From 26e338f40d5346a18e877bd10a17972ab6b78173 Mon Sep 17 00:00:00 2001 From: Andrii Shyshkalov Date: Thu, 9 Nov 2017 02:05:14 +0000 Subject: [PATCH] Revert "Add luci_migration recipe module." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2a1ca3f68bc97c69537d46890348bfc79483ed60. Reason for revert: to be replaced by recipe_engine runtime module in https://chromium-review.googlesource.com/#/c/infra/luci/recipes-py/+/759677 Original change's description: > Add luci_migration recipe module. > > R=​iannucci@chromium.org > > Bug: 782460 > Change-Id: I022deb4d8e3cee8d48e1acccc78f8681490c72b9 > Reviewed-on: https://chromium-review.googlesource.com/757820 > Commit-Queue: Andrii Shyshkalov > Reviewed-by: Robbie Iannucci TBR=iannucci@chromium.org,tandrii@chromium.org Change-Id: Ieb874ad42b939edb66e35db3cfed0b8b8746e70e No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 782460 Reviewed-on: https://chromium-review.googlesource.com/759357 Reviewed-by: Andrii Shyshkalov Commit-Queue: Andrii Shyshkalov --- recipes/README.recipes.md | 31 ----------------- .../recipe_modules/luci_migration/__init__.py | 25 -------------- recipes/recipe_modules/luci_migration/api.py | 34 ------------------- .../recipe_modules/luci_migration/test_api.py | 20 ----------- .../tests/full.expected/basic.json | 16 --------- .../luci_migration/tests/full.py | 22 ------------ 6 files changed, 148 deletions(-) delete mode 100644 recipes/recipe_modules/luci_migration/__init__.py delete mode 100644 recipes/recipe_modules/luci_migration/api.py delete mode 100644 recipes/recipe_modules/luci_migration/test_api.py delete mode 100644 recipes/recipe_modules/luci_migration/tests/full.expected/basic.json delete mode 100644 recipes/recipe_modules/luci_migration/tests/full.py diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index 9a3aa7d19..a16b5444a 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -13,7 +13,6 @@ * [gitiles](#recipe_modules-gitiles) * [gsutil](#recipe_modules-gsutil) * [infra_paths](#recipe_modules-infra_paths) - * [luci_migration](#recipe_modules-luci_migration) * [presubmit](#recipe_modules-presubmit) * [rietveld](#recipe_modules-rietveld) * [tryserver](#recipe_modules-tryserver) @@ -32,7 +31,6 @@ * [gitiles:examples/full](#recipes-gitiles_examples_full) * [gsutil:examples/full](#recipes-gsutil_examples_full) * [infra_paths:examples/full](#recipes-infra_paths_examples_full) - * [luci_migration:tests/full](#recipes-luci_migration_tests_full) * [presubmit:examples/full](#recipes-presubmit_examples_full) * [rietveld:examples/full](#recipes-rietveld_examples_full) * [tryserver:examples/full](#recipes-tryserver_examples_full) @@ -614,30 +612,6 @@ It returns git_cache path if it is defined (Buildbot world), otherwise uses the more generic [CACHE]/git path (LUCI world). — **def [initialize](/recipes/recipe_modules/infra_paths/api.py#11)(self):** -### *recipe_modules* / [luci\_migration](/recipes/recipe_modules/luci_migration) - -[DEPS](/recipes/recipe_modules/luci_migration/__init__.py#5): [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/properties][recipe_engine/recipe_modules/properties] - -#### **class [LuciMigrationApi](/recipes/recipe_modules/luci_migration/api.py#8)([RecipeApi][recipe_engine/wkt/RecipeApi]):** - -This module assists in migrating builders from Buildbot to pure LUCI stack. - -Finishing migration means you no longer depend on this module. - -  **@property**
— **def [is\_luci](/recipes/recipe_modules/luci_migration/api.py#18)(self):** - -True if runs on LUCI stack. - -  **@property**
— **def [is\_prod](/recipes/recipe_modules/luci_migration/api.py#23)(self):** - -True if this builder is in production. - -Typical usage is to modify steps which produce external side-effects so that -non-production runs of the recipe do not affect production data. - -Examples: - * Uploading to an alternate google storage file name when in non-prod mode - * Appending a 'non-production' tag to external RPCs ### *recipe_modules* / [presubmit](/recipes/recipe_modules/presubmit) [DEPS](/recipes/recipe_modules/presubmit/__init__.py#1): [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/step][recipe_engine/recipe_modules/step] @@ -843,11 +817,6 @@ Move things around in a loop! [DEPS](/recipes/recipe_modules/infra_paths/examples/full.py#7): [infra\_paths](#recipe_modules-infra_paths), [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/step][recipe_engine/recipe_modules/step] — **def [RunSteps](/recipes/recipe_modules/infra_paths/examples/full.py#16)(api):** -### *recipes* / [luci\_migration:tests/full](/recipes/recipe_modules/luci_migration/tests/full.py) - -[DEPS](/recipes/recipe_modules/luci_migration/tests/full.py#7): [luci\_migration](#recipe_modules-luci_migration), [recipe\_engine/step][recipe_engine/recipe_modules/step] - -— **def [RunSteps](/recipes/recipe_modules/luci_migration/tests/full.py#13)(api):** ### *recipes* / [presubmit:examples/full](/recipes/recipe_modules/presubmit/examples/full.py) [DEPS](/recipes/recipe_modules/presubmit/examples/full.py#5): [presubmit](#recipe_modules-presubmit) diff --git a/recipes/recipe_modules/luci_migration/__init__.py b/recipes/recipe_modules/luci_migration/__init__.py deleted file mode 100644 index 23fb5ff5d..000000000 --- a/recipes/recipe_modules/luci_migration/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2017 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. - -DEPS = [ - 'recipe_engine/path', - 'recipe_engine/properties', -] - -from recipe_engine.recipe_api import Property -from recipe_engine.config import ConfigGroup, Single - -PROPERTIES = { - '$depot_tools/luci_migration': Property( - help='Properties specifically for the luci_migration module', - param_name='migration_properties', - kind=ConfigGroup( - # Whether builder runs on LUCI stack. - is_luci=Single(bool), - # Whether builder is in production. - is_prod=Single(bool), - ), - default={}, - ), -} diff --git a/recipes/recipe_modules/luci_migration/api.py b/recipes/recipe_modules/luci_migration/api.py deleted file mode 100644 index 92fd3981a..000000000 --- a/recipes/recipe_modules/luci_migration/api.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2017 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. - -from recipe_engine import recipe_api - - -class LuciMigrationApi(recipe_api.RecipeApi): - """This module assists in migrating builders from Buildbot to pure LUCI stack. - - Finishing migration means you no longer depend on this module. - """ - - def __init__(self, migration_properties, **kwargs): - super(LuciMigrationApi, self).__init__(**kwargs) - self._migration_properties = migration_properties - - @property - def is_luci(self): - """True if this recipe is currently running on LUCI stack.""" - return bool(self._migration_properties.get('is_luci', False)) - - @property - def is_prod(self): - """True if this recipe is currently running in production. - - Typical usage is to modify steps which produce external side-effects so that - non-production runs of the recipe do not affect production data. - - Examples: - * Uploading to an alternate google storage file name when in non-prod mode - * Appending a 'non-production' tag to external RPCs - """ - return bool(self._migration_properties.get('is_prod', True)) diff --git a/recipes/recipe_modules/luci_migration/test_api.py b/recipes/recipe_modules/luci_migration/test_api.py deleted file mode 100644 index 065540536..000000000 --- a/recipes/recipe_modules/luci_migration/test_api.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 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. - -from recipe_engine import recipe_test_api - - -class LuciMigrationTestApi(recipe_test_api.RecipeTestApi): - def __call__(self, is_luci, is_prod): - """Simulate luci migration state of a builder.""" - assert isinstance(is_luci, bool), '%r (%s)' % (is_luci, type(is_luci)) - assert isinstance(is_prod, bool), '%r (%s)' % (is_prod, type(is_prod)) - ret = self.test(None) - ret.properties = { - '$depot_tools/luci_migration': { - 'is_luci': is_luci, - 'is_prod': is_prod, - }, - } - return ret diff --git a/recipes/recipe_modules/luci_migration/tests/full.expected/basic.json b/recipes/recipe_modules/luci_migration/tests/full.expected/basic.json deleted file mode 100644 index ad81ee21a..000000000 --- a/recipes/recipe_modules/luci_migration/tests/full.expected/basic.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "cmd": [], - "name": "show properties", - "~followup_annotations": [ - "@@@STEP_LOG_LINE@result@is_luci: True@@@", - "@@@STEP_LOG_LINE@result@is_prod: False@@@", - "@@@STEP_LOG_END@result@@@" - ] - }, - { - "name": "$result", - "recipe_result": null, - "status_code": 0 - } -] \ No newline at end of file diff --git a/recipes/recipe_modules/luci_migration/tests/full.py b/recipes/recipe_modules/luci_migration/tests/full.py deleted file mode 100644 index 5b177e143..000000000 --- a/recipes/recipe_modules/luci_migration/tests/full.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 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. - -import json - -DEPS = [ - 'depot_tools/luci_migration', - 'recipe_engine/step', -] - - -def RunSteps(api): - api.step('show properties', []) - api.step.active_result.presentation.logs['result'] = [ - 'is_luci: %r' % (api.luci_migration.is_luci,), - 'is_prod: %r' % (api.luci_migration.is_prod,), - ] - - -def GenTests(api): - yield api.test('basic') + api.luci_migration(is_luci=True, is_prod=False)