Chromium Code Reviews| 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 from common import cros_chromite | 5 from common import cros_chromite |
| 6 | 6 |
| 7 DEPS = [ | 7 DEPS = [ |
| 8 'chromite', | 8 'chromite', |
| 9 'gitiles', | 9 'gitiles', |
| 10 'properties', | 10 'properties', |
| 11 ] | 11 ] |
| 12 | 12 |
| 13 # Map master name to 'chromite' configuration name. | 13 # Map master name to 'chromite' configuration name. |
| 14 _MASTER_CONFIG_MAP = { | 14 _MASTER_CONFIG_MAP = { |
| 15 'chromiumos.tryserver': { | 15 'chromiumos.tryserver': { |
| 16 'master_config': 'external', | 16 'master_config': 'chromiumos_tryserver', |
| 17 'variants': { | 17 'variants': { |
| 18 'etc': ['chromeos_tryserver_etc'], | 18 'etc': ['chromiumos_tryserver_etc'], |
| 19 }, | 19 }, |
| 20 }, | 20 }, |
| 21 } | 21 } |
| 22 | 22 |
| 23 | 23 |
| 24 # Testing: Tryjob data file JSON. | 24 # Testing: Tryjob data file JSON. |
| 25 _TRYJOB_DATA = """ | 25 _TRYJOB_DATA = """ |
| 26 { | 26 { |
| 27 "name": "12345", | 27 "name": "12345", |
| 28 "email": "testauthor@fake.chromium.org", | 28 "email": "testauthor@fake.chromium.org", |
| 29 "extra_args": [ | 29 "extra_args": [ |
| 30 "--timeout", | 30 "--timeout", |
| 31 "14400", | 31 "14400", |
| 32 "--remote-trybot", | 32 "--remote-trybot", |
| 33 "--remote-version=4" | 33 "--remote-version=4" |
| 34 ] | 34 ] |
| 35 } | 35 } |
| 36 """ | 36 """ |
| 37 | 37 |
| 38 | 38 |
| 39 def RunSteps(api): | 39 def RunSteps(api): |
| 40 # The 'cbuildbot' config name to build is the name of the builder. | 40 # The 'cbuildbot' config name to build is the name of the builder. |
| 41 cbb_config_name = api.properties.get('buildername') | 41 # |
| 42 # TODO(dnj): After we fully switch to BuildBucket scheduling, load the config | |
| 43 # name from the BuildBucket job instead of `cbb_config` build | |
| 44 # property. We can't do this yet b/c the job description can | |
| 45 # specify multiple configs in one tryjob, so there's no way for us | |
| 46 # to know which one we are. | |
| 47 cbb_config_name = api.properties.get('cbb_config') | |
| 48 assert cbb_config_name, "No configuration name specified." | |
| 42 | 49 |
| 43 cbb = cros_chromite.Get() | 50 cbb = cros_chromite.Get() |
| 44 cbb_config = cbb.get(cbb_config_name) | 51 cbb_config = cbb.get(cbb_config_name) |
| 45 | 52 |
| 46 # Apply our generic configuration. | 53 # Apply our generic configuration. |
| 47 api.chromite.configure( | 54 api.chromite.configure( |
| 48 api.properties, | 55 api.properties, |
| 49 _MASTER_CONFIG_MAP) | 56 _MASTER_CONFIG_MAP) |
| 50 api.chromite.c.cbb.config = cbb_config_name | 57 api.chromite.c.cbb.config = cbb_config_name |
| 51 | 58 |
| 52 # Determine our build directory name. | 59 repository = api.properties.get('repository') |
| 53 namebase = cbb_config_name | 60 revision = api.properties.get('revision') |
| 54 if cbb_config: | 61 assert repository, "A repository must be specified." |
| 55 namebase = 'internal' if cbb_config.get('internal') else 'external' | 62 assert revision, "A revision must be specified." |
| 56 api.chromite.c.cbb.builddir = '%s_master' % (namebase,) | 63 assert api.chromite.check_repository('tryjob', repository), ( |
| 64 "Refusing to query unknown tryjob repository: %s" % (repository,)) | |
| 65 | |
| 66 # Add parameters specified in the tryjob description. | |
| 67 tryjob_args = api.chromite.load_try_job(repository, revision) | |
| 68 | |
| 69 # Determine our build directory name based on whether this build is internal | |
| 70 # or external. | |
|
David James
2015/09/15 19:35:51
Can you add a TODO here to put this info in the tr
dnj
2015/09/15 21:55:52
The build directory? I'm actually a bit reluctant
David James
2015/09/15 22:02:54
No, I'm just proposing putting internal/external i
dnj (Google)
2015/09/16 00:07:42
Is internal/external not a property of the board c
dnj (Google)
2015/09/16 00:41:40
Done.
| |
| 71 if not api.chromite.c.cbb.builddir: | |
| 72 namebase = cbb_config_name | |
|
David James
2015/09/15 19:35:51
default should be 'etc', no?
Maybe add TODO to po
dnj
2015/09/15 21:55:52
The "etc" builder will use "etc_master" (see confi
David James
2015/09/15 22:02:54
If cbb_config is "etc", the variable is poorly nam
dnj (Google)
2015/09/16 00:07:42
cbb_config is not "etc". It's the name of the actu
| |
| 73 if cbb_config: | |
| 74 namebase = 'internal' if cbb_config.get('internal') else 'external' | |
| 75 api.chromite.c.cbb.builddir = '%s_master' % (namebase,) | |
| 57 | 76 |
| 58 # Run our 'cbuildbot'. | 77 # Run our 'cbuildbot'. |
| 59 api.chromite.run_cbuildbot(tryjob=True) | 78 api.chromite.run_cbuildbot(args=tryjob_args) |
| 60 | 79 |
| 61 | 80 |
| 62 def GenTests(api): | 81 def GenTests(api): |
| 63 # Test a CrOS tryjob. | 82 # Test a CrOS tryjob. |
| 64 yield ( | 83 yield ( |
| 65 api.test('basic') | 84 api.test('basic') |
| 66 + api.properties( | 85 + api.properties( |
| 67 mastername='chromiumos.tryserver', | 86 mastername='chromiumos.tryserver', |
| 68 buildername='x86-generic-full', | 87 buildername='full', |
| 69 slavename='test', | 88 slavename='test', |
| 70 repository='https://chromium.googlesource.com/chromiumos/tryjobs.git', | 89 repository='https://chromium.googlesource.com/chromiumos/tryjobs.git', |
| 71 revision=api.gitiles.make_hash('test'), | 90 revision=api.gitiles.make_hash('test'), |
| 91 cbb_config='x86-generic-full', | |
| 72 ) | 92 ) |
| 73 + api.step_data( | 93 + api.step_data( |
| 74 'Fetch tryjob commit', | 94 'Fetch tryjob commit', |
| 75 api.gitiles.make_commit_test_data( | 95 api.gitiles.make_commit_test_data( |
| 76 'test', | 96 'test', |
| 77 '\n'.join([ | 97 '\n'.join([ |
| 78 'Commit message!', | 98 'Commit message!', |
| 79 ]), | 99 ]), |
| 80 new_files=['user/user.12345'], | 100 new_files=['user/user.12345'], |
| 81 ), | 101 ), |
| 82 ) | 102 ) |
| 83 + api.step_data( | 103 + api.step_data( |
| 84 'Fetch tryjob descriptor (user/user.12345)', | 104 'Fetch tryjob descriptor (user/user.12345)', |
| 85 api.gitiles.make_encoded_file(_TRYJOB_DATA) | 105 api.gitiles.make_encoded_file(_TRYJOB_DATA) |
| 86 ) | 106 ) |
| 87 ) | 107 ) |
| 88 | 108 |
| 89 # Test an 'etc' job (no Chromite config). | 109 # Test an 'etc' job (no Chromite config). |
| 90 yield ( | 110 yield ( |
| 91 api.test('etc') | 111 api.test('etc') |
| 92 + api.properties( | 112 + api.properties( |
| 93 mastername='chromiumos.tryserver', | 113 mastername='chromiumos.tryserver', |
| 94 buildername='etc', | 114 buildername='etc', |
| 95 slavename='test', | 115 slavename='test', |
| 96 cbb_variant='etc', | |
| 97 repository='https://chromium.googlesource.com/chromiumos/tryjobs.git', | 116 repository='https://chromium.googlesource.com/chromiumos/tryjobs.git', |
| 98 revision=api.gitiles.make_hash('test'), | 117 revision=api.gitiles.make_hash('test'), |
| 118 cbb_config='fakeboard-paladin', | |
| 119 cbb_variant='etc', | |
| 99 ) | 120 ) |
| 100 + api.step_data( | 121 + api.step_data( |
| 101 'Fetch tryjob commit', | 122 'Fetch tryjob commit', |
| 102 api.gitiles.make_commit_test_data( | 123 api.gitiles.make_commit_test_data( |
| 103 'test', | 124 'test', |
| 104 '\n'.join([ | 125 '\n'.join([ |
| 105 'Commit message!', | 126 'Commit message!', |
| 106 ]), | 127 ]), |
| 107 new_files=['user/user.12345'], | 128 new_files=['user/user.12345'], |
| 108 ), | 129 ), |
| 109 ) | 130 ) |
| 110 + api.step_data( | 131 + api.step_data( |
| 111 'Fetch tryjob descriptor (user/user.12345)', | 132 'Fetch tryjob descriptor (user/user.12345)', |
| 112 api.gitiles.make_encoded_file(_TRYJOB_DATA) | 133 api.gitiles.make_encoded_file(_TRYJOB_DATA) |
| 113 ) | 134 ) |
| 114 ) | 135 ) |
| 115 | 136 |
| 116 # Test an invalid CrOS tryjob (no files in commit). | 137 # Test an invalid CrOS tryjob (no files in commit). |
| 117 yield ( | 138 yield ( |
| 118 api.test('basic_no_files_in_commit') | 139 api.test('basic_no_files_in_commit') |
| 119 + api.properties( | 140 + api.properties( |
| 120 mastername='chromiumos.tryserver', | 141 mastername='chromiumos.tryserver', |
| 121 buildername='x86-generic-full', | 142 buildername='full', |
| 122 slavename='test', | 143 slavename='test', |
| 123 repository='https://chromium.googlesource.com/chromiumos/tryjobs.git', | 144 repository='https://chromium.googlesource.com/chromiumos/tryjobs.git', |
| 124 revision=api.gitiles.make_hash('test'), | 145 revision=api.gitiles.make_hash('test'), |
| 146 cbb_config='x86-generic-full', | |
| 125 ) | 147 ) |
| 126 + api.step_data( | 148 + api.step_data( |
| 127 'Fetch tryjob commit', | 149 'Fetch tryjob commit', |
| 128 api.gitiles.make_commit_test_data( | 150 api.gitiles.make_commit_test_data( |
| 129 'test', | 151 'test', |
| 130 '\n'.join([ | 152 '\n'.join([ |
| 131 'Commit message!', | 153 'Commit message!', |
| 132 ]), | 154 ]), |
| 133 ), | 155 ), |
| 134 ) | 156 ) |
| 135 ) | 157 ) |
| OLD | NEW |