This is an automated email from the ASF dual-hosted git repository. arm pushed a commit to branch atr_tagging in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit 1b36fbd1e514a3ba6115309040f6fe8e450ee28b Author: Alastair McFarlane <[email protected]> AuthorDate: Wed Jan 21 16:52:57 2026 +0000 #475 - Add endpoint to get tagging spec for a release --- atr/api/__init__.py | 21 +++++++++++++++++++++ atr/models/api.py | 12 ++++++++++++ 2 files changed, 33 insertions(+) diff --git a/atr/api/__init__.py b/atr/api/__init__.py index e253a14..bf201d9 100644 --- a/atr/api/__init__.py +++ b/atr/api/__init__.py @@ -304,6 +304,27 @@ async def update_distribution_task_status(data: models.api.DistributeStatusUpdat ).model_dump(), 200 [email protected]("/distribute/tagging", methods=["POST"]) +@quart_schema.validate_request(models.api.DistributeTaggingArgs) +@quart_schema.validate_response(models.api.DistributeTaggingResults) +async def get_distribution_tags(data: models.api.DistributeTaggingArgs) -> DictResponse: + """ + Get the tagging spec for a given project/version + """ + _payload, _asf_uid = await interaction.validate_trusted_jwt(data.publisher, data.jwt) + async with db.session() as db_data: + release = await db_data.release( + project_name=data.project_name, version=data.version_name, _release_policy=True + ).demand(exceptions.NotFound(f"Release {data.project_name}/{data.version_name} not found")) + + if (not release.release_policy) or (not release.release_policy.atr_file_tagging_spec): + raise exceptions.NotFound(f"No tagging spec found for {data.project_name}/{data.version_name}") + return models.api.DistributeTaggingResults( + endpoint="/distribute/tagging", + tagging_spec=release.release_policy.atr_file_tagging_spec, + ).model_dump(), 200 + + @api.route("/distribution/record", methods=["POST"]) @jwtoken.require @quart_schema.security_scheme([{"BearerAuth": []}]) diff --git a/atr/models/api.py b/atr/models/api.py index ad9842e..d5c2ab6 100644 --- a/atr/models/api.py +++ b/atr/models/api.py @@ -99,6 +99,18 @@ class DistributeStatusUpdateResults(schema.Strict): success: Literal[True] = schema.example(True) +class DistributeTaggingArgs(schema.Strict): + publisher: str = schema.example("user") + jwt: str = schema.example("eyJhbGciOiJIUzI1[...]mMjLiuyu5CSpyHI=") + project_name: str = schema.description("Project name in ATR") + version_name: str = schema.description("Version name in ATR") + + +class DistributeTaggingResults(schema.Strict): + endpoint: Literal["/distribute/tagging"] = schema.alias("endpoint") + tagging_spec: dict[str, Any] + + class DistributionRecordArgs(schema.Strict): project: str = schema.example("example") version: str = schema.example("0.0.1") --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
