Bug 1462791 - Remove docker_worker_add_gecko_vcs_env_vars(); r?dustin draft
authorGregory Szorc <gps@mozilla.com>
Mon, 23 Apr 2018 13:39:16 -0700
changeset 799476 6d50aba8c093d8e9d37301275d7c6a6c3a958547
parent 799475 ebe1bd358ab1b3fafddd8a5413464328fc4390f6
push id111074
push userbmo:gps@mozilla.com
push dateThu, 24 May 2018 19:19:07 +0000
reviewersdustin
bugs1462791
milestone62.0a1
Bug 1462791 - Remove docker_worker_add_gecko_vcs_env_vars(); r?dustin support_vcs_checkout() always sets the environment variables that were set by this deleted function. In addition, support_vcs_checkout() also adds caches and scopes - at least for docker-worker and docker-engine. For generic-worker - which was used in all call sites of docker_worker_add_gecko_vcs_env_vars() (yes, the "docker_worker" bit of the name was completely wrong - probably a legacy holdover) - support_vcs_checkout() was *almost* exactly equivalent to docker_worker_add_gecko_vcs_env_vars(). The only difference is that support_vcs_checkout() adds the secrets:get:project/taskcluster/gecko/hgfingerprint scope in addition to setting the environment variables. MozReview-Commit-ID: 8fl3u9be5fT
taskcluster/taskgraph/transforms/job/common.py
taskcluster/taskgraph/transforms/job/mozharness.py
taskcluster/taskgraph/transforms/job/spidermonkey.py
taskcluster/taskgraph/transforms/job/toolchain.py
--- a/taskcluster/taskgraph/transforms/job/common.py
+++ b/taskcluster/taskgraph/transforms/job/common.py
@@ -54,35 +54,16 @@ def docker_worker_add_artifacts(config, 
 def generic_worker_add_artifacts(config, job, taskdesc):
     """ Adds an artifact directory to the task """
     # The path is the location on disk; it doesn't necessarily
     # mean the artifacts will be public or private; that is set via the name
     # attribute in add_artifacts.
     add_artifacts(config, job, taskdesc, path=get_artifact_prefix(taskdesc))
 
 
-def docker_worker_add_gecko_vcs_env_vars(config, job, taskdesc):
-    """Add the GECKO_BASE_* and GECKO_HEAD_* env vars to the worker."""
-    env = taskdesc['worker'].setdefault('env', {})
-    env.update({
-        'GECKO_BASE_REPOSITORY': config.params['base_repository'],
-        'GECKO_HEAD_REF': config.params['head_rev'],
-        'GECKO_HEAD_REPOSITORY': config.params['head_repository'],
-        'GECKO_HEAD_REV': config.params['head_rev'],
-    })
-
-    if 'comm_base_repository' in config.params:
-        taskdesc['worker']['env'].update({
-            'COMM_BASE_REPOSITORY': config.params['comm_base_repository'],
-            'COMM_HEAD_REF': config.params['comm_head_rev'],
-            'COMM_HEAD_REPOSITORY': config.params['comm_head_repository'],
-            'COMM_HEAD_REV': config.params['comm_head_rev'],
-        })
-
-
 def support_vcs_checkout(config, job, taskdesc, sparse=False):
     """Update a job/task with parameters to enable a VCS checkout.
 
     This can only be used with ``run-task`` tasks, as the cache name is
     reserved for ``run-task`` tasks.
     """
     level = config.params['level']
 
--- a/taskcluster/taskgraph/transforms/job/mozharness.py
+++ b/taskcluster/taskgraph/transforms/job/mozharness.py
@@ -14,17 +14,16 @@ import json
 from textwrap import dedent
 
 from taskgraph.util.schema import Schema
 from voluptuous import Required, Optional, Any
 
 from taskgraph.transforms.job import run_job_using
 from taskgraph.transforms.job.common import (
     docker_worker_add_workspace_cache,
-    docker_worker_add_gecko_vcs_env_vars,
     docker_worker_setup_secrets,
     docker_worker_add_artifacts,
     docker_worker_add_tooltool,
     generic_worker_add_artifacts,
     generic_worker_hg_commands,
     support_vcs_checkout,
 )
 
@@ -234,18 +233,17 @@ def mozharness_on_generic_worker(config,
         invalid.append('keep-artifacts')
     if invalid:
         raise Exception("Jobs run using mozharness on Windows do not support properties " +
                         ', '.join(invalid))
 
     worker = taskdesc['worker']
 
     generic_worker_add_artifacts(config, job, taskdesc)
-
-    docker_worker_add_gecko_vcs_env_vars(config, job, taskdesc)
+    support_vcs_checkout(config, job, taskdesc)
 
     env = worker['env']
     env.update({
         'MOZ_BUILD_DATE': config.params['moz_build_date'],
         'MOZ_SCM_LEVEL': config.params['level'],
         'MOZ_AUTOMATION': '1',
         'MH_BRANCH': config.params['project'],
         'MOZ_SOURCE_CHANGESET': env['GECKO_HEAD_REV'],
--- a/taskcluster/taskgraph/transforms/job/spidermonkey.py
+++ b/taskcluster/taskgraph/transforms/job/spidermonkey.py
@@ -10,17 +10,16 @@ from __future__ import absolute_import, 
 from taskgraph.util.schema import Schema
 from voluptuous import Required, Any
 
 from taskgraph.transforms.job import run_job_using
 from taskgraph.transforms.job.common import (
     docker_worker_add_artifacts,
     generic_worker_add_artifacts,
     generic_worker_hg_commands,
-    docker_worker_add_gecko_vcs_env_vars,
     docker_worker_add_tooltool,
     support_vcs_checkout,
 )
 
 sm_run_schema = Schema({
     Required('using'): Any('spidermonkey', 'spidermonkey-package', 'spidermonkey-mozjs-crate',
                            'spidermonkey-rust-bindings'),
 
@@ -83,17 +82,17 @@ def docker_worker_spidermonkey(config, j
 def generic_worker_spidermonkey(config, job, taskdesc):
     assert job['worker']['os'] == 'windows', 'only supports windows right now'
 
     run = job['run']
 
     worker = taskdesc['worker']
 
     generic_worker_add_artifacts(config, job, taskdesc)
-    docker_worker_add_gecko_vcs_env_vars(config, job, taskdesc)
+    support_vcs_checkout(config, job, taskdesc)
 
     env = worker.setdefault('env', {})
     env.update({
         'MOZHARNESS_DISABLE': 'true',
         'SPIDERMONKEY_VARIANT': run['spidermonkey-variant'],
         'MOZ_BUILD_DATE': config.params['moz_build_date'],
         'MOZ_SCM_LEVEL': config.params['level'],
         'SCCACHE_DISABLE': "1",
--- a/taskcluster/taskgraph/transforms/job/toolchain.py
+++ b/taskcluster/taskgraph/transforms/job/toolchain.py
@@ -9,17 +9,16 @@ from __future__ import absolute_import, 
 
 from mozbuild.shellutil import quote as shell_quote
 
 from taskgraph.util.schema import Schema
 from voluptuous import Optional, Required, Any
 
 from taskgraph.transforms.job import run_job_using
 from taskgraph.transforms.job.common import (
-    docker_worker_add_gecko_vcs_env_vars,
     docker_worker_add_artifacts,
     docker_worker_add_tooltool,
     generic_worker_hg_commands,
     support_vcs_checkout,
 )
 from taskgraph.util.hash import hash_paths
 from taskgraph import GECKO
 from taskgraph.util.cached_tasks import add_optimization
@@ -122,17 +121,16 @@ def docker_worker_toolchain(config, job,
     worker['chain-of-trust'] = True
 
     # Allow the job to specify where artifacts come from, but add
     # public/build if it's not there already.
     artifacts = worker.setdefault('artifacts', [])
     if not any(artifact.get('name') == 'public/build' for artifact in artifacts):
         docker_worker_add_artifacts(config, job, taskdesc)
 
-    docker_worker_add_gecko_vcs_env_vars(config, job, taskdesc)
     support_vcs_checkout(config, job, taskdesc, sparse=True)
 
     env = worker['env']
     env.update({
         'MOZ_BUILD_DATE': config.params['moz_build_date'],
         'MOZ_SCM_LEVEL': config.params['level'],
         'TOOLS_DISABLE': 'true',
         'MOZ_AUTOMATION': '1',
@@ -192,17 +190,17 @@ def windows_toolchain(config, job, taskd
     worker = taskdesc['worker']
 
     worker['artifacts'] = [{
         'path': r'public\build',
         'type': 'directory',
     }]
     worker['chain-of-trust'] = True
 
-    docker_worker_add_gecko_vcs_env_vars(config, job, taskdesc)
+    support_vcs_checkout(config, job, taskdesc)
 
     env = worker['env']
     env.update({
         'MOZ_BUILD_DATE': config.params['moz_build_date'],
         'MOZ_SCM_LEVEL': config.params['level'],
         'MOZ_AUTOMATION': '1',
     })