mirrored from https://chromium.googlesource.com/infra/luci/recipes-py
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathemit_triggers.py
64 lines (57 loc) · 1.7 KB
/
emit_triggers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright 2018 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""This file is a recipe demonstrating emitting triggers to LUCI Scheduler."""
DEPS = [
'buildbucket',
'json',
'runtime',
'scheduler',
'time',
]
def RunSteps(api):
if api.runtime.is_experimental:
api.scheduler.set_host('https://luci-scheduler-dev.appspot.com')
api.scheduler.emit_trigger(
api.scheduler.BuildbucketTrigger(
properties={'some': 'none'},
tags={'this': 'test'},
inherit_tags=False,
url='https://example.com',
),
project='proj',
jobs=['job1', 'job2'],
)
api.scheduler.emit_triggers(
[
(
api.scheduler.BuildbucketTrigger(
properties={'some': 'none'},
tags={'this': 'test'},
),
'proj',
['job1', 'job2']
),
(
api.scheduler.GitilesTrigger(
repo='https://chromium.googlesource.com/chromium/src',
ref='refs/branch-heads/1235',
revision='2d2b87e5f9c872902d8508f6377470a4a6fa87e1',
title='advanced gitiles trigger'
),
'proj3',
['job1'],
),
],
timestamp_usec=int(api.time.time()*1e6),
step_name='custom-batch-step',
)
def GenTests(api):
yield (
api.test('basic')
+ api.runtime(is_experimental=True)
+ api.buildbucket.ci_build(builder='compiler', build_number=123)
+ api.step_data('luci-scheduler.EmitTriggers', stdout=api.json.output({}))
+ api.step_data('luci-scheduler.EmitTriggers', stdout=api.json.output({}))
)
# TODO: add failure example.