Bug 1654591 - [taskgraph] Ensure manifest chunking doesn't prune manifests on backstop pushes, r=marco
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Fri, 24 Jul 2020 15:11:16 +0000
changeset 542050 ee59f46aea2ccf439f8723ca0d6d291339a957c1
parent 542049 00920823fc42deae69ac0efcac3142a88418ddec
child 542051 2bd75664acd68cf8bf2ab2309259cda3ddbd994a
push id37635
push usernerli@mozilla.com
push dateFri, 24 Jul 2020 21:38:08 +0000
treeherdermozilla-central@b3a3c131a279 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarco
bugs1654591
milestone80.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1654591 - [taskgraph] Ensure manifest chunking doesn't prune manifests on backstop pushes, r=marco Differential Revision: https://phabricator.services.mozilla.com/D84599
taskcluster/taskgraph/util/chunking.py
taskcluster/test/conftest.py
taskcluster/test/data/pushes.json
taskcluster/test/test_mach_try_auto.py
--- a/taskcluster/taskgraph/util/chunking.py
+++ b/taskcluster/taskgraph/util/chunking.py
@@ -16,16 +16,17 @@ from manifestparser.filters import chunk
 from mozbuild.util import memoize
 from moztest.resolve import (
     TEST_SUITES,
     TestResolver,
     TestManifestLoader,
 )
 
 from taskgraph import GECKO
+from taskgraph.util.backstop import is_backstop
 from taskgraph.util.bugbug import CT_LOW, push_schedules
 
 here = os.path.abspath(os.path.dirname(__file__))
 resolver = TestResolver.from_environment(cwd=here, loader_cls=TestManifestLoader)
 
 
 def guess_mozinfo_from_task(task):
     """Attempt to build a mozinfo dict from a task definition.
@@ -208,16 +209,20 @@ class BugbugLoader(DefaultLoader):
     """Load manifests using metadata from the TestResolver, and then
     filter them based on a query to bugbug."""
     CONFIDENCE_THRESHOLD = CT_LOW
 
     @memoize
     def get_manifests(self, suite, mozinfo):
         manifests = super(BugbugLoader, self).get_manifests(suite, mozinfo)
 
+        # Don't prune any manifests if we're on a backstop push.
+        if is_backstop(self.params):
+            return manifests
+
         data = push_schedules(self.params['project'], self.params['head_rev'])
         bugbug_manifests = {m for m, c in data.get('groups', {}).items()
                             if c >= self.CONFIDENCE_THRESHOLD}
 
         manifests['active'] = list(set(manifests['active']) & bugbug_manifests)
         manifests['skipped'] = list(set(manifests['skipped']) & bugbug_manifests)
         return manifests
 
--- a/taskcluster/test/conftest.py
+++ b/taskcluster/test/conftest.py
@@ -7,24 +7,25 @@ import json
 import os
 
 import pytest
 from mach.logging import LoggingManager
 from responses import RequestsMock
 
 from taskgraph.generator import TaskGraphGenerator
 from taskgraph.parameters import parameters_loader
+from taskgraph.util.backstop import PUSH_ENDPOINT
 from taskgraph.util.bugbug import BUGBUG_BASE_URL
 
 here = os.path.abspath(os.path.dirname(__file__))
 
 
 @pytest.fixture(scope="session")
 def responses():
-    with RequestsMock() as rsps:
+    with RequestsMock(assert_all_requests_are_fired=False) as rsps:
         yield rsps
 
 
 @pytest.fixture(scope="session")
 def datadir():
     return os.path.join(here, "data")
 
 
@@ -50,16 +51,23 @@ def create_tgg(responses, datadir):
         mock_requests[url] = "bugbug-push-schedules.json"
 
         # files changed
         url = "{head_repository}/json-automationrelevance/{head_rev}".format(
             **tgg.parameters
         )
         mock_requests[url] = "automationrelevance.json"
 
+        url = PUSH_ENDPOINT.format(
+            head_repository=tgg.parameters["head_repository"],
+            push_id_start=int(tgg.parameters["pushlog_id"]) - 2,
+            push_id_end=int(tgg.parameters["pushlog_id"]) - 1,
+        )
+        mock_requests[url] = "pushes.json"
+
         for url, filename in mock_requests.items():
             with open(os.path.join(datadir, filename)) as fh:
                 responses.add(
                     responses.GET, url, json=json.load(fh), status=200,
                 )
 
         # Still allow other real requests.
         responses.add_passthru("https://hg.mozilla.org")
new file mode 100644
--- /dev/null
+++ b/taskcluster/test/data/pushes.json
@@ -0,0 +1,1 @@
+{"1":{"date": 1593029535}}
--- a/taskcluster/test/test_mach_try_auto.py
+++ b/taskcluster/test/test_mach_try_auto.py
@@ -18,16 +18,21 @@ pytestmark = pytest.mark.slow
 @pytest.fixture(scope="module")
 def tgg(create_tgg):
     params = TRY_AUTO_PARAMETERS.copy()
     params.update(
         {
             "head_repository": "https://hg.mozilla.org/try",
             "project": "try",
             "target_kind": "test",
+            # These ensure this isn't considered a backstop. The pushdate must
+            # be slightly higher than the one in data/pushes.json, and
+            # pushlog_id must not be a multiple of 10.
+            "pushdate": 1593029536,
+            "pushlog_id": "2",
         }
     )
     tgg = create_tgg(overrides=params)
     return tgg
 
 
 @pytest.fixture(scope="module")
 def params(tgg):