Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: recipe_modules/bot_update/api.py

Issue 2108073002: bot_update: Allow patch_oauth2 to work in kitchen (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Nits Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 """Recipe module to ensure a checkout is consistant on a bot.""" 6 """Recipe module to ensure a checkout is consistant on a bot."""
7 7
8 from recipe_engine import recipe_api 8 from recipe_engine import recipe_api
9 9
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return self.m.python(name, bot_update_path, cmd, **kwargs) 50 return self.m.python(name, bot_update_path, cmd, **kwargs)
51 51
52 @property 52 @property
53 def last_returned_properties(self): 53 def last_returned_properties(self):
54 return self._last_returned_properties 54 return self._last_returned_properties
55 55
56 def ensure_checkout(self, gclient_config=None, suffix=None, 56 def ensure_checkout(self, gclient_config=None, suffix=None,
57 patch=True, update_presentation=True, 57 patch=True, update_presentation=True,
58 force=False, patch_root=None, no_shallow=False, 58 force=False, patch_root=None, no_shallow=False,
59 with_branch_heads=False, refs=None, 59 with_branch_heads=False, refs=None,
60 patch_oauth2=False, 60 patch_oauth2=False, use_site_config_creds=True,
61 output_manifest=True, clobber=False, 61 output_manifest=True, clobber=False,
62 root_solution_revision=None, rietveld=None, issue=None, 62 root_solution_revision=None, rietveld=None, issue=None,
63 patchset=None, gerrit_no_reset=False, **kwargs): 63 patchset=None, gerrit_no_reset=False, **kwargs):
64 """ 64 """
65 Args: 65 Args:
66 use_site_config_creds: If the oauth2 credentials are in the buildbot
67 site_config. See crbug.com/624212 for more information.
66 gclient_config: The gclient configuration to use when running bot_update. 68 gclient_config: The gclient configuration to use when running bot_update.
67 If omitted, the current gclient configuration is used. 69 If omitted, the current gclient configuration is used.
68 rietveld: The rietveld server to use. If omitted, will infer from 70 rietveld: The rietveld server to use. If omitted, will infer from
69 the 'rietveld' property. 71 the 'rietveld' property.
70 issue: The rietveld issue number to use. If omitted, will infer from 72 issue: The rietveld issue number to use. If omitted, will infer from
71 the 'issue' property. 73 the 'issue' property.
72 patchset: The rietveld issue patchset to use. If omitted, will infer from 74 patchset: The rietveld issue patchset to use. If omitted, will infer from
73 the 'patchset' property. 75 the 'patchset' property.
74 """ 76 """
75 refs = refs or [] 77 refs = refs or []
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 114
113 # The gerrit_ref and gerrit_repo must be together or not at all. If one is 115 # The gerrit_ref and gerrit_repo must be together or not at all. If one is
114 # missing, clear both of them. 116 # missing, clear both of them.
115 if not gerrit_ref or not gerrit_repo: 117 if not gerrit_ref or not gerrit_repo:
116 gerrit_repo = gerrit_ref = None 118 gerrit_repo = gerrit_ref = None
117 assert (gerrit_ref != None) == (gerrit_repo != None) 119 assert (gerrit_ref != None) == (gerrit_repo != None)
118 120
119 # Point to the oauth2 auth files if specified. 121 # Point to the oauth2 auth files if specified.
120 # These paths are where the bots put their credential files. 122 # These paths are where the bots put their credential files.
121 if patch_oauth2: 123 if patch_oauth2:
122 email_file = self.m.path['build'].join( 124 # TODO(martiniss): remove this hack :(. crbug.com/624212
123 'site_config', '.rietveld_client_email') 125 if use_site_config_creds:
124 key_file = self.m.path['build'].join( 126 email_file = self.m.path['build'].join(
125 'site_config', '.rietveld_secret_key') 127 'site_config', '.rietveld_client_email')
128 key_file = self.m.path['build'].join(
129 'site_config', '.rietveld_secret_key')
130 else: #pragma: no cover
131 #TODO(martiniss): make this use path.join, so it works on windows
132 email_file = '/creds/rietveld/client_email'
133 key_file = '/creds/rietveld/secret_key'
126 else: 134 else:
127 email_file = key_file = None 135 email_file = key_file = None
128 136
129 # Allow patch_project's revision if necessary. 137 # Allow patch_project's revision if necessary.
130 # This is important for projects which are checked out as DEPS of the 138 # This is important for projects which are checked out as DEPS of the
131 # gclient solution. 139 # gclient solution.
132 self.m.gclient.set_patch_project_revision( 140 self.m.gclient.set_patch_project_revision(
133 self.m.properties.get('patch_project'), cfg) 141 self.m.properties.get('patch_project'), cfg)
134 142
135 rev_map = cfg.got_revision_mapping.as_jsonish() 143 rev_map = cfg.got_revision_mapping.as_jsonish()
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 282
275 # bot_update actually just sets root to be the folder name of the 283 # bot_update actually just sets root to be the folder name of the
276 # first solution. 284 # first solution.
277 if step_result.json.output['did_run']: 285 if step_result.json.output['did_run']:
278 co_root = step_result.json.output['root'] 286 co_root = step_result.json.output['root']
279 cwd = kwargs.get('cwd', self.m.path['slave_build']) 287 cwd = kwargs.get('cwd', self.m.path['slave_build'])
280 if 'checkout' not in self.m.path: 288 if 'checkout' not in self.m.path:
281 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) 289 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep))
282 290
283 return step_result 291 return step_result
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698