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

Unified Diff: scripts/slave/recipes/run_presubmit.py

Issue 2442203002: Update recipes to understand new Gerrit patch properties. (Closed)
Patch Set: Fix bugs. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: scripts/slave/recipes/run_presubmit.py
diff --git a/scripts/slave/recipes/run_presubmit.py b/scripts/slave/recipes/run_presubmit.py
index 33e504e82bb143e70dd0b166e7e3e33f47f8b964..44f249a68b5af328679a444c7515044b6380dc48 100644
--- a/scripts/slave/recipes/run_presubmit.py
+++ b/scripts/slave/recipes/run_presubmit.py
@@ -63,12 +63,19 @@ def _RunStepsInternal(api):
else:
presubmit_args.extend(['--rietveld_email', '']) # activate anonymous mode
elif patch_storage == 'gerrit':
- # Field event.patchSet.ref looks like 'refs/changes/11/338811/4'
- issue, patchset = api.properties['event.patchSet.ref'].split('/')[-2:]
+ gerrit_url = api.properties.get('patch_gerrit_url')
+ if not gerrit_url:
+ # TODO(tandrii): clean up old Gerrit patch properties.
+ # Field event.patchSet.ref looks like 'refs/changes/11/338811/4'
+ issue, patchset = api.properties['event.patchSet.ref'].split('/')[-2:]
+ gerrit_url = api.properties['gerrit']
+ else:
+ issue = api.properties.get('patch_issue')
+ patchset = api.properties.get('patch_set')
presubmit_args = [
'--issue', issue,
'--patchset', patchset,
- '--gerrit_url', api.properties['gerrit'],
+ '--gerrit_url', gerrit_url,
'--gerrit_fetch',
]
else: # pragma: no cover
@@ -166,7 +173,7 @@ def GenTests(api):
)
yield (
- api.test('infra_with_runhooks_and_gerrit') +
+ api.test('infra_with_runhooks_and_gerrit_deprecated') +
api.properties.tryserver_gerrit(
full_project_name='infra/infra',
repo_name='infra',
@@ -178,9 +185,21 @@ def GenTests(api):
)
yield (
+ api.test('infra_with_runhooks_and_gerrit') +
+ api.properties.tryserver(
+ gerrit_project='infra/infra',
+ repo_name='infra',
+ mastername='tryserver.infra',
+ buildername='infra_presubmit',
+ runhooks=True) +
+ api.step_data('presubmit', api.json.output([['infra_presubmit',
+ ['compile']]]))
+ )
+
+ yield (
api.test('depot_tools_and_gerrit') +
- api.properties.tryserver_gerrit(
- full_project_name='chromium/tools/depot_tools',
+ api.properties.tryserver(
+ gerrit_project='chromium/tools/depot_tools',
repo_name='depot_tools',
mastername='tryserver.infra',
buildername='presubmit_depot_tools',

Powered by Google App Engine
This is Rietveld 408576698