Bug 1667482 - [taskgraph] Don't fail if last backstop decision task is still running, r=marco

Differential Revision: https://phabricator.services.mozilla.com/D92096
This commit is contained in:
Andrew Halberstadt 2020-10-01 16:18:36 +00:00
Родитель 210d2ba3ec
Коммит f5e9969793
2 изменённых файлов: 23 добавлений и 1 удалений

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

@ -66,6 +66,16 @@ def params():
True,
id="no previous backstop",
),
pytest.param(
{
"index": DEFAULT_RESPONSES["index"],
"status": DEFAULT_RESPONSES["status"],
"artifact": {"status": 404},
},
{"pushlog_id": 1},
False,
id="previous backstop not finished",
),
pytest.param(
DEFAULT_RESPONSES,
{

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

@ -4,6 +4,8 @@
from __future__ import absolute_import, print_function, unicode_literals
from requests import HTTPError
from taskgraph.util.taskcluster import (
find_task_id,
get_artifact,
@ -61,7 +63,17 @@ def is_backstop(
# If the last backstop failed its decision task, make this a backstop.
return True
last_pushdate = get_artifact(last_backstop_id, 'public/parameters.yml')["pushdate"]
try:
last_pushdate = get_artifact(last_backstop_id, 'public/parameters.yml')["pushdate"]
except HTTPError as e:
# If the last backstop decision task exists in the index, but
# parameters.yml isn't available yet, it means the decision task is
# still running. If that's the case, we can be pretty sure the time
# component will not cause a backstop, so just return False.
if e.response.status_code == 404:
return False
raise
if (pushdate - last_pushdate) / 60 >= time_interval:
return True
return False