This is an automated email from the ASF dual-hosted git repository.
arm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
The following commit(s) were added to refs/heads/main by this push:
new fe4f76a #216 - Try to return an appropriate message/error when
distribution fails first time
fe4f76a is described below
commit fe4f76a7df1d76431d75569a573dbea61b346df1
Author: Alastair McFarlane <[email protected]>
AuthorDate: Fri Jan 30 11:14:26 2026 +0000
#216 - Try to return an appropriate message/error when distribution fails
first time
---
atr/api/__init__.py | 15 ++++++++-------
atr/storage/writers/distributions.py | 4 ++--
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/atr/api/__init__.py b/atr/api/__init__.py
index 79260cf..764b858 100644
--- a/atr/api/__init__.py
+++ b/atr/api/__init__.py
@@ -332,11 +332,13 @@ async def distribution_record(data:
models.api.DistributionRecordArgs) -> DictRe
)
async with storage.write(asf_uid) as write:
wacm = write.as_committee_member(release.committee.name)
- await wacm.distributions.record_from_data(
+ _dist, _added, metadata = await wacm.distributions.record_from_data(
release.name,
data.staging,
dd,
)
+ if metadata is None:
+ raise exceptions.FailedDependency("Distribution could not be
found, ATR will retry this automatically")
return models.api.DistributionRecordResults(
endpoint="/distribution/record",
@@ -368,13 +370,12 @@ async def distribution_record_from_workflow(data:
models.api.DistributionRecordF
version=data.distribution_version,
details=data.details,
)
- async with storage.write(asf_uid) as write:
- wacm = write.as_committee_member(release.committee.name)
- await wacm.distributions.record_from_data(
- release.name,
- data.staging,
- dd,
+ async with storage.write_as_committee_member(release.committee.name,
asf_uid) as wacm:
+ _dist, _added, metadata = await wacm.distributions.record_from_data(
+ release.name, data.staging, dd, allow_retries=True
)
+ if metadata is None:
+ log.warning("Distribution could not be found, ATR will retry this
automatically")
return models.api.DistributionRecordFromWorkflowResults(
endpoint="/distribute/record_from_workflow",
diff --git a/atr/storage/writers/distributions.py
b/atr/storage/writers/distributions.py
index 7a4b683..de2a631 100644
--- a/atr/storage/writers/distributions.py
+++ b/atr/storage/writers/distributions.py
@@ -197,7 +197,7 @@ class CommitteeMember(CommitteeParticipant):
staging: bool,
dd: models.distribution.Data,
allow_retries: bool = False,
- ) -> tuple[models.sql.Distribution, bool, models.distribution.Metadata]:
+ ) -> tuple[models.sql.Distribution, bool, models.distribution.Metadata |
None]:
api_url = distribution.get_api_url(dd, staging)
if dd.platform == models.sql.DistributionPlatform.MAVEN:
api_oc = await distribution.json_from_maven_xml(api_url,
dd.version)
@@ -222,7 +222,7 @@ class CommitteeMember(CommitteeParticipant):
web_url=None,
)
if added:
- raise storage.AccessError("Distribution could not be
found, ATR will retry this automatically")
+ return dist, added, None
raise storage.AccessError(f"Failed to get API response from
distribution platform: {error}")
upload_date = distribution.distribution_upload_date(dd.platform,
result, dd.version)
if upload_date is None:
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]