Chromium Code Reviews| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 if gerrit_no_reset: | 65 if gerrit_no_reset: |
| 66 cmd.append('--gerrit_no_reset') | 66 cmd.append('--gerrit_no_reset') |
| 67 if gerrit_no_rebase_patch_ref or not gerrit_rebase_patch_ref: | 67 if gerrit_no_rebase_patch_ref or not gerrit_rebase_patch_ref: |
| 68 cmd.append('--gerrit_no_rebase_patch_ref') | 68 cmd.append('--gerrit_no_rebase_patch_ref') |
| 69 return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs) | 69 return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs) |
| 70 | 70 |
| 71 def ensure_checkout(self, gclient_config=None, suffix=None, | 71 def ensure_checkout(self, gclient_config=None, suffix=None, |
| 72 patch=True, update_presentation=True, | 72 patch=True, update_presentation=True, |
| 73 force=False, patch_root=None, no_shallow=False, | 73 force=False, patch_root=None, no_shallow=False, |
| 74 with_branch_heads=False, refs=None, | 74 with_branch_heads=False, refs=None, |
| 75 patch_oauth2=False, use_site_config_creds=True, | 75 patch_oauth2=False, oauth2_json=None, |
| 76 use_site_config_creds=True, | |
| 76 output_manifest=True, clobber=False, | 77 output_manifest=True, clobber=False, |
| 77 root_solution_revision=None, rietveld=None, issue=None, | 78 root_solution_revision=None, rietveld=None, issue=None, |
| 78 patchset=None, gerrit_no_reset=False, | 79 patchset=None, gerrit_no_reset=False, |
| 79 gerrit_no_rebase_patch_ref=False, | 80 gerrit_no_rebase_patch_ref=False, |
| 80 gerrit_rebase_patch_ref=True, **kwargs): | 81 gerrit_rebase_patch_ref=True, **kwargs): |
| 81 """ | 82 """ |
| 82 Args: | 83 Args: |
| 83 use_site_config_creds: If the oauth2 credentials are in the buildbot | 84 use_site_config_creds: If the oauth2 credentials are in the buildbot |
| 84 site_config. See crbug.com/624212 for more information. | 85 site_config. See crbug.com/624212 for more information. |
| 85 gclient_config: The gclient configuration to use when running bot_update. | 86 gclient_config: The gclient configuration to use when running bot_update. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 # These paths are where the bots put their credential files. | 142 # These paths are where the bots put their credential files. |
| 142 if patch_oauth2: | 143 if patch_oauth2: |
| 143 # TODO(martiniss): remove this hack :(. crbug.com/624212 | 144 # TODO(martiniss): remove this hack :(. crbug.com/624212 |
| 144 if use_site_config_creds: | 145 if use_site_config_creds: |
| 145 email_file = self.m.path['build'].join( | 146 email_file = self.m.path['build'].join( |
| 146 'site_config', '.rietveld_client_email') | 147 'site_config', '.rietveld_client_email') |
| 147 key_file = self.m.path['build'].join( | 148 key_file = self.m.path['build'].join( |
| 148 'site_config', '.rietveld_secret_key') | 149 'site_config', '.rietveld_secret_key') |
| 149 else: #pragma: no cover | 150 else: #pragma: no cover |
| 150 #TODO(martiniss): make this use path.join, so it works on windows | 151 #TODO(martiniss): make this use path.join, so it works on windows |
| 151 email_file = '/creds/rietveld/client_email' | 152 email_file = '/creds/rietveld/client_email' |
|
Vadim Sh.
2016/08/31 22:02:24
please make email_file and key_file None if oauth2
Ryan Tseng
2016/09/19 19:01:27
Done.
| |
| 152 key_file = '/creds/rietveld/secret_key' | 153 key_file = '/creds/rietveld/secret_key' |
| 153 else: | 154 else: |
| 154 email_file = key_file = None | 155 email_file = key_file = None |
| 155 | 156 |
| 156 # Allow patch_project's revision if necessary. | 157 # Allow patch_project's revision if necessary. |
| 157 # This is important for projects which are checked out as DEPS of the | 158 # This is important for projects which are checked out as DEPS of the |
| 158 # gclient solution. | 159 # gclient solution. |
| 159 self.m.gclient.set_patch_project_revision( | 160 self.m.gclient.set_patch_project_revision( |
| 160 self.m.properties.get('patch_project'), cfg) | 161 self.m.properties.get('patch_project'), cfg) |
| 161 | 162 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 175 | 176 |
| 176 # 3. How to find the patch, if any (issue/patchset/patch_url). | 177 # 3. How to find the patch, if any (issue/patchset/patch_url). |
| 177 ['--issue', issue], | 178 ['--issue', issue], |
| 178 ['--patchset', patchset], | 179 ['--patchset', patchset], |
| 179 ['--patch_url', patch_url], | 180 ['--patch_url', patch_url], |
| 180 ['--rietveld_server', rietveld or self._rietveld], | 181 ['--rietveld_server', rietveld or self._rietveld], |
| 181 ['--gerrit_repo', gerrit_repo], | 182 ['--gerrit_repo', gerrit_repo], |
| 182 ['--gerrit_ref', gerrit_ref], | 183 ['--gerrit_ref', gerrit_ref], |
| 183 ['--apply_issue_email_file', email_file], | 184 ['--apply_issue_email_file', email_file], |
| 184 ['--apply_issue_key_file', key_file], | 185 ['--apply_issue_key_file', key_file], |
| 186 ['--apply_issue_oauth2_file', oauth2_json], | |
| 185 | 187 |
| 186 # 4. Hookups to JSON output back into recipes. | 188 # 4. Hookups to JSON output back into recipes. |
| 187 ['--output_json', self.m.json.output()],] | 189 ['--output_json', self.m.json.output()],] |
| 188 | 190 |
| 189 | 191 |
| 190 # Collect all fixed revisions to simulate them in the json output. | 192 # Collect all fixed revisions to simulate them in the json output. |
| 191 # Fixed revision are the explicit input revisions of bot_update.py, i.e. | 193 # Fixed revision are the explicit input revisions of bot_update.py, i.e. |
| 192 # every command line parameter "--revision name@value". | 194 # every command line parameter "--revision name@value". |
| 193 fixed_revisions = {} | 195 fixed_revisions = {} |
| 194 | 196 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 | 310 |
| 309 # bot_update actually just sets root to be the folder name of the | 311 # bot_update actually just sets root to be the folder name of the |
| 310 # first solution. | 312 # first solution. |
| 311 if step_result.json.output['did_run']: | 313 if step_result.json.output['did_run']: |
| 312 co_root = step_result.json.output['root'] | 314 co_root = step_result.json.output['root'] |
| 313 cwd = kwargs.get('cwd', self.m.path['slave_build']) | 315 cwd = kwargs.get('cwd', self.m.path['slave_build']) |
| 314 if 'checkout' not in self.m.path: | 316 if 'checkout' not in self.m.path: |
| 315 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) | 317 self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) |
| 316 | 318 |
| 317 return step_result | 319 return step_result |
| OLD | NEW |