def get_urls(self, binary_version=None, evergreen_version=None, buildvariant_name=None): """Return multiversion urls for a given binary version or (Evergreen version + variant).""" if (binary_version and evergreen_version) or not (binary_version or evergreen_version): raise ValueError("Must specify exactly one of `version` and `evergreen_version`") if binary_version: git_tag, commit_hash = github_conn.get_git_tag_and_commit(self.github_oauth_token, binary_version) LOGGER.info("Found git attributes.", git_tag=git_tag, commit_hash=commit_hash) evg_project, evg_version = evergreen_conn.get_evergreen_project_and_version( self.config, self.evg_api, commit_hash) else: evg_project, evg_version = evergreen_conn.get_evergreen_project( self.config, self.evg_api, evergreen_version) LOGGER.debug("Found evergreen project.", evergreen_project=evg_project) try: major_minor_version = re.findall(r"\d+\.\d+", evg_project)[-1] except IndexError: major_minor_version = "master" if not buildvariant_name: buildvariant_name = self.get_buildvariant_name(major_minor_version) LOGGER.debug("Found buildvariant.", buildvariant_name=buildvariant_name) if buildvariant_name not in evg_version.build_variants_map: buildvariant_name = self.fallback_to_generic_buildvariant(major_minor_version) urls = evergreen_conn.get_compile_artifact_urls(self.evg_api, evg_version, buildvariant_name, ignore_failed_push=self.ignore_failed_push) return urls
def get_urls(self, version): """Return urls.""" git_tag, commit_hash = github_conn.get_git_tag_and_commit( self.github_oauth_token, version) LOGGER.info("Found git attributes.", git_tag=git_tag, commit_hash=commit_hash) evg_project, evg_version = evergreen_conn.get_evergreen_project_and_version( self.config, self.evg_api, commit_hash) LOGGER.debug("Found evergreen project.", evergreen_project=evg_project) try: major_minor_version = re.findall(r"\d+\.\d+", evg_project)[-1] except IndexError: major_minor_version = "master" buildvariant_name = self.get_buildvariant_name(major_minor_version) LOGGER.debug("Found buildvariant.", buildvariant_name=buildvariant_name) if buildvariant_name not in evg_version.build_variants_map: buildvariant_name = self.fallback_to_generic_buildvariant( major_minor_version) urls = evergreen_conn.get_compile_artifact_urls( self.evg_api, evg_version, buildvariant_name) return urls
def get_urls(self, version: str, buildvariant_name: Optional[str] = None) -> EvgURLInfo: """Return multiversion urls for a given version (as binary version or commit hash or evergreen_version_id).""" evg_version = evergreen_conn.get_evergreen_version( self.evg_api, version) if evg_version is None: git_tag, commit_hash = github_conn.get_git_tag_and_commit( self.github_oauth_token, version) LOGGER.info("Found git attributes.", git_tag=git_tag, commit_hash=commit_hash) evg_version = evergreen_conn.get_evergreen_version( self.evg_api, commit_hash) if evg_version is None: return EvgURLInfo() if not buildvariant_name: evg_project = evg_version.project_identifier LOGGER.debug("Found evergreen project.", evergreen_project=evg_project) try: major_minor_version = re.findall(r"\d+\.\d+", evg_project)[-1] except IndexError: major_minor_version = "master" buildvariant_name = self.get_buildvariant_name(major_minor_version) LOGGER.debug("Found buildvariant.", buildvariant_name=buildvariant_name) if buildvariant_name not in evg_version.build_variants_map: raise ValueError( f"Buildvariant {buildvariant_name} not found in evergreen. " f"Available buildvariants can be found in {config.SETUP_MULTIVERSION_CONFIG}." ) urls = evergreen_conn.get_compile_artifact_urls( self.evg_api, evg_version, buildvariant_name, ignore_failed_push=self.ignore_failed_push) return EvgURLInfo(urls=urls, evg_version_id=evg_version.version_id)