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-trusted-release.git


The following commit(s) were added to refs/heads/main by this push:
     new 8fd6864  Add an API endpoint for admins to delete any release
8fd6864 is described below

commit 8fd6864ce3fa8ca0e62ed6ed1ebfc9a8697c2f41
Author: Sean B. Palmer <[email protected]>
AuthorDate: Mon Jul 14 20:15:17 2025 +0100

    Add an API endpoint for admins to delete any release
---
 atr/blueprints/api/api.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/atr/blueprints/api/api.py b/atr/blueprints/api/api.py
index fce5a3c..973040a 100644
--- a/atr/blueprints/api/api.py
+++ b/atr/blueprints/api/api.py
@@ -337,6 +337,24 @@ async def releases_create(data: models.api.ProjectVersion) 
-> tuple[Mapping, int
     return release.model_dump(), 201
 
 
[email protected]("/releases/delete", methods=["POST"])
[email protected]
+@quart_schema.security_scheme([{"BearerAuth": []}])
+@quart_schema.validate_request(models.api.ProjectVersion)
+@quart_schema.validate_response(dict[str, str], 200)
+async def releases_delete(data: models.api.ProjectVersion) -> tuple[Mapping, 
int]:
+    """Delete a release draft for a project via POSTed JSON."""
+    asf_uid = _jwt_asf_uid()
+    if not user.is_admin(asf_uid):
+        raise exceptions.Forbidden("You do not have permission to create a 
release")
+
+    async with db.session() as db_data:
+        release_name = sql.release_name(data.project, data.version)
+        await interaction.release_delete(release_name, include_downloads=True)
+        await db_data.commit()
+    return {"deleted": release_name}, 200
+
+
 @api.BLUEPRINT.route("/releases/<project>")
 @quart_schema.validate_querystring(models.api.Pagination)
 async def releases_project(project: str, query_args: models.api.Pagination) -> 
quart.Response:


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to