From ac6db3cc20f0be1afe974cf4f5b7b3fd8177c820 Mon Sep 17 00:00:00 2001 From: Ian Moody Date: Tue, 5 May 2020 17:16:20 +0100 Subject: [PATCH] (Re)introduce the `can_go_integration()` check on `fetch_config`s This was removed in aa84e763274396d1af61b0150939822171dc2828 (under its old `can_go_inbound` name) since everything returned True, but I want to introduce a FirefoxL10n config that is nightly only, so need to restore these checks. --- gui/mozregui/bisection.py | 2 +- mozregression/cli.py | 9 ++++++++- mozregression/fetch_configs.py | 18 ++++++++++++++++++ mozregression/main.py | 11 ++++++----- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/gui/mozregui/bisection.py b/gui/mozregui/bisection.py index 02dfa044..1401d1a2 100644 --- a/gui/mozregui/bisection.py +++ b/gui/mozregui/bisection.py @@ -290,7 +290,7 @@ class BisectRunner(AbstractBuildRunner): dialog = QMessageBox.critical else: fetch_config = self.worker.fetch_config - if not getattr(bisection, "no_more_merge", False): + if fetch_config.can_go_integration() and not getattr(bisection, "no_more_merge", False): if isinstance(bisection.handler, NightlyHandler): handler = bisection.handler fetch_config.set_repo(fetch_config.get_nightly_repo(handler.bad_date)) diff --git a/mozregression/cli.py b/mozregression/cli.py index 108e3716..d65d37bb 100644 --- a/mozregression/cli.py +++ b/mozregression/cli.py @@ -581,7 +581,7 @@ class Configuration(object): if options.bits == 32 and mozinfo.os == "mac": self.logger.info("only 64-bit builds available for mac, using " "64-bit builds") - if fetch_config.tk_needs_auth(): + if fetch_config.is_integration() and fetch_config.tk_needs_auth(): creds = tc_authenticate(self.logger) fetch_config.set_tk_credentials(creds) @@ -632,6 +632,13 @@ class Configuration(object): ) if fetch_config.should_use_archive(): self.action = "bisect_nightlies" + if ( + self.action in ("launch_integration", "bisect_integration") + and not fetch_config.is_integration() + ): + raise MozRegressionError( + "Unable to bisect integration for `%s`" % fetch_config.app_name + ) options.preferences = preferences(options.prefs_files, options.prefs, self.logger) # convert GiB to bytes. options.persist_size_limit = int(abs(float(options.persist_size_limit)) * 1073741824) diff --git a/mozregression/fetch_configs.py b/mozregression/fetch_configs.py index 76f8dd11..cb4c9b20 100644 --- a/mozregression/fetch_configs.py +++ b/mozregression/fetch_configs.py @@ -135,6 +135,18 @@ class CommonConfig(object): + r"\.txt$" ) + def is_nightly(self): + """ + Returns True if the configuration can be used for nightly fetching. + """ + return isinstance(self, NightlyConfigMixin) + + def is_integration(self): + """ + Returns True if the configuration can be used for integration fetching. + """ + return isinstance(self, IntegrationConfigMixin) + def available_bits(self): """ Returns the no. of bits of the OS for which the application should @@ -283,6 +295,12 @@ class NightlyConfigMixin(metaclass=ABCMeta): ) return r"^%04d-%02d-%02d-[\d-]+%s/$" % (date.year, date.month, date.day, repo) + def can_go_integration(self): + """ + Indicate if we can bisect integration from this nightly config. + """ + return self.is_integration() + class FirefoxNightlyConfigMixin(NightlyConfigMixin): def _get_nightly_repo(self, date): diff --git a/mozregression/main.py b/mozregression/main.py index 1e7a0707..1f756290 100644 --- a/mozregression/main.py +++ b/mozregression/main.py @@ -133,11 +133,12 @@ class Application(object): if result == Bisection.FINISHED: LOG.info("Got as far as we can go bisecting nightlies...") handler.print_range() - LOG.info("Switching bisection method to taskcluster") - self.fetch_config.set_repo(self.fetch_config.get_nightly_repo(handler.bad_date)) - return self._bisect_integration( - handler.good_revision, handler.bad_revision, expand=DEFAULT_EXPAND - ) + if self.fetch_config.can_go_integration(): + LOG.info("Switching bisection method to taskcluster") + self.fetch_config.set_repo(self.fetch_config.get_nightly_repo(handler.bad_date)) + return self._bisect_integration( + handler.good_revision, handler.bad_revision, expand=DEFAULT_EXPAND + ) elif result == Bisection.USER_EXIT: self._print_resume_info(handler) else: