Bug 1372697 - Export MOZ_BUILD_CHANNEL to build tasks; r?glandium
Currently, there are a number of places that vary what is built by
the repository being built. This behavior is sub-optimal because it
makes it difficult to trigger a build configuration outside of a
well-defined repository.
This commit starts the process of abstracting away these repo-specific
differences by introducing a new environment variable:
MOZ_BUILD_CHANNEL. This variable defines the channel configuration
that we want to build. Right now the variable is populated from the
source repository ("project" in taskgraph parlance). But in the future
we can change how it is set. The important thing is that the build
system can react to the presence of the variable to take conditional
actions based on the active channel configuration. The utility of
this will be demonstrated in subsequent commits.
MozReview-Commit-ID: L9jJQcPCXL8
--- a/taskcluster/taskgraph/transforms/build.py
+++ b/taskcluster/taskgraph/transforms/build.py
@@ -4,16 +4,17 @@
"""
Apply some defaults and minor modifications to the jobs defined in the build
kind.
"""
from __future__ import absolute_import, print_function, unicode_literals
from taskgraph.transforms.base import TransformSequence
+from taskgraph.util.attributes import TRUNK_PROJECTS
from taskgraph.util.workertypes import worker_type_implementation
transforms = TransformSequence()
@transforms.add
def set_defaults(config, jobs):
"""Set defaults, including those that differ per worker implementation"""
@@ -47,8 +48,43 @@ def set_env(config, jobs):
for job in jobs:
env = config.config['args'].env
if env:
job_env = {}
if 'worker' in job:
job_env = job['worker']['env']
job_env.update(dict(x.split('=') for x in env))
yield job
+
+
+@transforms.add
+def set_channel_env(config, jobs):
+ """Export the release channel name from the repo triggering this build.
+
+ This is used by the build system to tailor behavior to specific release
+ configurations.
+ """
+ project = config.params['project']
+
+ for job in jobs:
+ if project == 'try' or project in TRUNK_PROJECTS:
+ channel = 'nightly'
+ elif project == 'mozilla-beta':
+ channel = 'beta'
+ elif project == 'mozilla-release':
+ channel = 'release'
+ elif 'esr' in project:
+ # For all intents and purposes ESR uses a release channel
+ # configuration.
+ channel = 'release'
+ # Jamun is currently testing release machinery. Remove once done.
+ elif project == 'jamun':
+ channel = 'release'
+
+ # For everything else, assume a Nightly channel configuration.
+ # This is the most reasonable choice given the purposes of
+ # twigs, etc.
+ else:
+ channel = 'nightly'
+
+ job['worker']['env']['MOZ_BUILD_CHANNEL'] = channel
+
+ yield job