diff --git a/recipe_modules/bot_update/api.py b/recipe_modules/bot_update/api.py index 706466545..653989b3a 100644 --- a/recipe_modules/bot_update/api.py +++ b/recipe_modules/bot_update/api.py @@ -145,7 +145,7 @@ class BotUpdateApi(recipe_api.RecipeApi): if use_site_config_creds: try: build_path = self.m.path['build'] - except KeyError: # pragma: no cover | TODO(nodir): cover + except KeyError: raise self.m.step.StepFailure( 'build path is not defined. This is normal for LUCI builds. ' 'In LUCI, use_site_config_creds parameter of ' diff --git a/recipe_modules/bot_update/example.expected/buildbot.json b/recipe_modules/bot_update/example.expected/buildbot.json new file mode 100644 index 000000000..75efd0a84 --- /dev/null +++ b/recipe_modules/bot_update/example.expected/buildbot.json @@ -0,0 +1,50 @@ +[ + { + "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@abc" + ], + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "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\": \"abc\"@@@", + "@@@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}\"@@@" + ] + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +] \ No newline at end of file diff --git a/recipe_modules/bot_update/example.expected/trychange_oauth2.json b/recipe_modules/bot_update/example.expected/trychange_oauth2.json index b0917d4bf..d83e59409 100644 --- a/recipe_modules/bot_update/example.expected/trychange_oauth2.json +++ b/recipe_modules/bot_update/example.expected/trychange_oauth2.json @@ -1,54 +1,8 @@ [ - { - "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]", - "--apply_issue_email_file", - "[BUILD]/site_config/.rietveld_client_email", - "--apply_issue_key_file", - "[BUILD]/site_config/.rietveld_secret_key", - "--output_json", - "/path/to/tmp/json", - "--revision", - "src@HEAD" - ], - "env": { - "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" - }, - "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}\"@@@" - ] - }, { "name": "$result", + "reason": "build path is not defined. This is normal for LUCI builds. In LUCI, use_site_config_creds parameter of bot_update.ensure_checkout is not supported", "recipe_result": null, - "status_code": 0 + "status_code": 1 } ] \ No newline at end of file diff --git a/recipe_modules/bot_update/example.expected/trychange_oauth2_buildbot.json b/recipe_modules/bot_update/example.expected/trychange_oauth2_buildbot.json new file mode 100644 index 000000000..b0917d4bf --- /dev/null +++ b/recipe_modules/bot_update/example.expected/trychange_oauth2_buildbot.json @@ -0,0 +1,54 @@ +[ + { + "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]", + "--apply_issue_email_file", + "[BUILD]/site_config/.rietveld_client_email", + "--apply_issue_key_file", + "[BUILD]/site_config/.rietveld_secret_key", + "--output_json", + "/path/to/tmp/json", + "--revision", + "src@HEAD" + ], + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "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}\"@@@" + ] + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +] \ No newline at end of file diff --git a/recipe_modules/bot_update/example.py b/recipe_modules/bot_update/example.py index 9f86e41ed..8373d57ca 100644 --- a/recipe_modules/bot_update/example.py +++ b/recipe_modules/bot_update/example.py @@ -63,6 +63,11 @@ def GenTests(api): patch=False, revision='abc' ) + yield api.test('buildbot') + api.properties( + path_config='buildbot', + patch=False, + revision='abc' + ) yield api.test('basic_with_branch_heads') + api.properties( with_branch_heads=True, suffix='with branch heads' @@ -81,6 +86,10 @@ def GenTests(api): yield api.test('trychange_oauth2') + api.properties( oauth2=True, ) + yield api.test('trychange_oauth2_buildbot') + api.properties( + path_config='buildbot', + oauth2=True, + ) yield api.test('trychange_oauth2_json') + api.properties( mastername='tryserver.chromium.linux', buildername='linux_rel', diff --git a/recipe_modules/gclient/example.expected/basic.json b/recipe_modules/gclient/example.expected/basic.json index 3e4f7922b..10edb01a8 100644 --- a/recipe_modules/gclient/example.expected/basic.json +++ b/recipe_modules/gclient/example.expected/basic.json @@ -85,7 +85,7 @@ "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", "config", "--spec", - "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'Angle', 'url': 'https://chromium.googlesource.com/angle/angle.git'}]" + "cache_dir = '[CACHE]/git'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'Angle', 'url': 'https://chromium.googlesource.com/angle/angle.git'}]" ], "cwd": "[START_DIR]/src/third_party", "env": { diff --git a/recipe_modules/gclient/example.expected/buildbot.json b/recipe_modules/gclient/example.expected/buildbot.json new file mode 100644 index 000000000..3e4f7922b --- /dev/null +++ b/recipe_modules/gclient/example.expected/buildbot.json @@ -0,0 +1,211 @@ +[ + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "config", + "--spec", + "cache_dir = '[ROOT]/git_cache'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]" + ], + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "gclient setup" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "sync", + "--verbose", + "--with_branch_heads", + "--nohooks", + "-j8", + "--reset", + "--force", + "--upstream", + "--no-nag-max", + "--delete_unversioned_trees", + "--output-json", + "/path/to/tmp/json" + ], + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "gclient sync", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"solutions\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"src/\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "recurse", + "git", + "config", + "user.name", + "local_bot" + ], + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "gclient recurse (git config user.name)" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "recurse", + "git", + "config", + "user.email", + "local_bot@example.com" + ], + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "gclient recurse (git config user.email)" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "config", + "--spec", + "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'Angle', 'url': 'https://chromium.googlesource.com/angle/angle.git'}]" + ], + "cwd": "[START_DIR]/src/third_party", + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "[spec: Angle] gclient setup" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "sync", + "--verbose", + "--with_branch_heads", + "--nohooks", + "-j8", + "--reset", + "--force", + "--upstream", + "--no-nag-max", + "--delete_unversioned_trees", + "--revision", + "src/third_party/angle@refs/heads/lkgr", + "--output-json", + "/path/to/tmp/json" + ], + "cwd": "[START_DIR]/src/third_party", + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "[spec: Angle] gclient sync", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"solutions\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"Angle/\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"1fd70473fb3de634b409d4acaf49ffc1f90aae1f\"@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"src/blatley/\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"5e800497199d615131a76cd10651e74d7c8a0962\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@SET_BUILD_PROPERTY@got_blatley_revision@\"5e800497199d615131a76cd10651e74d7c8a0962\"@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "recurse", + "git", + "config", + "user.name", + "local_bot" + ], + "cwd": "[START_DIR]/src/third_party", + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "[spec: Angle] gclient recurse (git config user.name)" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "recurse", + "git", + "config", + "user.email", + "local_bot@example.com" + ], + "cwd": "[START_DIR]/src/third_party", + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "[spec: Angle] gclient recurse (git config user.email)" + }, + { + "cmd": [ + "python", + "-u", + "\nimport os, sys\n\nbuild_path = sys.argv[1]\nif os.path.exists(build_path):\n for (path, dir, files) in os.walk(build_path):\n for cur_file in files:\n if cur_file.endswith('index.lock'):\n path_to_file = os.path.join(path, cur_file)\n print 'deleting %s' % path_to_file\n os.remove(path_to_file)\n", + "[START_DIR]" + ], + "name": "cleanup index.lock", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os, sys@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@build_path = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@if os.path.exists(build_path):@@@", + "@@@STEP_LOG_LINE@python.inline@ for (path, dir, files) in os.walk(build_path):@@@", + "@@@STEP_LOG_LINE@python.inline@ for cur_file in files:@@@", + "@@@STEP_LOG_LINE@python.inline@ if cur_file.endswith('index.lock'):@@@", + "@@@STEP_LOG_LINE@python.inline@ path_to_file = os.path.join(path, cur_file)@@@", + "@@@STEP_LOG_LINE@python.inline@ print 'deleting %s' % path_to_file@@@", + "@@@STEP_LOG_LINE@python.inline@ os.remove(path_to_file)@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "runhooks" + ], + "cwd": "[START_DIR]/src", + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "gclient runhooks" + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +] \ No newline at end of file diff --git a/recipe_modules/gclient/example.expected/revision.json b/recipe_modules/gclient/example.expected/revision.json index 9e84022e0..1a6447302 100644 --- a/recipe_modules/gclient/example.expected/revision.json +++ b/recipe_modules/gclient/example.expected/revision.json @@ -87,7 +87,7 @@ "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", "config", "--spec", - "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'Angle', 'url': 'https://chromium.googlesource.com/angle/angle.git'}]" + "cache_dir = '[CACHE]/git'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'Angle', 'url': 'https://chromium.googlesource.com/angle/angle.git'}]" ], "cwd": "[START_DIR]/src/third_party", "env": { diff --git a/recipe_modules/gclient/example.expected/tryserver.json b/recipe_modules/gclient/example.expected/tryserver.json index c963447f4..4cdc05efa 100644 --- a/recipe_modules/gclient/example.expected/tryserver.json +++ b/recipe_modules/gclient/example.expected/tryserver.json @@ -87,7 +87,7 @@ "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", "config", "--spec", - "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'Angle', 'url': 'https://chromium.googlesource.com/angle/angle.git'}]" + "cache_dir = '[CACHE]/git'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'Angle', 'url': 'https://chromium.googlesource.com/angle/angle.git'}]" ], "cwd": "[START_DIR]/src/third_party", "env": { diff --git a/recipe_modules/gclient/example.py b/recipe_modules/gclient/example.py index a6d01378d..50d4df5fd 100644 --- a/recipe_modules/gclient/example.py +++ b/recipe_modules/gclient/example.py @@ -95,6 +95,8 @@ def RunSteps(api): def GenTests(api): yield api.test('basic') + yield api.test('buildbot') + api.properties(path_config='buildbot') + yield api.test('revision') + api.properties(revision='abc') yield api.test('tryserver') + api.properties.tryserver() diff --git a/recipe_modules/git/example.expected/git-cache-checkout.json b/recipe_modules/git/example.expected/git-cache-checkout.json index 6ccc20049..f3105f040 100644 --- a/recipe_modules/git/example.expected/git-cache-checkout.json +++ b/recipe_modules/git/example.expected/git-cache-checkout.json @@ -18,7 +18,7 @@ "cache", "populate", "-c", - "[GIT_CACHE]", + "[CACHE]/git", "https://chromium.googlesource.com/chromium/src.git" ], "cwd": "[START_DIR]/src", @@ -34,7 +34,7 @@ "exists", "--quiet", "--cache-dir", - "[GIT_CACHE]", + "[CACHE]/git", "https://chromium.googlesource.com/chromium/src.git" ], "cwd": "[START_DIR]/src", diff --git a/recipe_modules/infra_paths/api.py b/recipe_modules/infra_paths/api.py index e6272c807..9c1db4566 100644 --- a/recipe_modules/infra_paths/api.py +++ b/recipe_modules/infra_paths/api.py @@ -9,9 +9,10 @@ class InfraPathsApi(recipe_api.RecipeApi): """infra_paths module is glue for design mistakes. It will be removed.""" def initialize(self): - # TODO(phajdan.jr): remove dupes from the engine and delete infra_ prefix. - self.m.path.set_config( - 'infra_' + self.m.properties.get('path_config', 'buildbot')) + path_config = self.m.properties.get('path_config') + if path_config: + # TODO(phajdan.jr): remove dupes from the engine and delete infra_ prefix. + self.m.path.set_config('infra_' + path_config) @property def default_git_cache_dir(self): @@ -24,5 +25,5 @@ class InfraPathsApi(recipe_api.RecipeApi): """ try: return self.m.path['git_cache'] - except KeyError: # pragma: no cover | TODO(nodir): cover + except KeyError: return self.m.path['cache'].join('git') diff --git a/recipe_modules/infra_paths/example.expected/basic.json b/recipe_modules/infra_paths/example.expected/basic.json index 02ec764ee..2b403b0a5 100644 --- a/recipe_modules/infra_paths/example.expected/basic.json +++ b/recipe_modules/infra_paths/example.expected/basic.json @@ -4,7 +4,7 @@ "name": "show cache path", "~followup_annotations": [ "@@@STEP_LOG_LINE@result@[CACHE]@@@", - "@@@STEP_LOG_LINE@result@[GIT_CACHE]@@@", + "@@@STEP_LOG_LINE@result@[CACHE]/git@@@", "@@@STEP_LOG_END@result@@@" ] }, diff --git a/recipe_modules/rietveld/__init__.py b/recipe_modules/rietveld/__init__.py index fdc935265..8dc3f8f5a 100644 --- a/recipe_modules/rietveld/__init__.py +++ b/recipe_modules/rietveld/__init__.py @@ -2,4 +2,5 @@ DEPS = [ 'recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/python', + 'recipe_engine/step', ] diff --git a/recipe_modules/rietveld/api.py b/recipe_modules/rietveld/api.py index 9d250fe1e..82f73f86f 100644 --- a/recipe_modules/rietveld/api.py +++ b/recipe_modules/rietveld/api.py @@ -67,7 +67,7 @@ class RietveldApi(recipe_api.RecipeApi): if authentication == 'oauth2': try: build_path = self.m.path['build'] - except KeyError: # pragma: no cover | TODO(nodir): cover + except KeyError: raise self.m.step.StepFailure( 'build path is not defined. This is typical for LUCI builds. ' 'LUCI does not support rietveld.apply_issue; use bot_update instead') diff --git a/recipe_modules/rietveld/example.expected/basic.json b/recipe_modules/rietveld/example.expected/basic.json index 0999dbca0..cf869a363 100644 --- a/recipe_modules/rietveld/example.expected/basic.json +++ b/recipe_modules/rietveld/example.expected/basic.json @@ -1,30 +1,8 @@ [ - { - "cmd": [ - "python", - "-u", - "RECIPE_PACKAGE_REPO[depot_tools]/apply_issue.py", - "-r", - "[START_DIR]/foo/bar", - "-i", - "1", - "-p", - "1", - "-s", - "http://review_tool.url", - "-E", - "[BUILD]/site_config/.rietveld_client_email", - "-k", - "[BUILD]/site_config/.rietveld_secret_key" - ], - "name": "apply_issue", - "~followup_annotations": [ - "@@@STEP_LINK@Applied issue 1@http://review_tool.url/1@@@" - ] - }, { "name": "$result", + "reason": "build path is not defined. This is typical for LUCI builds. LUCI does not support rietveld.apply_issue; use bot_update instead", "recipe_result": null, - "status_code": 0 + "status_code": 1 } ] \ No newline at end of file diff --git a/recipe_modules/rietveld/example.expected/buildbot.json b/recipe_modules/rietveld/example.expected/buildbot.json new file mode 100644 index 000000000..0999dbca0 --- /dev/null +++ b/recipe_modules/rietveld/example.expected/buildbot.json @@ -0,0 +1,30 @@ +[ + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/apply_issue.py", + "-r", + "[START_DIR]/foo/bar", + "-i", + "1", + "-p", + "1", + "-s", + "http://review_tool.url", + "-E", + "[BUILD]/site_config/.rietveld_client_email", + "-k", + "[BUILD]/site_config/.rietveld_secret_key" + ], + "name": "apply_issue", + "~followup_annotations": [ + "@@@STEP_LINK@Applied issue 1@http://review_tool.url/1@@@" + ] + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +] \ No newline at end of file diff --git a/recipe_modules/rietveld/example.py b/recipe_modules/rietveld/example.py index 3a6dd151c..4216d97cd 100644 --- a/recipe_modules/rietveld/example.py +++ b/recipe_modules/rietveld/example.py @@ -17,8 +17,14 @@ def RunSteps(api): def GenTests(api): - yield (api.test('basic') - + api.properties(issue=1, - patchset=1, - rietveld='http://review_tool.url') - ) + yield api.test('basic') + api.properties( + issue=1, + patchset=1, + rietveld='http://review_tool.url', + ) + yield api.test('buildbot') + api.properties( + path_config='buildbot', + issue=1, + patchset=1, + rietveld='http://review_tool.url', + ) diff --git a/recipe_modules/tryserver/api.py b/recipe_modules/tryserver/api.py index f50f2dfe7..48a2edd1f 100644 --- a/recipe_modules/tryserver/api.py +++ b/recipe_modules/tryserver/api.py @@ -106,7 +106,7 @@ class TryserverApi(recipe_api.RecipeApi): patch_dir = self.m.path.mkdtemp('patch') try: build_path = self.m.path['build'] - except KeyError: # pragma: no cover | TODO(nodir): cover + except KeyError: raise self.m.step.StepFailure( 'path["build"] is not defined. ' 'Possibly this is a LUCI build. ' diff --git a/recipe_modules/tryserver/example.expected/with_git_patch_luci.json b/recipe_modules/tryserver/example.expected/with_git_patch_luci.json new file mode 100644 index 000000000..70f1df03f --- /dev/null +++ b/recipe_modules/tryserver/example.expected/with_git_patch_luci.json @@ -0,0 +1,8 @@ +[ + { + "name": "$result", + "reason": "path[\"build\"] is not defined. Possibly this is a LUCI build. tryserver.apply_from_git is not supported in LUCI builds.", + "recipe_result": null, + "status_code": 1 + } +] \ No newline at end of file diff --git a/recipe_modules/tryserver/example.py b/recipe_modules/tryserver/example.py index 88f0f7894..69a091781 100644 --- a/recipe_modules/tryserver/example.py +++ b/recipe_modules/tryserver/example.py @@ -50,11 +50,19 @@ def GenTests(api): 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')) + 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')) + yield (api.test('with_rietveld_patch') + api.properties.tryserver() + description_step)