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

Side by Side Diff: recipes/recipe_modules/recipe_autoroller/api.py

Issue 2257123003: recipe_autoroller: always set cwd to workdir (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 4 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 | recipes/recipes/recipe_autoroller.expected/basic.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 import base64 5 import base64
6 import hashlib 6 import hashlib
7 import json 7 import json
8 import re 8 import re
9 9
10 from recipe_engine import recipe_api 10 from recipe_engine import recipe_api
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 # Introduce ourselves to git - also needed for git cl upload to work. 172 # Introduce ourselves to git - also needed for git cl upload to work.
173 self.m.git( 173 self.m.git(
174 'config', 'user.email', 'recipe-roller@chromium.org', cwd=workdir) 174 'config', 'user.email', 'recipe-roller@chromium.org', cwd=workdir)
175 self.m.git('config', 'user.name', 'recipe-roller', cwd=workdir) 175 self.m.git('config', 'user.name', 'recipe-roller', cwd=workdir)
176 176
177 # git cl upload cannot work with detached HEAD, it requires a branch. 177 # git cl upload cannot work with detached HEAD, it requires a branch.
178 self.m.git('checkout', '-t', '-b', 'roll', 'origin/master', cwd=workdir) 178 self.m.git('checkout', '-t', '-b', 'roll', 'origin/master', cwd=workdir)
179 179
180 # Check status of last known CL for this repo. Ensure there's always 180 # Check status of last known CL for this repo. Ensure there's always
181 # at most one roll CL in flight. 181 # at most one roll CL in flight.
182 repo_data, cl_status = self._get_pending_cl_status( 182 with self.m.step.context({'cwd': workdir}):
183 project_data['repo_url']) 183 repo_data, cl_status = self._get_pending_cl_status(
184 project_data['repo_url'])
184 if repo_data: 185 if repo_data:
185 # Allow trivial rolls in CQ to finish. 186 # Allow trivial rolls in CQ to finish.
186 if repo_data['trivial'] and cl_status == 'commit': 187 if repo_data['trivial'] and cl_status == 'commit':
187 return ROLL_SUCCESS 188 return ROLL_SUCCESS
188 189
189 # Allow non-trivial rolls to wait for review comments. 190 # Allow non-trivial rolls to wait for review comments.
190 if not repo_data['trivial'] and cl_status != 'closed': 191 if not repo_data['trivial'] and cl_status != 'closed':
191 return ROLL_SUCCESS 192 return ROLL_SUCCESS
192 193
193 # We're about to upload a new CL, so close the old one. 194 # We're about to upload a new CL, so close the old one.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 'cl', 'status', 369 'cl', 'status',
369 '--issue', repo_data['issue'], 370 '--issue', repo_data['issue'],
370 '--rietveld', 371 '--rietveld',
371 '--field', 'status', 372 '--field', 'status',
372 name='git cl status', stdout=self.m.raw_io.output(), 373 name='git cl status', stdout=self.m.raw_io.output(),
373 step_test_data=lambda: self.m.raw_io.test_api.stream_output( 374 step_test_data=lambda: self.m.raw_io.test_api.stream_output(
374 'foo') 375 'foo')
375 ).stdout.strip() 376 ).stdout.strip()
376 377
377 return repo_data, status_result 378 return repo_data, status_result
OLDNEW
« no previous file with comments | « no previous file | recipes/recipes/recipe_autoroller.expected/basic.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698