forked from mirrors/gecko-dev
		
	 800e6bdd73
			
		
	
	
		800e6bdd73
		
	
	
	
	
		
			
			This patch enables `run-on-projects` to work appropriately for nightly builds and tests. Initially, we were setting an empty `run-on-projects` for nightly `build_platform`s, then explicitly targeting the platforms in nightly-specific `target_task_method`s. Instead, this patch enables nightlies to `run-on-projects` everywhere, but governs the use of nightlies by either the `include_nightly` parameter, or the `--include-nightly` try option. This lets us filter nightly-related `target_task_method`s against `run-on-projects` without losing all nightly tasks. Then, enable spidermonkey tests by removing optimization from beta and release. This patch also enables everything then disables specific tasks, rather than disabling everything and enabling specific tasks. Since we're beginning with a `filter_for_project` call, we should be able to reduce these if blocks to zero over time, if desired. MozReview-Commit-ID: A9tolynaChF --HG-- extra : rebase_source : 3465ee2c714de3e0359f14109096fc94de27aadf
		
			
				
	
	
		
			88 lines
		
	
	
	
		
			2.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			88 lines
		
	
	
	
		
			2.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| # -*- coding: utf-8 -*-
 | |
| 
 | |
| # This Source Code Form is subject to the terms of the Mozilla Public
 | |
| # License, v. 2.0. If a copy of the MPL was not distributed with this
 | |
| # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | |
| 
 | |
| from __future__ import absolute_import, print_function, unicode_literals
 | |
| 
 | |
| import json
 | |
| import yaml
 | |
| from mozbuild.util import ReadOnlyDict
 | |
| 
 | |
| # Please keep this list sorted and in sync with taskcluster/docs/parameters.rst
 | |
| PARAMETER_NAMES = set([
 | |
|     'base_repository',
 | |
|     'build_date',
 | |
|     'filters',
 | |
|     'head_ref',
 | |
|     'head_repository',
 | |
|     'head_rev',
 | |
|     'include_nightly',
 | |
|     'level',
 | |
|     'message',
 | |
|     'moz_build_date',
 | |
|     'optimize_target_tasks',
 | |
|     'owner',
 | |
|     'project',
 | |
|     'pushdate',
 | |
|     'pushlog_id',
 | |
|     'target_tasks_method',
 | |
|     'triggered_by',
 | |
| ])
 | |
| 
 | |
| 
 | |
| class Parameters(ReadOnlyDict):
 | |
|     """An immutable dictionary with nicer KeyError messages on failure"""
 | |
|     def check(self):
 | |
|         names = set(self)
 | |
|         msg = []
 | |
| 
 | |
|         missing = PARAMETER_NAMES - names
 | |
|         if missing:
 | |
|             msg.append("missing parameters: " + ", ".join(missing))
 | |
| 
 | |
|         extra = names - PARAMETER_NAMES
 | |
|         if extra:
 | |
|             msg.append("extra parameters: " + ", ".join(extra))
 | |
| 
 | |
|         if msg:
 | |
|             raise Exception("; ".join(msg))
 | |
| 
 | |
|     def __getitem__(self, k):
 | |
|         if k not in PARAMETER_NAMES:
 | |
|             raise KeyError("no such parameter {!r}".format(k))
 | |
|         try:
 | |
|             return super(Parameters, self).__getitem__(k)
 | |
|         except KeyError:
 | |
|             raise KeyError("taskgraph parameter {!r} not found".format(k))
 | |
| 
 | |
| 
 | |
| def load_parameters_file(options):
 | |
|     """
 | |
|     Load parameters from the --parameters option
 | |
|     """
 | |
|     import urllib
 | |
|     from taskgraph.util.taskcluster import get_artifact_url
 | |
| 
 | |
|     filename = options['parameters']
 | |
| 
 | |
|     if not filename:
 | |
|         return Parameters()
 | |
| 
 | |
|     try:
 | |
|         # reading parameters from a local parameters.yml file
 | |
|         f = open(filename)
 | |
|     except IOError:
 | |
|         # fetching parameters.yml using task task-id or supplied url
 | |
|         if filename.startswith("task-id="):
 | |
|             task_id = filename.split("=")[1]
 | |
|             filename = get_artifact_url(task_id, 'public/parameters.yml')
 | |
|         f = urllib.urlopen(filename)
 | |
| 
 | |
|     if filename.endswith('.yml'):
 | |
|         return Parameters(**yaml.safe_load(f))
 | |
|     elif filename.endswith('.json'):
 | |
|         return Parameters(**json.load(f))
 | |
|     else:
 | |
|         raise TypeError("Parameters file `{}` is not JSON or YAML".format(filename))
 |