Bug 1277666 - Use epoch time for rank; r?dustin
Buildbot builds use the epoch time for rank, so Taskcluster needs to use
this as well. Using the pushlog_id instead means that a Buildbot build
will always persist in the "latest" index since the highest value wins.
MozReview-Commit-ID: 1nS6lQv1GoW
--- a/taskcluster/ci/legacy/tasks/build.yml
+++ b/taskcluster/ci/legacy/tasks/build.yml
@@ -31,13 +31,13 @@ task:
MOZ_BUILD_DATE: '{{pushdate}}'
MOZ_SCM_LEVEL: '{{level}}'
extra:
build_product: '{{build_product}}'
build_name: '{{build_name}}'
build_type: '{{build_type}}'
index:
- rank: {{pushlog_id}}
+ rank: {{push_epoch}}
treeherder:
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,12 +60,12 @@ 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: {{pushlog_id}}
+ rank: {{push_epoch}}
treeherder:
groupSymbol: tc
groupName: Submitted by taskcluster
--- a/taskcluster/ci/legacy/tasks/lint.yml
+++ b/taskcluster/ci/legacy/tasks/lint.yml
@@ -32,9 +32,9 @@ 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: {{pushlog_id}}
+ rank: {{push_epoch}}
--- a/taskcluster/ci/legacy/tasks/phone_build.yml
+++ b/taskcluster/ci/legacy/tasks/phone_build.yml
@@ -56,13 +56,13 @@ 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: {{pushlog_id}}
+ rank: {{push_epoch}}
treeherder:
groupSymbol: tc
groupName: Submitted by taskcluster
symbol: B
--- a/taskcluster/taskgraph/kind/legacy.py
+++ b/taskcluster/taskgraph/kind/legacy.py
@@ -304,41 +304,44 @@ class LegacyKind(base.Kind):
jobs = templates.load(job_path, {})
job_graph, trigger_tests = parse_commit(message, jobs)
cmdline_interactive = params.get('interactive', False)
# Default to current time if querying the head rev fails
- pushdate = time.strftime('%Y%m%d%H%M%S', time.gmtime())
+ push_epoch = int(time.time())
vcs_info = query_vcs_info(params['head_repository'], params['head_rev'])
changed_files = set()
if vcs_info:
- pushdate = time.strftime('%Y%m%d%H%M%S', time.gmtime(vcs_info.pushdate))
+ push_epoch = vcs_info.pushdate
logger.debug('{} commits influencing task scheduling:'.format(len(vcs_info.changesets)))
for c in vcs_info.changesets:
logger.debug("{cset} {desc}".format(
cset=c['node'][0:12],
desc=c['desc'].splitlines()[0].encode('ascii', 'ignore')))
changed_files |= set(c['files'])
+ pushdate = time.strftime('%Y%m%d%H%M%S', time.gmtime(push_epoch))
+
# Template parameters used when expanding the graph
parameters = dict(gaia_info().items() + {
'index': 'index',
'project': project,
'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],
'owner': params['owner'],
'level': params['level'],
'from_now': json_time_from_now,
'now': current_json_time(),