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 2026/05/19 13:32:55 UTC
(tooling-trusted-releases) 01/01: Publish to a configured SVN URL in addition to the finished directory
This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit 14e66ba09e2975cf0e726cf7f3e2125d69d9eee9
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Tue May 19 14:31:22 2026 +0100
Publish to a configured SVN URL in addition to the finished directory
---
atr/config.py | 1 +
atr/storage/writers/announce.py | 13 +++++++++++++
atr/svn/__init__.py | 23 +++++++++++++++++++++++
3 files changed, 37 insertions(+)
diff --git a/atr/config.py b/atr/config.py
index a7043cda..23fdbe45 100644
--- a/atr/config.py
+++ b/atr/config.py
@@ -87,6 +87,7 @@ class AppConfig:
PUBSUB_USER = _config_secrets("PUBSUB_USER", STATE_DIR, default=None, cast=str)
PUBSUB_PASSWORD = _config_secrets("PUBSUB_PASSWORD", STATE_DIR, default=None, cast=str)
SVN_TOKEN = _config_secrets("SVN_TOKEN", STATE_DIR, default=None, cast=str)
+ SVN_PUBLISH_URL = _config_secrets("SVN_PUBLISH_URL", STATE_DIR, default=None, cast=str)
GITHUB_TOKEN = _config_secrets("GITHUB_TOKEN", STATE_DIR, default=None, cast=str)
DEBUG = False
diff --git a/atr/storage/writers/announce.py b/atr/storage/writers/announce.py
index 22ac1933..e4f5f7bb 100644
--- a/atr/storage/writers/announce.py
+++ b/atr/storage/writers/announce.py
@@ -26,6 +26,7 @@ import aiofiles.os
import aioshutil
import sqlmodel
+import atr.config as config
import atr.construct as construct
import atr.db as db
import atr.mail as mail
@@ -35,6 +36,7 @@ import atr.models.safe as safe
import atr.models.sql as sql
import atr.paths as paths
import atr.storage as storage
+import atr.svn as svn
import atr.util as util
@@ -195,6 +197,17 @@ class CommitteeMember(CommitteeParticipant):
# Ensure that the permissions of every directory are 755
await asyncio.to_thread(util.chmod_directories, unfinished_path)
+ if svn_publish_url := config.get().SVN_PUBLISH_URL:
+ svn_relpath = paths.committee_downloads_dir(committee).path.relative_to(paths.get_downloads_dir().path)
+ if download_path_suffix is not None:
+ svn_relpath = svn_relpath / download_path_suffix.as_path()
+ await svn.publish_release(
+ unfinished_path.path,
+ f"{svn_publish_url.rstrip('/')}/{svn_relpath}",
+ self.__asf_uid,
+ subject,
+ )
+
try:
# Move the release files from somewhere in unfinished to somewhere in finished
# The whole finished hierarchy is write once for each directory, and then read only
diff --git a/atr/svn/__init__.py b/atr/svn/__init__.py
index 4793085c..4e54d1c3 100644
--- a/atr/svn/__init__.py
+++ b/atr/svn/__init__.py
@@ -137,6 +137,29 @@ async def get_log(path: pathlib.Path) -> SvnLog:
return SvnLog.from_xml_tree(root)
+async def publish_release(source_dir: pathlib.Path, target_url: str, username: str, message: str) -> str:
+ log.debug(f"running svn import for user '{username}'")
+ svn_token = config.get().SVN_TOKEN
+ if svn_token is None:
+ raise ValueError("SVN_TOKEN must be set")
+ return await run_command(
+ "svn",
+ "import",
+ str(source_dir),
+ target_url,
+ "--username",
+ username,
+ "--password",
+ svn_token,
+ "--non-interactive",
+ "--no-auth-cache",
+ "--with-revprop",
+ f"asf:tool={_ASF_TOOL}",
+ "-m",
+ message,
+ )
+
+
async def run_command(cmd: str, *args: str) -> str:
"""Run a svn command asynchronously.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org