Bug 1274311 - tier-2 jobs should have rank 0 in the index; r?dustin draft
authorMike Shal <mshal@mozilla.com>
Fri, 24 Jun 2016 15:59:24 -0400
changeset 381975 a8021f025474741fcd0dfe8b70c6e18bab57a6c0
parent 381974 5487d68f13f9303f9fa336aab56475064fdfcc8d
child 524063 09069d3e8917e2b54254d311d2d4d31519656f44
push id21585
push userbmo:mshal@mozilla.com
push dateTue, 28 Jun 2016 14:47:56 +0000
reviewersdustin
bugs1274311
milestone50.0a1
Bug 1274311 - tier-2 jobs should have rank 0 in the index; r?dustin MozReview-Commit-ID: 1CeJ7s6Eay3
taskcluster/ci/legacy/tasks/build.yml
taskcluster/ci/legacy/tasks/harness_test.yml
taskcluster/ci/legacy/tasks/lint.yml
taskcluster/ci/legacy/tasks/phone_build.yml
taskcluster/taskgraph/kind/legacy.py
--- a/taskcluster/ci/legacy/tasks/build.yml
+++ b/taskcluster/ci/legacy/tasks/build.yml
@@ -31,14 +31,14 @@ task:
       MOZ_BUILD_DATE: '{{pushdate}}'
       MOZ_SCM_LEVEL: '{{level}}'
 
   extra:
     build_product: '{{build_product}}'
     build_name: '{{build_name}}'
     build_type: '{{build_type}}'
     index:
-      rank: {{push_epoch}}
+      rank: {{rank}}
     treeherder:
       jobKind: build
       groupSymbol: tc
       groupName: Submitted by taskcluster
       symbol: B
--- a/taskcluster/ci/legacy/tasks/harness_test.yml
+++ b/taskcluster/ci/legacy/tasks/harness_test.yml
@@ -60,13 +60,13 @@ task:
     # These definitions are expected of build tasks but not used in our case
     build_product: '{{build_product}}'
     build_name: '{{build_name}}'
     build_type: '{{build_type}}'
     locations:
         build: null
         tests: null
     index:
-      rank: {{push_epoch}}
+      rank: {{rank}}
     treeherder:
       jobKind: test
       groupSymbol: tc
       groupName: Submitted by taskcluster
--- a/taskcluster/ci/legacy/tasks/lint.yml
+++ b/taskcluster/ci/legacy/tasks/lint.yml
@@ -32,11 +32,11 @@ task:
     cache:
       level-{{level}}-{{project}}-tc-vcs: '/home/worker/.tc-vcs'
 
   extra:
     build_product: '{{build_product}}'
     build_name: {{build_name}}
     build_type: {{build_type}}
     index:
-      rank: {{push_epoch}}
+      rank: {{rank}}
     treeherder:
       jobKind: test
--- a/taskcluster/ci/legacy/tasks/phone_build.yml
+++ b/taskcluster/ci/legacy/tasks/phone_build.yml
@@ -56,14 +56,14 @@ task:
       GECKO_HEAD_REV: '{{head_rev}}'
       GECKO_HEAD_REF: '{{head_ref}}'
 
   extra:
     build_product: 'b2g'
     build_name: '{{build_name}}'
     build_type: '{{build_type}}'
     index:
-      rank: {{push_epoch}}
+      rank: {{rank}}
     treeherder:
       jobKind: build
       groupSymbol: tc
       groupName: Submitted by taskcluster
       symbol: B
--- a/taskcluster/taskgraph/kind/legacy.py
+++ b/taskcluster/taskgraph/kind/legacy.py
@@ -352,21 +352,21 @@ class LegacyKind(base.Kind):
             'pushlog_id': params.get('pushlog_id', 0),
             'docker_image': docker_image,
             'base_repository': params['base_repository'] or
             params['head_repository'],
             'head_repository': params['head_repository'],
             'head_ref': params['head_ref'] or params['head_rev'],
             'head_rev': params['head_rev'],
             'pushdate': pushdate,
-            'push_epoch': push_epoch,
             'pushtime': pushdate[8:],
             'year': pushdate[0:4],
             'month': pushdate[4:6],
             'day': pushdate[6:8],
+            'rank': push_epoch,
             'owner': params['owner'],
             'level': params['level'],
             'from_now': json_time_from_now,
             'now': current_json_time(),
         }.items())
 
         routes_file = os.path.join(root, 'routes.json')
         with open(routes_file) as f:
@@ -446,16 +446,23 @@ class LegacyKind(base.Kind):
 
             # Copy build_* attributes to expose them to post-build tasks
             # as well as json routes and tests
             task_extra = build_task['task']['extra']
             build_parameters['build_name'] = task_extra['build_name']
             build_parameters['build_type'] = task_extra['build_type']
             build_parameters['build_product'] = task_extra['build_product']
 
+            if 'treeherder' in task_extra:
+                tier = task_extra['treeherder'].get('tier', 1)
+                if tier != 1:
+                    # Only tier 1 jobs use the build time as rank. Everything
+                    # else gets rank 0 until it is promoted to tier 1.
+                    task_extra['index']['rank'] = 0
+
             set_interactive_task(build_task, interactive)
 
             # try builds don't use cache
             if project == "try":
                 remove_caches_from_task(build_task)
                 set_expiration(build_task, json_time_from_now(TRY_EXPIRATION))
 
             decorate_task_treeherder_routes(build_task['task'],