author Dustin J. Mitchell <dustin@mozilla.com>
Tue, 18 Dec 2018 05:37:41 +0000
changeset 511142 6dc9522ee0bf672fdb407fbfe48643d1b393ae3d
parent 497348 b96cec26d463643b2dc0347930cf2561bfcb0071
child 511246 28f92797e661694da8f10e3a9a8fbcfff49c919c
permissions -rw-r--r--
Bug 1492664 - set TASKCLUSTER_ROOT_URL and TASKCLUSTER_PROXY_URL; r=tomprince,glandium Eventually, workers will provide these variables directly (https://bugzilla.mozilla.org/show_bug.cgi?id=1460015). But for now, this ensures that TASKCLUSTER_ROOT_URL is set everywhere, and TASKCLUSTER_PROXY_URL is set wherever the proxy is active. The setup for the mach commands defaults to https://taskcluster.net for user convenience. When the production instance's URL changes, we can simply change that default. This changes the docker build process to propagate TASKCLUSTER_ROOT_URL into the docker images, and for good measure includes some code to use that value to generate debian repo paths. Differential Revision: https://phabricator.services.mozilla.com/D14196

# 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 os
import logging

GECKO = os.path.realpath(os.path.join(__file__, '..', '..', '..'))

# Maximum number of dependencies a single task can have
# https://docs.taskcluster.net/reference/platform/taskcluster-queue/references/api#createTask
# specifies 100, but we also optionally add the decision task id as a dep in
# taskgraph.create, so let's set this to 99.

# Enable fast task generation for local debugging
# This is normally switched on via the --fast/-F flag to `mach taskgraph`
# Currently this skips toolchain task optimizations and schema validation
fast = False

# Default rootUrl to use for command-line invocations
PRODUCTION_TASKCLUSTER_ROOT_URL = 'https://taskcluster.net'

def set_root_url_env():
    """Ensure that TASKCLUSTER_ROOT_URL is set, defaulting when run outside of a task."""
    logger = logging.getLogger('set_root_url_env')

    if 'TASKCLUSTER_ROOT_URL' not in os.environ:
        if 'TASK_ID' in os.environ:
            raise RuntimeError('TASKCLUSTER_ROOT_URL must be set when running in a task')
            logger.info('Setting TASKCLUSTER_ROOT_URL to default value (Firefox CI production)')
    logger.info('Running in Taskcluster instance {}{}'.format(
        ' with taskcluster-proxy' if 'TASKCLUSTER_PROXY_URL' in os.environ else ''))