Skip to content

Commit

Permalink
Bug 1380123 - mitigate duplicate nightly graphs off the same revision…
Browse files Browse the repository at this point in the history
…. r=taskgraph-reviewers,jmaher

We can still get multiple nightly graphs off the same revision, if
the 2nd cron task runs before the 1st one finishes. However, once
the 1st finishes, we will prevent a 2nd nightly graph. (This has the
side effect of not being able to trigger a 2nd nightly graph off the
same revision, even if the first nightly graph failed, but I think
that's still an improvement. We can work around this with a new push,
or triggering the platform-specific nightly graphs.)

Differential Revision: https://phabricator.services.mozilla.com/D118543
  • Loading branch information
escapewindow committed Jun 23, 2021
1 parent 9516b71 commit 815b68c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions taskcluster/taskgraph/target_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
from __future__ import absolute_import, print_function, unicode_literals

import copy
import os
import re

import six
from redo import retry
from taskgraph import try_option_syntax
from taskgraph.parameters import Parameters
from taskgraph.util.attributes import match_run_on_projects, match_run_on_hg_branches
from taskgraph.util.platforms import platform_family
from taskgraph.util.taskcluster import find_task_id

_target_task_methods = {}

Expand Down Expand Up @@ -57,6 +60,17 @@ def get_method(method):
return _target_task_methods[method]


def index_exists(index_path, reason=""):
print(f"Looking for existing index {index_path} {reason}...")
try:
task_id = find_task_id(index_path)
print(f"Index {index_path} exists: taskId {task_id}")
return True
except KeyError:
print(f"Index {index_path} doesn't exist.")
return False


def filter_out_shipping_phase(task, parameters):
return (
# nightly still here because of geckodriver
Expand Down Expand Up @@ -908,6 +922,19 @@ def filter(task):
def target_tasks_nightly_desktop(full_task_graph, parameters, graph_config):
"""Select the set of tasks required for a nightly build of linux, mac,
windows."""
index_path = (
f"{graph_config['trust-domain']}.v2.{parameters['project']}.revision."
f"{parameters['head_rev']}.taskgraph.decision-nightly-desktop"
)
if os.environ.get("MOZ_AUTOMATION") and retry(
index_exists,
args=(index_path,),
kwargs={
"reason": "to avoid triggering multiple nightlies off the same revision",
},
):
return []

# Tasks that aren't platform specific
release_filter = make_desktop_nightly_filter({None})
release_tasks = [
Expand Down

0 comments on commit 815b68c

Please sign in to comment.