Commit 03da1506 authored by Andrii Shyshkalov's avatar Andrii Shyshkalov Committed by Commit Bot

git cl: delete Rietveld support for tryjobs.

R=ehmaldonado

Bug: 770408
Change-Id: Id070e6084b6beba7309bdc35f0f750decd77e0c9
Reviewed-on: https://chromium-review.googlesource.com/c/1279132
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
parent f5569d26
......@@ -5,7 +5,7 @@
# Copyright (C) 2008 Evan Martin <martine@danga.com>
"""A git-command for integrating reviews on Rietveld and Gerrit."""
"""A git-command for integrating reviews on Gerrit."""
from __future__ import print_function
......@@ -459,8 +459,7 @@ def _trigger_try_jobs(auth_config, changelist, buckets, options, patchset):
buildbucket_put_url = (
'https://{hostname}/_ah/api/buildbucket/v1/builds/batch'.format(
hostname=options.buildbucket_host))
buildset = 'patch/{codereview}/{hostname}/{issue}/{patch}'.format(
codereview='gerrit' if changelist.IsGerrit() else 'rietveld',
buildset = 'patch/gerrit/{hostname}/{issue}/{patch}'.format(
hostname=codereview_host,
issue=changelist.GetIssue(),
patch=patchset)
......@@ -552,8 +551,7 @@ def fetch_try_jobs(auth_config, changelist, buildbucket_host,
http.force_exception_to_status_code = True
buildset = 'patch/{codereview}/{hostname}/{issue}/{patch}'.format(
codereview='gerrit' if changelist.IsGerrit() else 'rietveld',
buildset = 'patch/gerrit/{hostname}/{issue}/{patch}'.format(
hostname=codereview_host,
issue=changelist.GetIssue(),
patch=patchset)
......@@ -2018,25 +2016,10 @@ class _RietveldChangelistImpl(_ChangelistCodereviewBase):
return self._props
def CannotTriggerTryJobReason(self):
props = self.GetIssueProperties()
if not props:
return 'Rietveld doesn\'t know about your issue %s' % self.GetIssue()
if props.get('closed'):
return 'CL %s is closed' % self.GetIssue()
if props.get('private'):
return 'CL %s is private' % self.GetIssue()
return None
raise NotImplementedError()
def GetTryJobProperties(self, patchset=None):
"""Returns dictionary of properties to launch try job."""
project = (self.GetIssueProperties() or {}).get('project')
return {
'issue': self.GetIssue(),
'patch_project': project,
'patch_storage': 'rietveld',
'patchset': patchset or self.GetPatchset(),
'rietveld': self.GetCodereviewServer(),
}
raise NotImplementedError()
def GetIssueOwner(self):
return (self.GetIssueProperties() or {}).get('owner_email')
......
......@@ -2468,7 +2468,6 @@ class TestGitCl(TestCase):
u'category': u'git_cl_try',
u'key': u'val',
u'json': [{u'a': 1}, None],
u'master': u'tryserver.chromium',
u'patch_gerrit_url':
u'https://chromium-review.googlesource.com',
......@@ -2482,79 +2481,24 @@ class TestGitCl(TestCase):
}
})
self.assertEqual(build, {
u'bucket': u'master.tryserver.chromium',
u'bucket': u'luci.chromium.try',
u'client_operation_id': u'uuid4',
u'tags': [
u'builder:win',
u'buildset:patch/gerrit/chromium-review.googlesource.com/123456/7',
u'user_agent:git_cl_try',
u'master:tryserver.chromium'],
],
})
self.mock(git_cl, '_buildbucket_retry', _buildbucket_retry)
self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
self.assertEqual(0, git_cl.main([
'try', '-m', 'tryserver.chromium', '-b', 'win',
'try', '-B', 'luci.chromium.try', '-b', 'win',
'-p', 'key=val', '-p', 'json=[{"a":1}, null]']))
self.assertRegexpMatches(
git_cl.sys.stdout.getvalue(),
'Tried jobs on:\nBucket: master.tryserver.chromium')
def test_git_cl_try_buildbucket_bucket_flag(self):
self.mock(git_cl._RietveldChangelistImpl, 'GetIssueProperties',
lambda _: {
'owner_email': 'owner@e.mail',
'private': False,
'closed': False,
'project': 'depot_tools',
'patchsets': [20001],
})
self.mock(git_cl.uuid, 'uuid4', lambda: 'uuid4')
self.calls = [
((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
((['git', 'config', 'branch.feature.rietveldissue'],), '123'),
((['git', 'config', 'rietveld.autoupdate'],), CERR1),
((['git', 'config', 'rietveld.server'],),
'https://codereview.chromium.org'),
((['git', 'config', 'branch.feature.rietveldpatchset'],), '20001'),
((['git', 'config', 'branch.feature.rietveldserver'],), CERR1),
]
def _buildbucket_retry(*_, **kw):
body = json.loads(kw['body'])
self.assertEqual(len(body['builds']), 1)
build = body['builds'][0]
params = json.loads(build.pop('parameters_json'))
self.assertEqual(params, {
u'builder_name': u'win',
u'changes': [{u'author': {u'email': u'owner@e.mail'},
u'revision': None}],
u'properties': {
u'category': u'git_cl_try',
u'issue': 123,
u'patch_project': u'depot_tools',
u'patch_storage': u'rietveld',
u'patchset': 20001,
u'rietveld': u'https://codereview.chromium.org',
}
})
self.assertEqual(build, {
u'bucket': u'test.bucket',
u'client_operation_id': u'uuid4',
u'tags': [u'builder:win',
u'buildset:patch/rietveld/codereview.chromium.org/123/20001',
u'user_agent:git_cl_try'],
})
self.mock(git_cl, '_buildbucket_retry', _buildbucket_retry)
self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
self.assertEqual(0, git_cl.main([
'try', '-B', 'test.bucket', '-b', 'win']))
self.assertRegexpMatches(
git_cl.sys.stdout.getvalue(),
'Tried jobs on:\nBucket: test.bucket')
'Tried jobs on:\nBucket: luci.chromium.try')
def test_git_cl_try_bots_on_multiple_masters(self):
self.mock(git_cl.Changelist, 'GetMostRecentPatchset', lambda _: 7)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment