You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2025/09/09 17:46:48 UTC
(tooling-trusted-release) branch main updated (9800c2c -> 70d1bfd)
This is an automated email from the ASF dual-hosted git repository.
sbp pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git
from 9800c2c Document some example test user flows
new 0450bd3 Fix some typos
new 70d1bfd Allow recording distributions from GitHub during the compose phase
The 2 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/blueprints/api/api.py | 18 +++++++++++++-----
atr/db/interaction.py | 21 +++++++++++++--------
atr/templates/about.html | 4 +++-
docs/test-user-flows.html | 4 ++--
docs/test-user-flows.md | 4 ++--
5 files changed, 33 insertions(+), 18 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org
(tooling-trusted-release) 02/02: Allow recording distributions from GitHub during the compose phase
Posted by sb...@apache.org.
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
commit 70d1bfd748a4f7be0ba471c22a2b4bb480a2c1c3
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Tue Sep 9 18:45:57 2025 +0100
Allow recording distributions from GitHub during the compose phase
---
atr/blueprints/api/api.py | 18 +++++++++++++-----
atr/db/interaction.py | 21 +++++++++++++--------
atr/templates/about.html | 4 +++-
3 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/atr/blueprints/api/api.py b/atr/blueprints/api/api.py
index 90b3f41..10e39cd 100644
--- a/atr/blueprints/api/api.py
+++ b/atr/blueprints/api/api.py
@@ -589,11 +589,19 @@ async def publisher_distribution_record(data: models.api.PublisherDistributionRe
"""
Record a distribution with a corroborating Trusted Publisher JWT.
"""
- _payload, asf_uid, project = await interaction.trusted_jwt(
- data.publisher,
- data.jwt,
- interaction.TrustedProjectPhase.FINISH,
- )
+ try:
+ _payload, asf_uid, project = await interaction.trusted_jwt(
+ data.publisher,
+ data.jwt,
+ interaction.TrustedProjectPhase.FINISH,
+ )
+ except interaction.ReleasePolicyNotFoundError:
+ # TODO: We could perform a more advanced query with multiple in_ statements
+ _payload, asf_uid, project = await interaction.trusted_jwt(
+ data.publisher,
+ data.jwt,
+ interaction.TrustedProjectPhase.COMPOSE,
+ )
async with db.session() as db_data:
release_name = models.sql.release_name(project.name, data.version)
release = await db_data.release(
diff --git a/atr/db/interaction.py b/atr/db/interaction.py
index be3bd28..8fd4869 100644
--- a/atr/db/interaction.py
+++ b/atr/db/interaction.py
@@ -69,6 +69,10 @@ class PublicKeyError(RuntimeError):
pass
+class ReleasePolicyNotFoundError(RuntimeError):
+ pass
+
+
class TrustedProjectPhase(enum.Enum):
COMPOSE = "compose"
VOTE = "vote"
@@ -472,29 +476,32 @@ async def _delete_release_data_filesystem(release_dir: pathlib.Path, release_nam
async def _trusted_project(repository: str, workflow_ref: str, phase: TrustedProjectPhase) -> sql.Project:
# Debugging
log.info(f"GitHub OIDC JWT payload: {repository} {workflow_ref}")
- repository_name, workflow_path = _trusted_project_checks(repository, workflow_ref, phase)
+ repository_name, workflow_path = _trusted_project_checks(repository, workflow_ref)
- value_error = ValueError(
+ rpnf_error = ReleasePolicyNotFoundError(
f"Release policy for repository {repository_name} and {phase.value} workflow path {workflow_path} not found"
)
# TODO: If a policy is reused between projects, we can't get the project
async with db.session() as db_data:
match phase:
case TrustedProjectPhase.COMPOSE:
+ # Searches in github_*compose*_workflow_path
policy = await db_data.release_policy(
github_repository_name=repository_name,
github_compose_workflow_path_has=workflow_path,
- ).demand(value_error)
+ ).demand(rpnf_error)
case TrustedProjectPhase.VOTE:
+ # Searches in github_*vote*_workflow_path
policy = await db_data.release_policy(
github_repository_name=repository_name,
github_vote_workflow_path_has=workflow_path,
- ).demand(value_error)
+ ).demand(rpnf_error)
case TrustedProjectPhase.FINISH:
+ # Searches in github_*finish*_workflow_path
policy = await db_data.release_policy(
github_repository_name=repository_name,
github_finish_workflow_path_has=workflow_path,
- ).demand(value_error)
+ ).demand(rpnf_error)
project = await db_data.project(release_policy_id=policy.id).demand(
InteractionError(f"Project for release policy {policy.id} not found")
)
@@ -502,12 +509,10 @@ async def _trusted_project(repository: str, workflow_ref: str, phase: TrustedPro
raise InteractionError(f"Project {project.name} has no committee")
if project.committee.name not in registry.GITHUB_AUTOMATED_RELEASE_COMMITTEES:
raise InteractionError(f"Project {project.name} is not in a committee that can make releases")
- log.info(f"Release policy: {policy}")
- log.info(f"Project: {project}")
return project
-def _trusted_project_checks(repository: str, workflow_ref: str, phase: TrustedProjectPhase) -> tuple[str, str]:
+def _trusted_project_checks(repository: str, workflow_ref: str) -> tuple[str, str]:
if not repository.startswith("apache/"):
raise InteractionError("Repository must start with 'apache/'")
repository_name = repository.removeprefix("apache/")
diff --git a/atr/templates/about.html b/atr/templates/about.html
index 2b88c20..0bd74ce 100644
--- a/atr/templates/about.html
+++ b/atr/templates/about.html
@@ -85,7 +85,9 @@
<td class="ui">
<code>/distribution/stage/P/V</code>
</td>
- <td class="cli">-</td>
+ <td class="cli">
+ <code>atr distribution record P V plat owner pkg ver stg details</code>
+ </td>
<td class="github">-</td>
</tr>
<tr>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org
(tooling-trusted-release) 01/02: Fix some typos
Posted by sb...@apache.org.
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
commit 0450bd329635a683af6eeb8c92b993ec57bd5ee8
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Tue Sep 9 18:30:55 2025 +0100
Fix some typos
---
docs/test-user-flows.html | 4 ++--
docs/test-user-flows.md | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/docs/test-user-flows.html b/docs/test-user-flows.html
index 5b1af85..c0481da 100644
--- a/docs/test-user-flows.html
+++ b/docs/test-user-flows.html
@@ -1,7 +1,7 @@
<h1>Test user flows</h1>
<p>To test the ATR, here are some example command line and GitHub user flows.</p>
<h2>Command line</h2>
-<p>To install the <code>atr</code> command, use the <a href="https://github.com/apache/tooling-releases-client/tree/main?tab=readme-ov-file#quick-start">the instructions in the client <code>README.md</code></a>, or simply use <code>uv run atr</code> instead of <code>atr</code>.</p>
+<p>To install the <code>atr</code> command, use the <a href="https://github.com/apache/tooling-releases-client/tree/main?tab=readme-ov-file#quick-start">instructions in the client <code>README.md</code></a>, or simply use <code>uv run atr</code> instead of <code>atr</code>.</p>
<p><a href="https://release-test.apache.org/tokens">Create a PAT</a> using the UI, then store the value in <code>atr</code> configuration.</p>
<pre><code>atr set tokens.pat "$PAT_FROM_UI"
</code></pre>
@@ -38,7 +38,7 @@ atr announce tooling-test-example 0.1+demo 00003 -m example@apache.org -s Subjec
<h2>GitHub actions</h2>
<p>We use <a href="https://github.com/apache/tooling-asf-example">the <code>tooling-asf-example</code></a> repository to check our GitHub actions.</p>
<p>First, <a href="https://release-test.apache.org/">start a new release in the ATR web UI</a>.</p>
-<p>You can then use the <a href="https://github.com/apache/tooling-asf-example/actions/workflows/build-and-rsync-to-atr.yaml"><code>build-and-rsync-to-atr.yaml</code></a> workflow to build Python wheel files an upload them to the ATR.</p>
+<p>You can then use the <a href="https://github.com/apache/tooling-asf-example/actions/workflows/build-and-rsync-to-atr.yaml"><code>build-and-rsync-to-atr.yaml</code></a> workflow to build Python wheel files and upload them to the ATR.</p>
<p>Then, start a vote in the ATR web UI. This cannot be linked here because the URL will depend on which project and version you use.</p>
<p>Use the <a href="https://github.com/apache/tooling-asf-example/actions/workflows/resolve-vote-on-atr.yaml"><code>resolve-vote-on-atr.yaml</code></a> workflow to resolve the vote.</p>
<p>Use the <a href="https://github.com/apache/tooling-asf-example/actions/workflows/record-distribution-on-atr.yaml"><code>record-distribution-on-atr.yaml</code></a> workflow to record an external distribution. The external distribution <em>must exist</em> on the distribution platform, because the ATR fetches real metadata.</p>
diff --git a/docs/test-user-flows.md b/docs/test-user-flows.md
index 32e6614..6e5b699 100644
--- a/docs/test-user-flows.md
+++ b/docs/test-user-flows.md
@@ -4,7 +4,7 @@ To test the ATR, here are some example command line and GitHub user flows.
## Command line
-To install the `atr` command, use the [the instructions in the client `README.md`](https://github.com/apache/tooling-releases-client/tree/main?tab=readme-ov-file#quick-start), or simply use `uv run atr` instead of `atr`.
+To install the `atr` command, use the [instructions in the client `README.md`](https://github.com/apache/tooling-releases-client/tree/main?tab=readme-ov-file#quick-start), or simply use `uv run atr` instead of `atr`.
[Create a PAT](https://release-test.apache.org/tokens) using the UI, then store the value in `atr` configuration.
@@ -60,7 +60,7 @@ We use [the `tooling-asf-example`](https://github.com/apache/tooling-asf-example
First, [start a new release in the ATR web UI](https://release-test.apache.org/).
-You can then use the [`build-and-rsync-to-atr.yaml`](https://github.com/apache/tooling-asf-example/actions/workflows/build-and-rsync-to-atr.yaml) workflow to build Python wheel files an upload them to the ATR.
+You can then use the [`build-and-rsync-to-atr.yaml`](https://github.com/apache/tooling-asf-example/actions/workflows/build-and-rsync-to-atr.yaml) workflow to build Python wheel files and upload them to the ATR.
Then, start a vote in the ATR web UI. This cannot be linked here because the URL will depend on which project and version you use.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org