Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | # Copyright 2018 The Chromium OS Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | """Test gen_luci_scheduler.""" |
| 7 | from __future__ import print_function |
| 8 | |
Mike Frysinger | 74a6cc8 | 2020-02-14 14:16:22 -0500 | [diff] [blame] | 9 | import sys |
| 10 | |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 11 | from chromite.config import chromeos_config |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 12 | from chromite.lib import cros_test_lib |
| 13 | from chromite.lib import config_lib |
| 14 | from chromite.lib import config_lib_unittest |
| 15 | from chromite.scripts import gen_luci_scheduler |
| 16 | |
Mike Frysinger | 74a6cc8 | 2020-02-14 14:16:22 -0500 | [diff] [blame] | 17 | |
| 18 | assert sys.version_info >= (3, 6), 'This module requires Python 3.6+' |
| 19 | |
| 20 | |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 21 | # It's reasonable for unittests to look at internals. |
| 22 | # pylint: disable=protected-access |
| 23 | |
| 24 | |
| 25 | class GenLuciSchedulerTest(cros_test_lib.MockTestCase): |
| 26 | """Tests for cbuildbot_launch script.""" |
| 27 | def testSanityAgainstProd(self): |
| 28 | """Test we can generate a luci scheduler config with live data.""" |
| 29 | # If it runs without crashing, we pass. |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 30 | gen_luci_scheduler.genLuciSchedulerConfig( |
| 31 | config_lib.GetConfig(), chromeos_config.BranchScheduleConfig()) |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 32 | |
| 33 | def testGenSchedulerJob(self): |
| 34 | """Test the job creation helper.""" |
| 35 | build_config = config_lib_unittest.MockBuildConfig().apply( |
| 36 | schedule='funky schedule' |
| 37 | ) |
| 38 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 39 | expected = """ |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 40 | job { |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 41 | id: "amd64-generic-release" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 42 | realm: "cbb-jobs" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 43 | acl_sets: "default" |
| 44 | schedule: "funky schedule" |
| 45 | buildbucket: { |
| 46 | server: "cr-buildbucket.appspot.com" |
| 47 | bucket: "luci.chromeos.general" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 48 | builder: "LegacyRelease" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 49 | tags: "cbb_branch:main" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 50 | tags: "cbb_config:amd64-generic-release" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 51 | tags: "cbb_display_label:MockLabel" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 52 | properties: "cbb_branch:main" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 53 | properties: "cbb_config:amd64-generic-release" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 54 | properties: "cbb_display_label:MockLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 55 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 56 | } |
| 57 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 58 | """ |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 59 | |
| 60 | result = gen_luci_scheduler.genSchedulerJob(build_config) |
| 61 | self.assertEqual(result, expected) |
| 62 | |
| 63 | def testGenSchedulerTriggerSimple(self): |
| 64 | """Test the trigger creation helper.""" |
| 65 | trigger_name = 'simple' |
| 66 | repo = 'url://repo' |
| 67 | refs = ['refs/path'] |
David Burger | cba0d27 | 2020-06-24 16:21:26 -0600 | [diff] [blame] | 68 | path_regexps = ['path/regexps'] |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 69 | builds = ['test_build'] |
| 70 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 71 | expected = """ |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 72 | trigger { |
| 73 | id: "simple" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 74 | realm: "cbb-jobs" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 75 | acl_sets: "default" |
| 76 | schedule: "with 5m interval" |
| 77 | gitiles: { |
| 78 | repo: "url://repo" |
| 79 | refs: "refs/path" |
David Burger | cba0d27 | 2020-06-24 16:21:26 -0600 | [diff] [blame] | 80 | path_regexps: "path/regexps" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 81 | } |
| 82 | triggers: "test_build" |
| 83 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 84 | """ |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 85 | |
| 86 | result = gen_luci_scheduler.genSchedulerTrigger( |
David Burger | cba0d27 | 2020-06-24 16:21:26 -0600 | [diff] [blame] | 87 | trigger_name, repo, refs, path_regexps, builds) |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 88 | |
| 89 | self.assertEqual(result, expected) |
| 90 | |
| 91 | def testGenSchedulerTriggerComplex(self): |
| 92 | """Test the trigger creation helper.""" |
| 93 | trigger_name = 'complex' |
| 94 | repo = 'url://repo' |
| 95 | refs = ['refs/path', 'refs/other_path'] |
| 96 | builds = ['test_build_a', 'test_build_b'] |
| 97 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 98 | expected = """ |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 99 | trigger { |
| 100 | id: "complex" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 101 | realm: "cbb-jobs" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 102 | acl_sets: "default" |
| 103 | schedule: "with 5m interval" |
| 104 | gitiles: { |
| 105 | repo: "url://repo" |
| 106 | refs: "refs/path" |
| 107 | refs: "refs/other_path" |
| 108 | } |
| 109 | triggers: "test_build_a" |
| 110 | triggers: "test_build_b" |
| 111 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 112 | """ |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 113 | |
| 114 | result = gen_luci_scheduler.genSchedulerTrigger( |
David Burger | cba0d27 | 2020-06-24 16:21:26 -0600 | [diff] [blame] | 115 | trigger_name, repo, refs, None, builds) |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 116 | |
| 117 | self.assertEqual(result, expected) |
| 118 | |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 119 | |
| 120 | def testGenSchedulerBranched(self): |
| 121 | """Test the job creation helper.""" |
| 122 | build_config = config_lib_unittest.MockBuildConfig().apply( |
| 123 | schedule_branch='mock_branch', |
| 124 | schedule='funky schedule', |
| 125 | ) |
| 126 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 127 | expected = """ |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 128 | job { |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 129 | id: "mock_branch-amd64-generic-release" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 130 | realm: "cbb-jobs" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 131 | acl_sets: "default" |
| 132 | schedule: "funky schedule" |
| 133 | buildbucket: { |
| 134 | server: "cr-buildbucket.appspot.com" |
| 135 | bucket: "luci.chromeos.general" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 136 | builder: "LegacyRelease" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 137 | tags: "cbb_branch:mock_branch" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 138 | tags: "cbb_config:amd64-generic-release" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 139 | tags: "cbb_display_label:MockLabel" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 140 | properties: "cbb_branch:mock_branch" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 141 | properties: "cbb_config:amd64-generic-release" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 142 | properties: "cbb_display_label:MockLabel" |
| 143 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 144 | } |
| 145 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 146 | """ |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 147 | |
| 148 | result = gen_luci_scheduler.genSchedulerJob(build_config) |
| 149 | self.assertEqual(result, expected) |
| 150 | |
| 151 | def testGenSchedulerWorkspaceBranch(self): |
| 152 | """Test the job creation helper.""" |
| 153 | build_config = config_lib_unittest.MockBuildConfig().apply( |
| 154 | workspace_branch='work_branch', |
| 155 | schedule='funky schedule', |
| 156 | ) |
| 157 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 158 | expected = """ |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 159 | job { |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 160 | id: "amd64-generic-release" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 161 | realm: "cbb-jobs" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 162 | acl_sets: "default" |
| 163 | schedule: "funky schedule" |
| 164 | buildbucket: { |
| 165 | server: "cr-buildbucket.appspot.com" |
| 166 | bucket: "luci.chromeos.general" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 167 | builder: "LegacyRelease" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 168 | tags: "cbb_branch:main" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 169 | tags: "cbb_config:amd64-generic-release" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 170 | tags: "cbb_display_label:MockLabel" |
| 171 | tags: "cbb_workspace_branch:work_branch" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 172 | properties: "cbb_branch:main" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 173 | properties: "cbb_config:amd64-generic-release" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 174 | properties: "cbb_display_label:MockLabel" |
| 175 | properties: "cbb_workspace_branch:work_branch" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 176 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 177 | } |
| 178 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 179 | """ |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 180 | |
| 181 | result = gen_luci_scheduler.genSchedulerJob(build_config) |
| 182 | self.assertEqual(result, expected) |
| 183 | |
Yoshisato Yanagisawa | 16285b4 | 2018-09-19 14:00:58 +0900 | [diff] [blame] | 184 | def testGenSchedulerGomaClientType(self): |
| 185 | """Test the job creation helper.""" |
| 186 | build_config = config_lib_unittest.MockBuildConfig().apply( |
| 187 | goma_client_type='client_type', |
| 188 | schedule='funky schedule', |
| 189 | ) |
| 190 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 191 | expected = """ |
Yoshisato Yanagisawa | 16285b4 | 2018-09-19 14:00:58 +0900 | [diff] [blame] | 192 | job { |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 193 | id: "amd64-generic-release" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 194 | realm: "cbb-jobs" |
Yoshisato Yanagisawa | 16285b4 | 2018-09-19 14:00:58 +0900 | [diff] [blame] | 195 | acl_sets: "default" |
| 196 | schedule: "funky schedule" |
| 197 | buildbucket: { |
| 198 | server: "cr-buildbucket.appspot.com" |
| 199 | bucket: "luci.chromeos.general" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 200 | builder: "LegacyRelease" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 201 | tags: "cbb_branch:main" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 202 | tags: "cbb_config:amd64-generic-release" |
Yoshisato Yanagisawa | 16285b4 | 2018-09-19 14:00:58 +0900 | [diff] [blame] | 203 | tags: "cbb_display_label:MockLabel" |
| 204 | tags: "cbb_goma_client_type:client_type" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 205 | properties: "cbb_branch:main" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 206 | properties: "cbb_config:amd64-generic-release" |
Yoshisato Yanagisawa | 16285b4 | 2018-09-19 14:00:58 +0900 | [diff] [blame] | 207 | properties: "cbb_display_label:MockLabel" |
| 208 | properties: "cbb_goma_client_type:client_type" |
| 209 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 210 | } |
| 211 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 212 | """ |
Yoshisato Yanagisawa | 16285b4 | 2018-09-19 14:00:58 +0900 | [diff] [blame] | 213 | |
| 214 | result = gen_luci_scheduler.genSchedulerJob(build_config) |
| 215 | self.assertEqual(result, expected) |
| 216 | |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 217 | def testGenLuciSchedulerConfig(self): |
| 218 | """Test a full LUCI Scheduler config file.""" |
| 219 | site_config = config_lib.SiteConfig() |
| 220 | |
| 221 | site_config.Add( |
| 222 | 'not_scheduled', |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 223 | luci_builder='ReleaseBuilder', |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 224 | display_label='MockLabel', |
| 225 | ) |
| 226 | |
| 227 | site_config.Add( |
| 228 | 'build_prod', |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 229 | luci_builder='ReleaseBuilder', |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 230 | display_label='MockLabel', |
| 231 | schedule='run once in a while', |
| 232 | ) |
| 233 | |
| 234 | site_config.Add( |
| 235 | 'build_tester', |
| 236 | luci_builder='TestBuilder', |
| 237 | display_label='TestLabel', |
| 238 | schedule='run daily', |
| 239 | ) |
| 240 | |
| 241 | site_config.Add( |
| 242 | 'build_triggered_a', |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 243 | luci_builder='ReleaseBuilder', |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 244 | display_label='MockLabel', |
| 245 | schedule='triggered', |
| 246 | triggered_gitiles=[[ |
| 247 | 'gitiles_url_a', |
| 248 | ['ref_a', 'ref_b'], |
| 249 | ], [ |
| 250 | 'gitiles_url_b', |
| 251 | ['ref_c'], |
| 252 | ]], |
| 253 | ) |
| 254 | |
| 255 | site_config.Add( |
| 256 | 'build_triggered_b', |
| 257 | luci_builder='ProdBuilder', |
| 258 | display_label='MockLabel', |
| 259 | schedule='triggered', |
| 260 | triggered_gitiles=[[ |
| 261 | 'gitiles_url_b', |
| 262 | ['ref_c'], |
| 263 | ]], |
| 264 | ) |
| 265 | |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 266 | default_config = config_lib.GetConfig().GetDefault() |
| 267 | |
| 268 | branch_configs = [ |
| 269 | default_config.derive( |
| 270 | name='branch_tester', |
| 271 | luci_builder='TestBuilder', |
| 272 | display_label='TestLabel', |
| 273 | schedule='run daily', |
| 274 | schedule_branch='test-branch', |
| 275 | ), |
Don Garrett | 9a0d90c | 2018-10-30 12:47:14 -0700 | [diff] [blame] | 276 | default_config.derive( |
| 277 | name='branch_tester_triggered', |
| 278 | luci_builder='TestBuilder', |
| 279 | display_label='TestLabel', |
| 280 | schedule='run daily', |
| 281 | schedule_branch='test-branch', |
| 282 | triggered_gitiles=[[ |
| 283 | 'gitiles_url_a', |
| 284 | ['ref_a', 'ref_b'], |
| 285 | ]], |
| 286 | ), |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 287 | ] |
| 288 | |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 289 | expected = """# Defines buckets on luci-scheduler.appspot.com. |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 290 | # |
| 291 | # For schema of this file and documentation see ProjectConfig message in |
Mike Frysinger | 92dc649 | 2021-02-17 16:01:09 -0500 | [diff] [blame] | 292 | # https://github.com/luci/luci-go/blob/HEAD/scheduler/appengine/messages/config.proto |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 293 | |
| 294 | # Generated with chromite/scripts/gen_luci_scheduler |
| 295 | |
Don Garrett | ff45f4b | 2018-10-04 09:08:01 -0700 | [diff] [blame] | 296 | # Autodeployed with: |
| 297 | # http://cros-goldeneye/chromeos/legoland/builderHistory?buildConfig=luci-scheduler-updater |
| 298 | |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 299 | acl_sets { |
| 300 | name: "default" |
| 301 | acls { |
| 302 | role: READER |
| 303 | granted_to: "group:googlers" |
| 304 | } |
| 305 | acls { |
| 306 | role: OWNER |
| 307 | granted_to: "group:project-chromeos-admins" |
| 308 | } |
Jason D. Clinton | a9e374a | 2018-10-18 18:41:00 -0600 | [diff] [blame] | 309 | acls { |
| 310 | role: TRIGGERER |
| 311 | granted_to: "group:mdb/chromeos-build-access" |
LaMont Jones | 48ddfd9 | 2020-09-16 13:46:41 -0600 | [diff] [blame] | 312 | } |
| 313 | acls { |
| 314 | role: TRIGGERER |
LaMont Jones | d1bb000 | 2020-09-16 09:35:10 -0600 | [diff] [blame] | 315 | granted_to: "group:project-chromeos-buildbucket-schedulers" |
Jason D. Clinton | a9e374a | 2018-10-18 18:41:00 -0600 | [diff] [blame] | 316 | } |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | trigger { |
| 320 | id: "trigger_0" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 321 | realm: "cbb-jobs" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 322 | acl_sets: "default" |
| 323 | schedule: "with 5m interval" |
| 324 | gitiles: { |
| 325 | repo: "gitiles_url_a" |
| 326 | refs: "ref_a" |
| 327 | refs: "ref_b" |
| 328 | } |
| 329 | triggers: "build_triggered_a" |
Don Garrett | 9a0d90c | 2018-10-30 12:47:14 -0700 | [diff] [blame] | 330 | triggers: "test-branch-branch_tester_triggered" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 331 | } |
| 332 | |
| 333 | trigger { |
| 334 | id: "trigger_1" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 335 | realm: "cbb-jobs" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 336 | acl_sets: "default" |
| 337 | schedule: "with 5m interval" |
| 338 | gitiles: { |
| 339 | repo: "gitiles_url_b" |
| 340 | refs: "ref_c" |
| 341 | } |
| 342 | triggers: "build_triggered_a" |
| 343 | triggers: "build_triggered_b" |
| 344 | } |
| 345 | |
| 346 | job { |
| 347 | id: "build_prod" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 348 | realm: "cbb-jobs" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 349 | acl_sets: "default" |
| 350 | schedule: "run once in a while" |
| 351 | buildbucket: { |
| 352 | server: "cr-buildbucket.appspot.com" |
| 353 | bucket: "luci.chromeos.general" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 354 | builder: "ReleaseBuilder" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 355 | tags: "cbb_branch:main" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 356 | tags: "cbb_config:build_prod" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 357 | tags: "cbb_display_label:MockLabel" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 358 | properties: "cbb_branch:main" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 359 | properties: "cbb_config:build_prod" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 360 | properties: "cbb_display_label:MockLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 361 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | job { |
| 366 | id: "build_tester" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 367 | realm: "cbb-jobs" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 368 | acl_sets: "default" |
| 369 | schedule: "run daily" |
| 370 | buildbucket: { |
| 371 | server: "cr-buildbucket.appspot.com" |
| 372 | bucket: "luci.chromeos.general" |
| 373 | builder: "TestBuilder" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 374 | tags: "cbb_branch:main" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 375 | tags: "cbb_config:build_tester" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 376 | tags: "cbb_display_label:TestLabel" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 377 | properties: "cbb_branch:main" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 378 | properties: "cbb_config:build_tester" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 379 | properties: "cbb_display_label:TestLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 380 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | job { |
| 385 | id: "build_triggered_a" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 386 | realm: "cbb-jobs" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 387 | acl_sets: "default" |
| 388 | schedule: "triggered" |
| 389 | buildbucket: { |
| 390 | server: "cr-buildbucket.appspot.com" |
| 391 | bucket: "luci.chromeos.general" |
Mike Nichols | 9e47e84 | 2020-08-11 15:23:56 -0600 | [diff] [blame] | 392 | builder: "ReleaseBuilder" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 393 | tags: "cbb_branch:main" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 394 | tags: "cbb_config:build_triggered_a" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 395 | tags: "cbb_display_label:MockLabel" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 396 | properties: "cbb_branch:main" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 397 | properties: "cbb_config:build_triggered_a" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 398 | properties: "cbb_display_label:MockLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 399 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | job { |
| 404 | id: "build_triggered_b" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 405 | realm: "cbb-jobs" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 406 | acl_sets: "default" |
| 407 | schedule: "triggered" |
| 408 | buildbucket: { |
| 409 | server: "cr-buildbucket.appspot.com" |
| 410 | bucket: "luci.chromeos.general" |
| 411 | builder: "ProdBuilder" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 412 | tags: "cbb_branch:main" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 413 | tags: "cbb_config:build_triggered_b" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 414 | tags: "cbb_display_label:MockLabel" |
Mike Frysinger | 62a0245 | 2021-03-16 03:48:34 -0400 | [diff] [blame] | 415 | properties: "cbb_branch:main" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 416 | properties: "cbb_config:build_triggered_b" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 417 | properties: "cbb_display_label:MockLabel" |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 418 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 419 | } |
| 420 | } |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 421 | |
| 422 | job { |
| 423 | id: "test-branch-branch_tester" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 424 | realm: "cbb-jobs" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 425 | acl_sets: "default" |
| 426 | schedule: "run daily" |
| 427 | buildbucket: { |
| 428 | server: "cr-buildbucket.appspot.com" |
| 429 | bucket: "luci.chromeos.general" |
| 430 | builder: "TestBuilder" |
| 431 | tags: "cbb_branch:test-branch" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 432 | tags: "cbb_config:branch_tester" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 433 | tags: "cbb_display_label:TestLabel" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 434 | properties: "cbb_branch:test-branch" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 435 | properties: "cbb_config:branch_tester" |
Don Garrett | 73148e5 | 2018-08-17 16:54:46 -0700 | [diff] [blame] | 436 | properties: "cbb_display_label:TestLabel" |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 437 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 438 | } |
| 439 | } |
Don Garrett | 9a0d90c | 2018-10-30 12:47:14 -0700 | [diff] [blame] | 440 | |
| 441 | job { |
| 442 | id: "test-branch-branch_tester_triggered" |
Vadim Shtayura | 6398e00 | 2021-01-11 12:02:11 -0800 | [diff] [blame] | 443 | realm: "cbb-jobs" |
Don Garrett | 9a0d90c | 2018-10-30 12:47:14 -0700 | [diff] [blame] | 444 | acl_sets: "default" |
| 445 | schedule: "run daily" |
| 446 | buildbucket: { |
| 447 | server: "cr-buildbucket.appspot.com" |
| 448 | bucket: "luci.chromeos.general" |
| 449 | builder: "TestBuilder" |
| 450 | tags: "cbb_branch:test-branch" |
| 451 | tags: "cbb_config:branch_tester_triggered" |
| 452 | tags: "cbb_display_label:TestLabel" |
| 453 | properties: "cbb_branch:test-branch" |
| 454 | properties: "cbb_config:branch_tester_triggered" |
| 455 | properties: "cbb_display_label:TestLabel" |
| 456 | properties: "cbb_extra_args:[\\"--buildbot\\"]" |
| 457 | } |
| 458 | } |
Mike Frysinger | 80de501 | 2019-08-01 14:10:53 -0400 | [diff] [blame] | 459 | """ |
Don Garrett | 8dace27 | 2018-07-19 14:07:42 -0700 | [diff] [blame] | 460 | result = gen_luci_scheduler.genLuciSchedulerConfig( |
| 461 | site_config, branch_configs) |
Don Garrett | be3608b | 2018-06-05 17:10:09 -0700 | [diff] [blame] | 462 | |
| 463 | self.assertEqual(result, expected) |