Bug 1715111 - is_backstop updates to support non-Firefox builds. r=taskgraph-reviewers,ahal

Replace the assumptions that are Firefox-specific with arguments so that
backstop builds can be used for Thunderbird CI. Specifically, the backstop
index path and integration projects need changing.

Differential Revision: https://phabricator.services.mozilla.com/D117170
This commit is contained in:
Rob Lemley 2021-06-10 17:21:00 +00:00
parent 31d3e6fae6
commit b30e42f4ec
4 changed files with 29 additions and 12 deletions

View File

@ -25,7 +25,7 @@ from .parameters import Parameters, get_version, get_app_version
from .taskgraph import TaskGraph
from taskgraph.util.python_path import find_object
from .try_option_syntax import parse_message
from .util.backstop import is_backstop
from .util.backstop import is_backstop, BACKSTOP_INDEX
from .util.bugbug import push_schedules
from .util.chunking import resolver
from .util.hg import get_hg_revision_branch, get_hg_commit_message
@ -404,14 +404,14 @@ def get_decision_parameters(graph_config, options):
if options.get("optimize_target_tasks") is not None:
parameters["optimize_target_tasks"] = options["optimize_target_tasks"]
# Determine if this should be a backstop push.
parameters["backstop"] = is_backstop(parameters)
if "decision-parameters" in graph_config["taskgraph"]:
find_object(graph_config["taskgraph"]["decision-parameters"])(
graph_config, parameters
)
# Determine if this should be a backstop push.
parameters["backstop"] = is_backstop(parameters)
result = Parameters(**parameters)
result.check()
return result
@ -488,7 +488,7 @@ def set_try_config(parameters, task_config_file):
def set_decision_indexes(decision_task_id, params, graph_config):
index_paths = []
if params["backstop"]:
index_paths.append("{trust-domain}.v2.{project}.latest.taskgraph.backstop")
index_paths.append(BACKSTOP_INDEX)
subs = params.copy()
subs["trust-domain"] = graph_config["trust-domain"]

View File

@ -138,7 +138,11 @@ def params():
)
def test_is_backstop(responses, params, response_args, extra_params, expected):
urls = {
"index": get_index_url(BACKSTOP_INDEX.format(project=params["project"])),
"index": get_index_url(
BACKSTOP_INDEX.format(
**{"trust-domain": "gecko", "project": params["project"]}
)
),
"artifact": get_artifact_url(LAST_BACKSTOP_ID, "public/parameters.yml"),
"status": get_task_url(LAST_BACKSTOP_ID) + "/status",
}

View File

@ -40,6 +40,11 @@ TEMPORARY_PROJECTS = set(
}
)
TRY_PROJECTS = {
"try",
"try-comm-central",
}
ALL_PROJECTS = RELEASE_PROMOTION_PROJECTS | TRUNK_PROJECTS | TEMPORARY_PROJECTS
RUN_ON_PROJECT_ALIASES = {

View File

@ -6,6 +6,7 @@ from __future__ import absolute_import, print_function, unicode_literals
from requests import HTTPError
from taskgraph.util.attributes import INTEGRATION_PROJECTS, TRY_PROJECTS
from taskgraph.util.taskcluster import (
find_task_id,
get_artifact,
@ -15,11 +16,15 @@ from taskgraph.util.taskcluster import (
BACKSTOP_PUSH_INTERVAL = 20
BACKSTOP_TIME_INTERVAL = 60 * 4 # minutes
BACKSTOP_INDEX = "gecko.v2.{project}.latest.taskgraph.backstop"
BACKSTOP_INDEX = "{trust-domain}.v2.{project}.latest.taskgraph.backstop"
def is_backstop(
params, push_interval=BACKSTOP_PUSH_INTERVAL, time_interval=BACKSTOP_TIME_INTERVAL
params,
push_interval=BACKSTOP_PUSH_INTERVAL,
time_interval=BACKSTOP_TIME_INTERVAL,
trust_domain="gecko",
integration_projects=INTEGRATION_PROJECTS,
):
"""Determines whether the given parameters represent a backstop push.
@ -27,8 +32,10 @@ def is_backstop(
push_interval (int): Number of pushes
time_interval (int): Minutes between forced schedules.
Use 0 to disable.
trust_domain (str): "gecko" for Firefox, "comm" for Thunderbird
integration_projects (set): project that uses backstop optimization
Returns:
bool: True if this is a backtop, otherwise False.
bool: True if this is a backstop, otherwise False.
"""
# In case this is being faked on try.
if params.get("backstop", False):
@ -38,9 +45,9 @@ def is_backstop(
pushid = int(params["pushlog_id"])
pushdate = int(params["pushdate"])
if project == "try":
if project in TRY_PROJECTS:
return False
elif project != "autoland":
elif project not in integration_projects:
return True
# On every Nth push, want to run all tasks.
@ -51,7 +58,8 @@ def is_backstop(
return False
# We also want to ensure we run all tasks at least once per N minutes.
index = BACKSTOP_INDEX.format(project=project)
subs = {"trust-domain": trust_domain, "project": project}
index = BACKSTOP_INDEX.format(**subs)
try:
last_backstop_id = find_task_id(index)