Commit 1a5fe235 authored by Anthony Polito's avatar Anthony Polito Committed by LUCI CQ

add revision to scheduleBuild call for git cl try if needed.

Bug: 1043877
Change-Id: I5363dc1ad7f6b7e0ce9ce9885c86e357c3c65339
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2016162Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@google.com>
Commit-Queue: Anthony Polito <apolito@google.com>
parent bf4e7a72
......@@ -528,6 +528,14 @@ def _make_try_job_schedule_requests(changelist, buckets, options, patchset):
] + shared_tags,
}
})
if options.revision:
requests[-1]['scheduleBuild']['gitilesCommit'] = {
'host': gerrit_changes[0]['host'],
'project': gerrit_changes[0]['project'],
'id': options.revision
}
return requests
......
......@@ -3303,6 +3303,83 @@ class CMDTryTestCase(CMDTestCaseBase):
mockCallBuildbucket.assert_called_with(
mock.ANY, 'cr-buildbucket.appspot.com', 'Batch', expected_request)
@mock.patch('git_cl._call_buildbucket')
def testScheduleOnBuildbucketWithRevision(self, mockCallBuildbucket):
mockCallBuildbucket.return_value = {}
self.assertEqual(0, git_cl.main([
'try', '-B', 'luci.chromium.try', '-b', 'win', '-b', 'linux',
'-p', 'key=val', '-p', 'json=[{"a":1}, null]',
'-r', 'beeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeef']))
self.assertIn(
'Scheduling jobs on:\nBucket: luci.chromium.try',
git_cl.sys.stdout.getvalue())
expected_request = {
"requests": [{
"scheduleBuild": {
"requestId": "uuid4",
"builder": {
"project": "chromium",
"builder": "linux",
"bucket": "try",
},
"gerritChanges": [{
"project": "depot_tools",
"host": "chromium-review.googlesource.com",
"patchset": 7,
"change": 123456,
}],
"properties": {
"category": "git_cl_try",
"json": [{"a": 1}, None],
"key": "val",
},
"tags": [
{"value": "linux", "key": "builder"},
{"value": "git_cl_try", "key": "user_agent"},
],
"gitilesCommit": {
"host": "chromium-review.googlesource.com",
"project": "depot_tools",
"id": "beeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeef",
}
},
},
{
"scheduleBuild": {
"requestId": "uuid4",
"builder": {
"project": "chromium",
"builder": "win",
"bucket": "try",
},
"gerritChanges": [{
"project": "depot_tools",
"host": "chromium-review.googlesource.com",
"patchset": 7,
"change": 123456,
}],
"properties": {
"category": "git_cl_try",
"json": [{"a": 1}, None],
"key": "val",
},
"tags": [
{"value": "win", "key": "builder"},
{"value": "git_cl_try", "key": "user_agent"},
],
"gitilesCommit": {
"host": "chromium-review.googlesource.com",
"project": "depot_tools",
"id": "beeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeef",
}
},
}],
}
mockCallBuildbucket.assert_called_with(
mock.ANY, 'cr-buildbucket.appspot.com', 'Batch', expected_request)
def testScheduleOnBuildbucket_WrongBucket(self):
self.assertEqual(0, git_cl.main([
'try', '-B', 'not-a-bucket', '-b', 'win',
......
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