deprecate build path

Update recipe modules that use path "build" to either check whether it
is defined or fail with an explanation if it is not defined.

This CL marks failure code paths as `# pragma: no cover`. This comment
will be removed in https://chromium-review.googlesource.com/c/411989/

R=iannucci@chromium.org, martiniss@chromium.org
BUG=662586

Change-Id: Ieb7637deefa6e366dfe4c30c7711d60daa06575a
Reviewed-on: https://chromium-review.googlesource.com/412225
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
changes/25/412225/11
Nodir Turakulov 9 years ago committed by Commit Bot
parent c68d4d3612
commit ff416a73fb

@ -143,10 +143,15 @@ class BotUpdateApi(recipe_api.RecipeApi):
elif patch_oauth2:
# TODO(martiniss): remove this hack :(. crbug.com/624212
if use_site_config_creds:
email_file = self.m.path['build'].join(
'site_config', '.rietveld_client_email')
key_file = self.m.path['build'].join(
'site_config', '.rietveld_secret_key')
try:
build_path = self.m.path['build']
except KeyError: # pragma: no cover | TODO(nodir): cover
raise self.m.step.StepFailure(
'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')
email_file = build_path.join('site_config', '.rietveld_client_email')
key_file = build_path.join('site_config', '.rietveld_secret_key')
else: #pragma: no cover
#TODO(martiniss): make this use path.join, so it works on windows
email_file = '/creds/rietveld/client_email'

@ -65,6 +65,12 @@ class RietveldApi(recipe_api.RecipeApi):
issue_number = self.m.properties['issue']
if authentication == 'oauth2':
try:
build_path = self.m.path['build']
except KeyError: # pragma: no cover | TODO(nodir): cover
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')
step_result = self.m.python(
'apply_issue',
self.package_repo_resource('apply_issue.py'), [
@ -72,13 +78,10 @@ class RietveldApi(recipe_api.RecipeApi):
'-i', issue_number,
'-p', self.m.properties['patchset'],
'-s', rietveld_url,
'-E', self.m.path['build'].join('site_config',
'.rietveld_client_email'),
'-k', self.m.path['build'].join('site_config',
'.rietveld_secret_key')
],
)
'-E', build_path.join('site_config', '.rietveld_client_email'),
'-k', build_path.join('site_config', '.rietveld_secret_key'),
],
)
else:
step_result = self.m.python(
'apply_issue',

@ -104,7 +104,15 @@ class TryserverApi(recipe_api.RecipeApi):
patch_ref = self.m.properties['patch_ref']
patch_dir = self.m.path.mkdtemp('patch')
git_setup_py = self.m.path['build'].join('scripts', 'slave', 'git_setup.py')
try:
build_path = self.m.path['build']
except KeyError: # pragma: no cover | TODO(nodir): cover
raise self.m.step.StepFailure(
'path["build"] is not defined. '
'Possibly this is a LUCI build. '
'tryserver.apply_from_git is not supported in LUCI builds.')
git_setup_py = build_path.join('scripts', 'slave', 'git_setup.py')
git_setup_args = ['--path', patch_dir, '--url', patch_repo_url]
patch_path = patch_dir.join('patch.diff')

Loading…
Cancel
Save