OLD | NEW |
---|---|
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 Loading... | |
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, patch_oauth2_in_puppet=False, |
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 patch_oauth2_in_puppet: If the oauth2 credentials live in puppet, or in | |
Vadim Sh.
2016/06/29 03:58:08
this is misleading, in both cases they are managed
martiniss
2016/06/29 04:32:08
went with 'use_site_config_creds'
| |
67 the buildbot 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 Loading... | |
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 patch_oauth2_in_puppet: #pragma: no cover |
124 key_file = self.m.path['build'].join( | 126 email_file = '/creds/refresh_tokens/rietveld_client_email' |
Vadim Sh.
2016/06/29 03:58:08
this is going to be
/creds/rietveld/client_email
martiniss
2016/06/29 04:32:08
Done.
| |
125 'site_config', '.rietveld_secret_key') | 127 key_file = '/creds/refresh_tokens/rietveld_secret_key' |
128 else: | |
129 email_file = self.m.path['build'].join( | |
130 'site_config', '.rietveld_client_email') | |
131 key_file = self.m.path['build'].join( | |
132 'site_config', '.rietveld_secret_key') | |
126 else: | 133 else: |
127 email_file = key_file = None | 134 email_file = key_file = None |
128 | 135 |
129 # Allow patch_project's revision if necessary. | 136 # Allow patch_project's revision if necessary. |
130 # This is important for projects which are checked out as DEPS of the | 137 # This is important for projects which are checked out as DEPS of the |
131 # gclient solution. | 138 # gclient solution. |
132 self.m.gclient.set_patch_project_revision( | 139 self.m.gclient.set_patch_project_revision( |
133 self.m.properties.get('patch_project'), cfg) | 140 self.m.properties.get('patch_project'), cfg) |
134 | 141 |
135 rev_map = cfg.got_revision_mapping.as_jsonish() | 142 rev_map = cfg.got_revision_mapping.as_jsonish() |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 | 281 |
275 # bot_update actually just sets root to be the folder name of the | 282 # bot_update actually just sets root to be the folder name of the |
276 # first solution. | 283 # first solution. |
277 if step_result.json.output['did_run']: | 284 if step_result.json.output['did_run']: |
278 co_root = step_result.json.output['root'] | 285 co_root = step_result.json.output['root'] |
279 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 286 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
280 if 'checkout' not in self.m.path: | 287 if 'checkout' not in self.m.path: |
281 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 288 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
282 | 289 |
283 return step_result | 290 return step_result |
OLD | NEW |