Bug 1356955 - Expose the taskcluster job name as an environment variable. r?dustin draft
authorMike Hommey <mh+mozilla@glandium.org>
Mon, 17 Apr 2017 15:12:19 +0900
changeset 563505 fb407e657232789d36e2f8cb010c56ad441549b9
parent 563504 70875619122623665753131e91d5348b9afba24c
child 563507 6a67d8467c928fc1349a88aa1e6611bf2a1b3dfe
push id54325
push userbmo:mh+mozilla@glandium.org
push dateMon, 17 Apr 2017 06:17:16 +0000
reviewersdustin
bugs1356955
milestone55.0a1
Bug 1356955 - Expose the taskcluster job name as an environment variable. r?dustin
taskcluster/taskgraph/transforms/task.py
--- a/taskcluster/taskgraph/transforms/task.py
+++ b/taskcluster/taskgraph/transforms/task.py
@@ -956,26 +956,28 @@ def build_task(config, tasks):
 
         # add the payload and adjust anything else as required (e.g., scopes)
         payload_builders[task['worker']['implementation']](config, task, task_def)
 
         attributes = task.get('attributes', {})
         attributes['run_on_projects'] = task.get('run-on-projects', ['all'])
 
         # Set MOZ_AUTOMATION on all jobs.
+        # Also expose the job name as MOZ_JOB_NAME
         if task['worker']['implementation'] in (
             'generic-worker',
             'docker-engine',
             'native-engine',
             'docker-worker',
         ):
             payload = task_def.get('payload')
             if payload:
                 env = payload.setdefault('env', {})
                 env['MOZ_AUTOMATION'] = '1'
+                env['MOZ_JOB_NAME'] = task['label']
 
         yield {
             'label': task['label'],
             'task': task_def,
             'dependencies': task.get('dependencies', {}),
             'attributes': attributes,
             'optimizations': task.get('optimizations', []),
         }