From f2f8ac182e9195e48bda823fe0b1acbb1c0cef62 Mon Sep 17 00:00:00 2001 From: Rupesh J Date: Thu, 12 Mar 2026 00:07:28 +0530 Subject: [PATCH] Add ADO download artifact feature --- cumulusci_ado/vcs/ado/adapter.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/cumulusci_ado/vcs/ado/adapter.py b/cumulusci_ado/vcs/ado/adapter.py index b519276..9790558 100644 --- a/cumulusci_ado/vcs/ado/adapter.py +++ b/cumulusci_ado/vcs/ado/adapter.py @@ -49,6 +49,7 @@ from cumulusci_ado.utils.ado import ( custom_to_semver, + download_package, parse_repo_url, publish_package, sanitize_path_name, @@ -668,7 +669,10 @@ def __init__( def _init_repo(self) -> None: """Initializes the repository object.""" + self.git_client = self.connection.clients.get_git_client() + repo_url = self.options.get("repository_url", self.project_config.repo_url) + if repo_url is not None: _repo_owner, _repo_name, _host, _project = parse_repo_url(repo_url) @@ -685,8 +689,6 @@ def _init_repo(self) -> None: or "" ) - self.git_client = self.connection.clients.get_git_client() - self.repo = self.git_client.get_repository(self.repo_name, _project) self.project = self.repo.project if self.repo else None @@ -1130,6 +1132,27 @@ def publish_repo_package(self, feed, tag_name: str, description: str) -> None: return ret + def download_package(self, package_version, path) -> None: + """Downloads a package from the given feed.""" + ctool = self.connection.get_client( + "cumulusci_ado.utils.common.client_tool.client_tool_client.ClientToolClient" + ) + numeric_part = custom_to_semver(package_version, self.project_config) + + ret = download_package( + ctool, + self.feed_name, + self.package_name, + numeric_part, + path, + file_filter=None, + scope=("organization" if self.organisation_artifact else "project"), + organization=f"https://{self._service_config.url if self._service_config else ''}", + project=(None if self.organisation_artifact else self.project_id), + detect=None, + ) + return ret + def get_feed(self) -> Feed: """Fetches the feed for the given repository.""" try: