Bug 1469687 - Handle EXIT_PURGE_CACHES in all run-task tasks; r=tomprince
Any run-task task could exit with EXIT_PURGE_CACHES and expect the task to be retried. Before this commit, we only registered this exit code for tasks "using: run-task." That excluded mozharness and a handful of other "using" flavors. With this commit, we register the exit codes for all run-task tasks by sniffing for the presence of run-task in the low-level code that emits the task definition. This should prevent run-tasks tasks from falling through the cracks and not having their exit codes result in meaningful behavior. Differential Revision: https://phabricator.services.mozilla.com/D1715
This commit is contained in:
@@ -786,6 +786,17 @@ def build_docker_worker_payload(config, task, task_def):
|
||||
if 'max-run-time' in worker:
|
||||
payload['maxRunTime'] = worker['max-run-time']
|
||||
|
||||
run_task = payload.get('command', [''])[0].endswith('run-task')
|
||||
|
||||
# run-task exits EXIT_PURGE_CACHES if there is a problem with caches.
|
||||
# Automatically retry the tasks and purge caches if we see this exit
|
||||
# code.
|
||||
# TODO move this closer to code adding run-task once bug 1469697 is
|
||||
# addressed.
|
||||
if run_task:
|
||||
worker.setdefault('retry-exit-status', []).append(72)
|
||||
worker.setdefault('purge-caches-exit-status', []).append(72)
|
||||
|
||||
payload['onExitStatus'] = {}
|
||||
if 'retry-exit-status' in worker:
|
||||
payload['onExitStatus']['retry'] = worker['retry-exit-status']
|
||||
@@ -802,8 +813,6 @@ def build_docker_worker_payload(config, task, task_def):
|
||||
}
|
||||
payload['artifacts'] = artifacts
|
||||
|
||||
run_task = payload.get('command', [''])[0].endswith('run-task')
|
||||
|
||||
if isinstance(worker.get('docker-image'), basestring):
|
||||
out_of_tree_image = worker['docker-image']
|
||||
run_task = run_task or out_of_tree_image.startswith(
|
||||
|
||||
Reference in New Issue
Block a user