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