| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import base64 | 5 import base64 |
| 6 import json | 6 import json |
| 7 import zlib | 7 import zlib |
| 8 | 8 |
| 9 | 9 |
| 10 DEPS = [ | 10 DEPS = [ |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 # The 'cbuildbot' config name to build is the name of the builder. | 64 # The 'cbuildbot' config name to build is the name of the builder. |
| 65 # | 65 # |
| 66 # TODO(dnj): After we fully switch to BuildBucket scheduling, load the config | 66 # TODO(dnj): After we fully switch to BuildBucket scheduling, load the config |
| 67 # name from the BuildBucket job instead of `cbb_config` build | 67 # name from the BuildBucket job instead of `cbb_config` build |
| 68 # property. We can't do this yet b/c the job description can | 68 # property. We can't do this yet b/c the job description can |
| 69 # specify multiple configs in one tryjob, so there's no way for us | 69 # specify multiple configs in one tryjob, so there's no way for us |
| 70 # to know which one we are. | 70 # to know which one we are. |
| 71 cbb_config_name = api.properties.get('cbb_config') | 71 cbb_config_name = api.properties.get('cbb_config') |
| 72 assert cbb_config_name, "No configuration name specified." | 72 assert cbb_config_name, "No configuration name specified." |
| 73 | 73 |
| 74 # Get parameters specified in the tryjob description. |
| 75 tryjob_args = api.properties.get('cbb_extra_args', []) |
| 76 if tryjob_args: |
| 77 if tryjob_args.startswith('z:'): |
| 78 tryjob_args = zlib.decompress(base64.b64decode(tryjob_args[2:])) |
| 79 tryjob_args = api.json.loads(tryjob_args) |
| 80 |
| 74 # Apply our generic configuration. | 81 # Apply our generic configuration. |
| 75 api.chromite.configure( | 82 api.chromite.configure( |
| 76 api.properties, | 83 api.properties, |
| 77 _MASTER_CONFIG_MAP) | 84 _MASTER_CONFIG_MAP, |
| 85 CBB_EXTRA_ARGS=tryjob_args) |
| 78 api.chromite.c.cbb.config = cbb_config_name | 86 api.chromite.c.cbb.config = cbb_config_name |
| 79 | 87 |
| 80 # Load the Chromite configuration for our target. | 88 # Load the Chromite configuration for our target. |
| 81 api.chromite.checkout_chromite() | 89 api.chromite.checkout_chromite() |
| 82 cbb_config = api.chromite.load_config(cbb_config_name) | 90 cbb_config = api.chromite.load_config(cbb_config_name) |
| 83 | 91 |
| 84 # Add parameters specified in the tryjob description. | |
| 85 tryjob_args = api.properties.get('cbb_extra_args', []) | |
| 86 if tryjob_args: | |
| 87 if tryjob_args.startswith('z:'): | |
| 88 tryjob_args = zlib.decompress(base64.b64decode(tryjob_args[2:])) | |
| 89 tryjob_args = api.json.loads(tryjob_args) | |
| 90 | |
| 91 # Determine our build directory name based on whether this build is internal | 92 # Determine our build directory name based on whether this build is internal |
| 92 # or external. | 93 # or external. |
| 93 # | 94 # |
| 94 # We have two checkout options: internal and external. By default we will | 95 # We have two checkout options: internal and external. By default we will |
| 95 # infer which to use based on the Chromite config. However, the pinned | 96 # infer which to use based on the Chromite config. However, the pinned |
| 96 # Chromite config may not be up to date. If the value cannot be inferred, we | 97 # Chromite config may not be up to date. If the value cannot be inferred, we |
| 97 # will "quarantine" the build by running it in a separate "etc_master" | 98 # will "quarantine" the build by running it in a separate "etc_master" |
| 98 # build root and instructing `cbuildbot` to clobber beforehand. | 99 # build root and instructing `cbuildbot` to clobber beforehand. |
| 99 # | 100 # |
| 100 # TODO: As the configuration owner, Chromite should be the entity to make the | 101 # TODO: As the configuration owner, Chromite should be the entity to make the |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 revision=api.gitiles.make_hash('test'), | 157 revision=api.gitiles.make_hash('test'), |
| 157 cbb_config='x86-generic-full', | 158 cbb_config='x86-generic-full', |
| 158 cbb_branch='release-R55-9999.B', | 159 cbb_branch='release-R55-9999.B', |
| 159 cbb_extra_args='["--timeout", "14400", "--remote-trybot",' | 160 cbb_extra_args='["--timeout", "14400", "--remote-trybot",' |
| 160 '"--remote-version=4"]', | 161 '"--remote-version=4"]', |
| 161 ) | 162 ) |
| 162 + api.chromite.seed_chromite_config(_CHROMITE_CONFIG) | 163 + api.chromite.seed_chromite_config(_CHROMITE_CONFIG) |
| 163 ) | 164 ) |
| 164 | 165 |
| 165 yield ( | 166 yield ( |
| 167 api.test('release_branch_one_param') |
| 168 + api.properties( |
| 169 mastername='chromiumos.tryserver', |
| 170 buildername='paladin', |
| 171 slavename='test', |
| 172 repository='https://chromium.googlesource.com/chromiumos/tryjobs.git', |
| 173 revision=api.gitiles.make_hash('test'), |
| 174 cbb_config='x86-generic-full', |
| 175 cbb_branch='master', |
| 176 cbb_extra_args=json.dumps([ |
| 177 '--timeout', '14400', '--remote-trybot', |
| 178 '--remote-version=4', '--branch=release-R00-0000.B']), |
| 179 ) |
| 180 + api.chromite.seed_chromite_config(_CHROMITE_CONFIG) |
| 181 ) |
| 182 |
| 183 yield ( |
| 184 api.test('release_branch_two_params') |
| 185 + api.properties( |
| 186 mastername='chromiumos.tryserver', |
| 187 buildername='paladin', |
| 188 slavename='test', |
| 189 repository='https://chromium.googlesource.com/chromiumos/tryjobs.git', |
| 190 revision=api.gitiles.make_hash('test'), |
| 191 cbb_config='x86-generic-full', |
| 192 cbb_branch='master', |
| 193 cbb_extra_args=json.dumps([ |
| 194 '--timeout', '14400', '--remote-trybot', |
| 195 '--remote-version=4', '--branch', 'release-R00-0000.B']), |
| 196 ) |
| 197 + api.chromite.seed_chromite_config(_CHROMITE_CONFIG) |
| 198 ) |
| 199 |
| 200 yield ( |
| 166 api.test('pre_git_cache_release') | 201 api.test('pre_git_cache_release') |
| 167 + api.properties( | 202 + api.properties( |
| 168 mastername='chromiumos.tryserver', | 203 mastername='chromiumos.tryserver', |
| 169 buildername='paladin', | 204 buildername='paladin', |
| 170 slavename='test', | 205 slavename='test', |
| 171 repository='https://chromium.googlesource.com/chromiumos/tryjobs.git', | 206 repository='https://chromium.googlesource.com/chromiumos/tryjobs.git', |
| 172 revision=api.gitiles.make_hash('test'), | 207 revision=api.gitiles.make_hash('test'), |
| 173 cbb_config='x86-generic-full', | 208 cbb_config='x86-generic-full', |
| 174 cbb_branch='release-R54-8743.B', | 209 cbb_branch='release-R54-8743.B', |
| 175 cbb_extra_args='["--timeout", "14400", "--remote-trybot",' | 210 cbb_extra_args='["--timeout", "14400", "--remote-trybot",' |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 slavename='test', | 255 slavename='test', |
| 221 repository='https://chromium.googlesource.com/chromiumos/tryjobs.git', | 256 repository='https://chromium.googlesource.com/chromiumos/tryjobs.git', |
| 222 revision=api.gitiles.make_hash('test'), | 257 revision=api.gitiles.make_hash('test'), |
| 223 cbb_config='binhost-pre-cq', | 258 cbb_config='binhost-pre-cq', |
| 224 cbb_extra_args='["--timeout", "14400", "--remote-trybot",' | 259 cbb_extra_args='["--timeout", "14400", "--remote-trybot",' |
| 225 '"--remote-version=4"]', | 260 '"--remote-version=4"]', |
| 226 buildbucket=json.dumps({'build': {'id':'12345'}}) | 261 buildbucket=json.dumps({'build': {'id':'12345'}}) |
| 227 ) | 262 ) |
| 228 + api.chromite.seed_chromite_config(_CHROMITE_CONFIG) | 263 + api.chromite.seed_chromite_config(_CHROMITE_CONFIG) |
| 229 ) | 264 ) |
| OLD | NEW |