You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ar...@apache.org on 2026/01/20 09:05:35 UTC

(tooling-trusted-releases) branch maven_check_artifacts updated (6bfe896 -> 35cb9c9)

This is an automated email from the ASF dual-hosted git repository.

arm pushed a change to branch maven_check_artifacts
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


 discard 6bfe896  Make Maven check use the web URLs instead of the search.maven api
     new 35cb9c9  Make Maven check use the CDN URLs instead of the search.maven api

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (6bfe896)
            \
             N -- N -- N   refs/heads/maven_check_artifacts (35cb9c9)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 atr/models/sql.py                    |  4 ++--
 atr/storage/writers/distributions.py | 21 +++++++++------------
 2 files changed, 11 insertions(+), 14 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org


(tooling-trusted-releases) 01/01: Make Maven check use the CDN URLs instead of the search.maven api

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

arm pushed a commit to branch maven_check_artifacts
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git

commit 35cb9c98fcb4432f6d8df80ed32bbfdca256f905
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Mon Jan 19 17:54:33 2026 +0000

    Make Maven check use the CDN URLs instead of the search.maven api
---
 atr/models/sql.py                    |  5 ++--
 atr/storage/writers/distributions.py | 46 ++++++++++++++++++++++++++++++------
 2 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/atr/models/sql.py b/atr/models/sql.py
index 444c134..3e71d2d 100644
--- a/atr/models/sql.py
+++ b/atr/models/sql.py
@@ -121,8 +121,9 @@ class DistributionPlatform(enum.Enum):
     MAVEN = DistributionPlatformValue(
         name="Maven Central",
         gh_slug="maven",
-        template_url="https://search.maven.org/solrsearch/select?q=g:{owner_namespace}+AND+a:{package}+AND+v:{version}&core=gav&rows=20&wt=json",
-        # Java ASF projects use staging URLs along the lines of
+        template_url="https://repo1.maven.org/maven2/{owner_namespace}/{package}/maven-metadata.xml",
+        # Below is the old template using the maven search API - but the index isn't updated quickly enough for us
+        # template_url="https://search.maven.org/solrsearch/select?q=g:{owner_namespace}+AND+a:{package}+AND+v:{version}&core=gav&rows=20&wt=json",
         template_staging_url="https://repository.apache.org:4443/repository/maven-staging/{owner_namespace}/{package}/maven-metadata.xml",
         # https://repository.apache.org/content/repositories/orgapachePROJECT-NNNN/
         # There's no JSON, but each individual package has maven-metadata.xml
diff --git a/atr/storage/writers/distributions.py b/atr/storage/writers/distributions.py
index 4569b1c..d620592 100644
--- a/atr/storage/writers/distributions.py
+++ b/atr/storage/writers/distributions.py
@@ -197,8 +197,13 @@ class CommitteeMember(CommitteeParticipant):
         dd: distribution.Data,
     ) -> tuple[sql.Distribution, bool, distribution.Metadata]:
         template_url = await self.__template_url(dd, staging)
-
-        if dd.platform == sql.DistributionPlatform.MAVEN and staging:
+        api_url = template_url.format(
+            owner_namespace=dd.owner_namespace,
+            package=dd.package,
+            version=dd.version,
+        )
+        if dd.platform == sql.DistributionPlatform.MAVEN:
+            # We do this here because the CDNs break the namespace up into a / delimited URL
             owner = (dd.owner_namespace or "").replace(".", "/")
             api_url = template_url.format(
                 owner_namespace=owner,
@@ -207,11 +212,6 @@ class CommitteeMember(CommitteeParticipant):
             )
             api_oc = await self.__json_from_maven_xml(api_url, dd.version)
         else:
-            api_url = template_url.format(
-                owner_namespace=dd.owner_namespace,
-                package=dd.package,
-                version=dd.version,
-            )
             api_oc = await self.__json_from_distribution_platform(api_url, dd.platform, dd.version)
         match api_oc:
             case outcome.Result(result):
@@ -347,6 +347,38 @@ class CommitteeMember(CommitteeParticipant):
                     return outcome.Error(e)
         return outcome.Result(result)
 
+    async def __json_from_maven_cdn(
+        self, api_url: str, group_id: str, artifact_id: str, version: str
+    ) -> outcome.Outcome[basic.JSON]:
+        import datetime
+
+        try:
+            async with aiohttp.ClientSession() as session:
+                async with session.get(api_url) as response:
+                    response.raise_for_status()
+
+            # Use current time as timestamp since we're just validating the package exists
+            timestamp_ms = int(datetime.datetime.now(datetime.UTC).timestamp() * 1000)
+
+            # Convert to dict matching MavenResponse structure
+            result_dict = {
+                "response": {
+                    "start": 0,
+                    "docs": [
+                        {
+                            "g": group_id,
+                            "a": artifact_id,
+                            "v": version,
+                            "timestamp": timestamp_ms,
+                        }
+                    ],
+                }
+            }
+            result = basic.as_json(result_dict)
+            return outcome.Result(result)
+        except aiohttp.ClientError as e:
+            return outcome.Error(e)
+
     async def __json_from_maven_xml(self, api_url: str, version: str) -> outcome.Outcome[basic.JSON]:
         import datetime
         import xml.etree.ElementTree as ET


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org