Bug 1425148: Allow configuring the allowed index products in taskcluster; r?dustin draft
authorTom Prince <mozilla@hocat.ca>
Wed, 13 Dec 2017 16:00:57 -0700
changeset 712747 f013be7a7e3f83fa57e034d4cef21063fed18a7a
parent 712746 f384fd1b4feeb182b7771f0ea4022a8c2a8d9dd0
child 744123 b58bfa3dac59e2a17b7fb2a5be666ec073c1787b
push id93411
push userbmo:mozilla@hocat.ca
push dateMon, 18 Dec 2017 17:55:31 +0000
reviewersdustin
bugs1425148
milestone59.0a1
Bug 1425148: Allow configuring the allowed index products in taskcluster; r?dustin MozReview-Commit-ID: BRTsz9vDTyj
taskcluster/ci/config.yml
taskcluster/taskgraph/config.py
taskcluster/taskgraph/transforms/task.py
--- a/taskcluster/ci/config.yml
+++ b/taskcluster/ci/config.yml
@@ -52,16 +52,23 @@ treeherder:
         'SM-tc': 'Spidermonkey builds'
         'pub': 'APK publishing'
         'p': 'Partial generation'
         'ps': 'Partials signing'
         'Rel': 'Release promotion'
         'Snap': 'Snap image generation'
 
 index:
+    products:
+        - 'firefox'
+        - 'fennec'
+        - 'mobile'
+        - 'static-analysis'
+        - 'devedition'
+        - 'source'
     job-names:
         # This list contains a whitelist of gecko.v2 index route job names.  The intent
         # of this whitelist is to raise an alarm when new jobs are added.  If those jobs
         # already run in Buildbot, then it's important that the generated index routes
         # match (and that only one of Buildbot and TaskCluster be tier-1 at any time).
         # If the jobs are new and never ran in Buildbot, then their job name can be added
         # here without any further fuss.
         #
--- a/taskcluster/taskgraph/config.py
+++ b/taskcluster/taskgraph/config.py
@@ -11,16 +11,18 @@ graph_config_schema = Schema({
     # The trust-domain for this graph.
     # (See https://firefox-source-docs.mozilla.org/taskcluster/taskcluster/taskgraph.html#taskgraph-trust-domain)  # noqa
     Required('trust-domain'): basestring,
     Required('treeherder'): {
         # Mapping of treeherder group symbols to descriptive names
         Required('group-names'): {basestring: basestring}
     },
     Required('index'): {
+
+        Required('products'): [basestring],
         # A whitelist of gecko.v2 index route job names.
         Optional('job-names'): [basestring],
     },
     Required('try'): {
         # We have a few platforms for which we want to do some "extra" builds, or at
         # least build-ish things.  Sort of.  Anyway, these other things are implemented
         # as different "platforms".  These do *not* automatically ride along with "-p
         # all"
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -137,24 +137,17 @@ task_description_schema = Schema({
         # treeherder environments (defaults to both staging and production)
         Required('environments', default=['production', 'staging']): ['production', 'staging'],
     },
 
     # information for indexing this build so its artifacts can be discovered;
     # if omitted, the build will not be indexed.
     Optional('index'): {
         # the name of the product this build produces
-        'product': Any(
-            'firefox',
-            'fennec',
-            'mobile',
-            'static-analysis',
-            'devedition',
-            'source',
-        ),
+        'product': basestring,
 
         # the names to use for this job in the TaskCluster index
         'job-name': basestring,
 
         # Type of gecko v2 index to use
         'type': Any('generic', 'nightly', 'l10n', 'nightly-with-multi-l10n',
                     'release', 'nightly-l10n'),
 
@@ -722,23 +715,32 @@ def superseder_url(config, task):
 
 JOB_NAME_WHITELIST_ERROR = """\
 The gecko-v2 job name {job_name} is not in the whitelist in `taskcluster/ci/config.yml`.
 If this job runs on Buildbot, please ensure that the job names match between
 Buildbot and TaskCluster, then add the job name to the whitelist.  If this is a
 new job, there is nothing to check -- just add the job to the whitelist.
 """
 
+UNSUPPORTED_PRODUCT_ERROR = """\
+The gecko-v2 product {product} is not in the list of configured products in
+`taskcluster/ci/config.yml'.
+"""
+
 
 def verify_index(config, index):
     if 'job-names' in config.graph_config['index']:
         job_name = index['job-name']
         if job_name not in config.graph_config['index']['job-names']:
             raise Exception(JOB_NAME_WHITELIST_ERROR.format(job_name=job_name))
 
+    product = index['product']
+    if product not in config.graph_config['index']['products']:
+        raise Exception(UNSUPPORTED_PRODUCT_ERROR.format(product=product))
+
 
 @payload_builder('docker-worker')
 def build_docker_worker_payload(config, task, task_def):
     worker = task['worker']
     level = int(config.params['level'])
 
     image = worker['docker-image']
     if isinstance(image, dict):