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