Bug 1268862: expire try jobs in a shorter time-period than default; r=nthomas

MozReview-Commit-ID: KUe6Sk0122w

--HG--
extra : rebase_source : 47111d4d381f43748d40e24373ec884c3cb2d248
This commit is contained in:
Dustin J. Mitchell 2016-05-05 21:19:42 +00:00
Родитель 651acd2608
Коммит 9c82e74a22
2 изменённых файлов: 24 добавлений и 0 удалений

Просмотреть файл

@ -35,6 +35,9 @@ DEFAULT_JOB_PATH = os.path.join(
ROOT, 'tasks', 'branches', 'base_jobs.yml'
)
# time after which a try build's results will expire
TRY_EXPIRATION = "14 days"
def merge_dicts(*dicts):
merged_dict = {}
for dictionary in dicts:
@ -144,6 +147,20 @@ def remove_caches_from_task(task):
except KeyError:
pass
def set_expiration(task, timestamp):
task_def = task['task']
task_def['expires'] = timestamp
if task_def.get('deadline', timestamp) > timestamp:
task_def['deadline'] = timestamp
try:
artifacts = task_def['payload']['artifacts']
except KeyError:
return
for artifact in artifacts.values():
artifact['expires'] = timestamp
def query_vcs_info(repository, revision):
"""Query the pushdate and pushid of a repository/revision.
This is intended to be used on hg.mozilla.org/mozilla-central and
@ -487,6 +504,7 @@ class Graph(object):
# 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))
if params['revision_hash']:
treeherder_transform.add_treeherder_revision_info(build_task['task'],
@ -567,6 +585,8 @@ class Graph(object):
treeherder_transform.add_treeherder_revision_info(post_task['task'],
params['head_rev'],
params['revision_hash'])
if project == "try":
set_expiration(post_task, json_time_from_now(TRY_EXPIRATION))
graph['tasks'].append(post_task)
for test in build['dependents']:
@ -621,6 +641,9 @@ class Graph(object):
treeherder_route
)
if project == "try":
set_expiration(test_task, json_time_from_now(TRY_EXPIRATION))
# This will schedule test jobs N times
for i in range(0, trigger_tests):
graph['tasks'].append(test_task)

Просмотреть файл

@ -19,6 +19,7 @@ tasks:
task:
created: '{{now}}'
deadline: '{{#from_now}}1 day{{/from_now}}'
expires: '{{#from_now}}14 day{{/from_now}}'
metadata:
owner: mozilla-taskcluster-maintenance@mozilla.com
source: {{{source}}}