This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-releases-client.git
The following commit(s) were added to refs/heads/main by this push:
new 2d41d04 Use the renamed API endpoint to announce a release
2d41d04 is described below
commit 2d41d044b9d6ac1020268e32f27a1e188a0890af
Author: Sean B. Palmer <[email protected]>
AuthorDate: Tue Jul 29 14:18:24 2025 +0100
Use the renamed API endpoint to announce a release
---
pyproject.toml | 4 ++--
src/atrclient/client.py | 20 +++++++++++---------
src/atrclient/models/api.py | 42 +++++++++++++++++++++---------------------
tests/cli_workflow.t | 2 +-
uv.lock | 4 ++--
5 files changed, 37 insertions(+), 35 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index 2aa08de..b240c74 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -11,7 +11,7 @@ build-backend = "hatchling.build"
[project]
name = "apache-trusted-releases"
-version = "0.20250729.1311"
+version = "0.20250729.1318"
description = "ATR CLI and Python API"
readme = "README.md"
requires-python = ">=3.13"
@@ -74,4 +74,4 @@ select = [
]
[tool.uv]
-exclude-newer = "2025-07-29T13:11:00Z"
+exclude-newer = "2025-07-29T13:18:00Z"
diff --git a/src/atrclient/client.py b/src/atrclient/client.py
index 23554b3..55cb8dd 100755
--- a/src/atrclient/client.py
+++ b/src/atrclient/client.py
@@ -156,12 +156,6 @@ def api_post(path: str) -> Callable[[Callable[[ApiPost,
A], R]], Callable[[A], R
return decorator
-@api_post("/announce")
-def api_announce(api: ApiPost, args: models.api.AnnounceArgs) ->
models.api.AnnounceResults:
- response = api.post(args)
- return models.api.validate_announce(response)
-
-
@api_get("/checks/list")
def api_checks_list(api: ApiGet, project: str, version: str, revision: str) ->
models.api.ChecksListResults:
response = api.get(project, version, revision)
@@ -212,6 +206,12 @@ def api_keys_user(api: ApiGet, asf_uid: str) ->
models.api.KeysUserResults:
return models.api.validate_keys_user(response)
+@api_post("/release/announce")
+def api_release_announce(api: ApiPost, args: models.api.ReleaseAnnounceArgs)
-> models.api.ReleaseAnnounceResults:
+ response = api.post(args)
+ return models.api.validate_release_announce(response)
+
+
@api_post("/releases/create")
def api_releases_create(api: ApiPost, args: models.api.ReleasesCreateArgs) ->
models.api.ReleasesCreateResults:
response = api.post(args)
@@ -309,7 +309,7 @@ def app_announce(
body: Annotated[str | None, cyclopts.Parameter(alias="-b", name="--body")]
= None,
path_suffix: Annotated[str | None, cyclopts.Parameter(alias="-p",
name="--path-suffix")] = None,
) -> None:
- announce_args = models.api.AnnounceArgs(
+ announce_args = models.api.ReleaseAnnounceArgs(
project=project,
version=version,
revision=revision,
@@ -318,8 +318,10 @@ def app_announce(
body=body or f"Release {project} {version} has been announced.",
path_suffix=path_suffix or "",
)
- announce = api_announce(announce_args)
- print(announce.success)
+ announce = api_release_announce(announce_args)
+ if not announce.success:
+ show_error_and_exit("Failed to announce release.")
+ print("Announcement sent.")
@APP.command(name="api", help="Call the API directly.")
diff --git a/src/atrclient/models/api.py b/src/atrclient/models/api.py
index 61c82cc..f6d0906 100644
--- a/src/atrclient/models/api.py
+++ b/src/atrclient/models/api.py
@@ -34,24 +34,6 @@ class ResultsTypeError(TypeError):
pass
-class AnnounceArgs(schema.Strict):
- project: str = schema.Field(..., **example("example"))
- version: str = schema.Field(..., **example("1.0.0"))
- revision: str = schema.Field(..., **example("00005"))
- email_to: str = schema.Field(..., **example("[email protected]"))
- subject: str = schema.Field(..., **example("[ANNOUNCE] Apache Example
1.0.0 release"))
- body: str = schema.Field(
- ...,
- **example("The Apache Example team is pleased to announce the release
of Example 1.0.0..."),
- )
- path_suffix: str = schema.Field(..., **example("example/1.0.0"))
-
-
-class AnnounceResults(schema.Strict):
- endpoint: Literal["/announce"] = schema.Field(alias="endpoint")
- success: str = schema.Field(..., **example("Announcement sent"))
-
-
class ChecksListResults(schema.Strict):
endpoint: Literal["/checks/list"] = schema.Field(alias="endpoint")
checks: Sequence[sql.CheckResult]
@@ -200,6 +182,24 @@ class ProjectsReleasesResults(schema.Strict):
releases: Sequence[sql.Release]
+class ReleaseAnnounceArgs(schema.Strict):
+ project: str = schema.Field(..., **example("example"))
+ version: str = schema.Field(..., **example("1.0.0"))
+ revision: str = schema.Field(..., **example("00005"))
+ email_to: str = schema.Field(..., **example("[email protected]"))
+ subject: str = schema.Field(..., **example("[ANNOUNCE] Apache Example
1.0.0 release"))
+ body: str = schema.Field(
+ ...,
+ **example("The Apache Example team is pleased to announce the release
of Example 1.0.0..."),
+ )
+ path_suffix: str = schema.Field(..., **example("example/1.0.0"))
+
+
+class ReleaseAnnounceResults(schema.Strict):
+ endpoint: Literal["/release/announce"] = schema.Field(alias="endpoint")
+ success: bool = schema.Field(..., **example(True))
+
+
@dataclasses.dataclass
class ReleasesQuery:
offset: int = 0
@@ -400,8 +400,7 @@ class VerifyProvenanceResults(schema.Strict):
# This is for *Results classes only
# We do NOT put *Args classes here
Results = Annotated[
- AnnounceResults
- | ChecksListResults
+ ChecksListResults
| ChecksOngoingResults
| CommitteesGetResults
| CommitteesKeysResults
@@ -417,6 +416,7 @@ Results = Annotated[
| ProjectsGetResults
| ProjectsListResults
| ProjectsReleasesResults
+ | ReleaseAnnounceResults
| ReleasesResults
| ReleasesCreateResults
| ReleasesDeleteResults
@@ -451,7 +451,6 @@ def validator[T](t: type[T]) -> Callable[[Any], T]:
return validate
-validate_announce = validator(AnnounceResults)
validate_checks_list = validator(ChecksListResults)
validate_checks_ongoing = validator(ChecksOngoingResults)
validate_committees_get = validator(CommitteesGetResults)
@@ -468,6 +467,7 @@ validate_keys_user = validator(KeysUserResults)
validate_projects_get = validator(ProjectsGetResults)
validate_projects_list = validator(ProjectsListResults)
validate_projects_releases = validator(ProjectsReleasesResults)
+validate_release_announce = validator(ReleaseAnnounceResults)
validate_releases = validator(ReleasesResults)
validate_releases_create = validator(ReleasesCreateResults)
validate_releases_delete = validator(ReleasesDeleteResults)
diff --git a/tests/cli_workflow.t b/tests/cli_workflow.t
index 4ad2500..6e7705a 100644
--- a/tests/cli_workflow.t
+++ b/tests/cli_workflow.t
@@ -56,7 +56,7 @@ $ atr vote resolve tooling-test-example 0.3+cli passed
Vote marked as passed
$ atr announce tooling-test-example 0.3+cli 00003 -m "<!user!>@apache.org" -s
"[ANNOUNCE] Release tooling-test-example 0.3+cli" -b "Release
tooling-test-example 0.3+cli has been announced."
-Announcement sent
+Announcement sent.
<# tidy up #>
* atr dev delete tooling-test-example 0.3+cli
diff --git a/uv.lock b/uv.lock
index 79561d1..47e769f 100644
--- a/uv.lock
+++ b/uv.lock
@@ -2,7 +2,7 @@ version = 1
requires-python = ">=3.13"
[options]
-exclude-newer = "2025-07-29T13:11:00Z"
+exclude-newer = "2025-07-29T13:18:00Z"
[[package]]
name = "aiohappyeyeballs"
@@ -83,7 +83,7 @@ wheels = [
[[package]]
name = "apache-trusted-releases"
-version = "0.20250729.1311"
+version = "0.20250729.1318"
source = { editable = "." }
dependencies = [
{ name = "aiohttp" },
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]