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 bdfb481 Improve stage and phase terminology
bdfb481 is described below
commit bdfb48142b730906bc12ea2c4fa75e9aa4c7faeb
Author: Sean B. Palmer <[email protected]>
AuthorDate: Thu Mar 27 14:24:40 2025 +0200
Improve stage and phase terminology
---
atr/db/models.py | 12 ++++++------
atr/routes/candidate.py | 6 +++---
atr/routes/candidate_draft.py | 16 ++++++++--------
atr/routes/release.py | 2 +-
atr/server.py | 8 ++++----
atr/ssh.py | 6 +++---
atr/tasks/__init__.py | 8 +++++---
atr/tasks/rsync.py | 2 +-
atr/user.py | 2 +-
atr/util.py | 16 ++++++++--------
10 files changed, 40 insertions(+), 38 deletions(-)
diff --git a/atr/db/models.py b/atr/db/models.py
index 6dc5e06..e386f19 100644
--- a/atr/db/models.py
+++ b/atr/db/models.py
@@ -153,7 +153,7 @@ class Project(sqlmodel.SQLModel, table=True):
sqlmodel.select(Release)
.where(
Release.project_id == self.id,
- Release.phase == ReleasePhase.CANDIDATE_DRAFT,
+ Release.phase == ReleasePhase.RELEASE_CANDIDATE_DRAFT,
)
.order_by(db.validate_instrumented_attribute(Release.created).desc())
)
@@ -215,7 +215,7 @@ class VoteEntry(pydantic.BaseModel):
class ReleaseStage(str, enum.Enum):
# A release candidate is being prepared
- CANDIDATE = "candidate"
+ RELEASE_CANDIDATE = "release_candidate"
# A release is being prepared
RELEASE = "release"
# An existing release is being imported from ASF SVN dist
@@ -227,13 +227,13 @@ class ReleaseStage(str, enum.Enum):
class ReleasePhase(str, enum.Enum):
# [CANDIDATE]
# Step 1: The candidate files are added from external sources and checked
by ATR
- CANDIDATE_DRAFT = "candidate_draft"
+ RELEASE_CANDIDATE_DRAFT = "release_candidate_draft"
# Step 2: The candidate files are frozen and promoted into a candidate
release
- CANDIDATE_BEFORE_VOTE = "candidate_before_vote"
+ RELEASE_CANDIDATE_BEFORE_VOTE = "release_candidate_before_vote"
# Step 3: The project members are voting on the candidate release
- CANDIDATE_DURING_VOTE = "candidate_during_vote"
+ RELEASE_CANDIDATE_DURING_VOTE = "release_candidate_during_vote"
# Step 4: The project vote on the candidate release has passed
- CANDIDATE_AFTER_VOTE = "candidate_after_vote"
+ RELEASE_CANDIDATE_AFTER_VOTE = "release_candidate_after_vote"
# [RELEASE]
# Step 1: The release files are being put in place
diff --git a/atr/routes/candidate.py b/atr/routes/candidate.py
index 00f1c64..7d5c92a 100644
--- a/atr/routes/candidate.py
+++ b/atr/routes/candidate.py
@@ -121,8 +121,8 @@ async def release_add_post(session:
routes.CommitterSession, request: quart.Requ
# Create release record with project
release = models.Release(
name=release_name,
- stage=models.ReleaseStage.CANDIDATE,
- phase=models.ReleasePhase.CANDIDATE_DRAFT,
+ stage=models.ReleaseStage.RELEASE_CANDIDATE,
+ phase=models.ReleasePhase.RELEASE_CANDIDATE_DRAFT,
project_id=project.id,
project=project,
version=version,
@@ -168,7 +168,7 @@ async def review(session: routes.CommitterSession) -> str:
# TODO: We don't actually record who uploaded the release candidate
# We should probably add that information!
releases = await data.release(
- stage=models.ReleaseStage.CANDIDATE,
+ stage=models.ReleaseStage.RELEASE_CANDIDATE,
_committee=True,
_packages=True,
).all()
diff --git a/atr/routes/candidate_draft.py b/atr/routes/candidate_draft.py
index 006c6ed..5dfa958 100644
--- a/atr/routes/candidate_draft.py
+++ b/atr/routes/candidate_draft.py
@@ -58,7 +58,7 @@ async def _number_of_release_files(release: models.Release)
-> int:
"""Return the number of files in the release."""
path_project = release.project.name
path_version = release.version
- path = util.get_candidate_draft_dir() / path_project / path_version
+ path = util.get_release_candidate_draft_dir() / path_project / path_version
return len(await util.paths_recursive(path))
@@ -181,7 +181,7 @@ async def _add_one(
) -> None:
"""Process and save the uploaded file."""
# Create target directory
- target_dir = util.get_candidate_draft_dir() / project_name / version_name
+ target_dir = util.get_release_candidate_draft_dir() / project_name /
version_name
target_dir.mkdir(parents=True, exist_ok=True)
# Use the original filename if no path is specified
@@ -247,7 +247,7 @@ async def files(session: routes.CommitterSession,
project_name: str, version_nam
base.ASFQuartException("Release does not exist", errorcode=404)
)
- base_path = util.get_candidate_draft_dir() / project_name / version_name
+ base_path = util.get_release_candidate_draft_dir() / project_name /
version_name
paths = await util.paths_recursive(base_path)
paths_set = set(paths)
path_templates = {}
@@ -288,7 +288,7 @@ async def files(session: routes.CommitterSession,
project_name: str, version_nam
path_warnings[path], path_errors[path] =
_path_warnings_errors(paths_set, path, ext_artifact, ext_metadata)
# Get modified time
- full_path = str(util.get_candidate_draft_dir() / project_name /
version_name / path)
+ full_path = str(util.get_release_candidate_draft_dir() / project_name
/ version_name / path)
path_modified[path] = int(await aiofiles.os.path.getmtime(full_path))
# Get the most recent task for each type
@@ -328,7 +328,7 @@ async def checks(session: routes.CommitterSession,
project_name: str, version_na
base.ASFQuartException("Release does not exist", errorcode=404)
)
- full_path = str(util.get_candidate_draft_dir() / project_name /
version_name / file_path)
+ full_path = str(util.get_release_candidate_draft_dir() / project_name
/ version_name / file_path)
# Check that the file exists
if not await aiofiles.os.path.exists(full_path):
@@ -382,7 +382,7 @@ async def delete(
base.ASFQuartException("Release does not exist", errorcode=404)
)
- full_path = str(util.get_candidate_draft_dir() / project_name /
version_name / file_path)
+ full_path = str(util.get_release_candidate_draft_dir() / project_name
/ version_name / file_path)
# Check that the file exists
if not await aiofiles.os.path.exists(full_path):
@@ -418,7 +418,7 @@ async def hashgen(
raise base.ASFQuartException("Invalid hash type", errorcode=400)
# Construct paths
- base_path = util.get_candidate_draft_dir() / project_name /
version_name
+ base_path = util.get_release_candidate_draft_dir() / project_name /
version_name
full_path = base_path / file_path
hash_path = file_path + f".{hash_type}"
full_hash_path = base_path / hash_path
@@ -464,7 +464,7 @@ async def tools(session: routes.CommitterSession,
project_name: str, version_nam
base.ASFQuartException("Release does not exist", errorcode=404)
)
- full_path = str(util.get_candidate_draft_dir() / project_name /
version_name / file_path)
+ full_path = str(util.get_release_candidate_draft_dir() / project_name
/ version_name / file_path)
# Check that the file exists
if not await aiofiles.os.path.exists(full_path):
diff --git a/atr/routes/release.py b/atr/routes/release.py
index 5392f96..2db0e5a 100644
--- a/atr/routes/release.py
+++ b/atr/routes/release.py
@@ -85,7 +85,7 @@ async def delete(session: routes.CommitterSession) ->
response.Response:
await quart.flash(str(e), "error")
return quart.redirect(util.as_url(candidate.review))
- release_dir = util.get_candidate_draft_dir() / project_name / version
+ release_dir = util.get_release_candidate_dir() / project_name / version
if await aiofiles.os.path.exists(release_dir):
await aioshutil.rmtree(release_dir)
await quart.flash("Release deleted successfully", "success")
diff --git a/atr/server.py b/atr/server.py
index c5cd875..87fb139 100644
--- a/atr/server.py
+++ b/atr/server.py
@@ -93,10 +93,10 @@ def app_dirs_setup(app_config: type[config.AppConfig]) ->
None:
raise RuntimeError(f"State directory not found:
{app_config.STATE_DIR}")
os.chdir(app_config.STATE_DIR)
print(f"Working directory changed to: {os.getcwd()}")
- util.get_candidate_draft_dir().mkdir(parents=True, exist_ok=True)
- util.get_candidate_release_dir().mkdir(parents=True, exist_ok=True)
- util.get_distributable_draft_dir().mkdir(parents=True, exist_ok=True)
- util.get_distributable_release_dir().mkdir(parents=True, exist_ok=True)
+ util.get_release_candidate_draft_dir().mkdir(parents=True, exist_ok=True)
+ util.get_release_candidate_dir().mkdir(parents=True, exist_ok=True)
+ util.get_release_draft_dir().mkdir(parents=True, exist_ok=True)
+ util.get_release_dir().mkdir(parents=True, exist_ok=True)
def app_create_base(app_config: type[config.AppConfig]) -> base.QuartApp:
diff --git a/atr/ssh.py b/atr/ssh.py
index 8cba7f0..b413e07 100644
--- a/atr/ssh.py
+++ b/atr/ssh.py
@@ -249,7 +249,7 @@ async def _command_validate(process:
asyncssh.SSHServerProcess) -> tuple[str, st
return fail("You must be a member of this project's committee
or a committer to upload to this release")
# Set the target directory to the release storage directory
- argv[path_index] = str(util.get_candidate_draft_dir() / path_project /
path_version)
+ argv[path_index] = str(util.get_release_candidate_draft_dir() /
path_project / path_version)
_LOGGER.info(f"Modified command: {argv}")
# Create the release's storage directory if it doesn't exist
@@ -299,8 +299,8 @@ async def _handle_client(process:
asyncssh.SSHServerProcess) -> None:
project_id=project.id,
project=project,
version=release_version,
- stage=models.ReleaseStage.CANDIDATE,
- phase=models.ReleasePhase.CANDIDATE_DRAFT,
+ stage=models.ReleaseStage.RELEASE_CANDIDATE,
+ phase=models.ReleasePhase.RELEASE_CANDIDATE_DRAFT,
created=datetime.datetime.now(),
)
data.add(release)
diff --git a/atr/tasks/__init__.py b/atr/tasks/__init__.py
index d861398..0fa211a 100644
--- a/atr/tasks/__init__.py
+++ b/atr/tasks/__init__.py
@@ -28,7 +28,7 @@ import atr.util as util
async def asc_checks(release: models.Release, signature_path: str) ->
list[models.Task]:
tasks = []
- draft_dir = util.get_candidate_draft_dir() / release.project.name /
release.version
+ draft_dir = util.get_release_candidate_draft_dir() / release.project.name
/ release.version
full_signature_path = str(draft_dir / signature_path)
modified = int(await aiofiles.os.path.getmtime(full_signature_path))
@@ -59,7 +59,9 @@ async def asc_checks(release: models.Release, signature_path:
str) -> list[model
async def sha_checks(release: models.Release, hash_file: str) ->
list[models.Task]:
tasks = []
- full_hash_file_path = str(util.get_candidate_draft_dir() /
release.project.name / release.version / hash_file)
+ full_hash_file_path = str(
+ util.get_release_candidate_draft_dir() / release.project.name /
release.version / hash_file
+ )
modified = int(await aiofiles.os.path.getmtime(full_hash_file_path))
algorithm = "sha512"
if hash_file.endswith(".sha512"):
@@ -88,7 +90,7 @@ async def sha_checks(release: models.Release, hash_file: str)
-> list[models.Tas
async def tar_gz_checks(release: models.Release, path: str, signature_path:
str | None = None) -> list[models.Task]:
# TODO: We should probably use an enum for task_type
- full_path = str(util.get_candidate_draft_dir() / release.project.name /
release.version / path)
+ full_path = str(util.get_release_candidate_draft_dir() /
release.project.name / release.version / path)
filename = os.path.basename(path)
modified = int(await aiofiles.os.path.getmtime(full_path))
diff --git a/atr/tasks/rsync.py b/atr/tasks/rsync.py
index 795cd1c..7ca4920 100644
--- a/atr/tasks/rsync.py
+++ b/atr/tasks/rsync.py
@@ -58,7 +58,7 @@ async def analyse(args: dict[str, Any]) ->
tuple[models.TaskStatus, str | None,
async def _analyse_core(asf_uid: str, project_name: str, release_version: str)
-> dict[str, Any]:
"""Analyse an rsync upload."""
- base_path = util.get_candidate_draft_dir() / project_name / release_version
+ base_path = util.get_release_candidate_draft_dir() / project_name /
release_version
paths = await util.paths_recursive(base_path)
release_name = f"{project_name}-{release_version}"
diff --git a/atr/user.py b/atr/user.py
index 8c8e7d2..48f635a 100644
--- a/atr/user.py
+++ b/atr/user.py
@@ -61,7 +61,7 @@ async def releases(uid: str) -> list[models.Release]:
async with db.session() as data:
# TODO: We're limiting this to candidates
# We should either call this user_candidate_releases, or change the
query
- releases = await data.release(stage=models.ReleaseStage.CANDIDATE,
_project=True, _committee=True).all()
+ releases = await
data.release(stage=models.ReleaseStage.RELEASE_CANDIDATE, _project=True,
_committee=True).all()
user_releases = []
for r in releases:
if r.committee is None:
diff --git a/atr/util.py b/atr/util.py
index 060e4bb..84d6b60 100644
--- a/atr/util.py
+++ b/atr/util.py
@@ -119,20 +119,20 @@ def get_phase_dir() -> pathlib.Path:
return pathlib.Path(config.get().PHASE_STORAGE_DIR)
-def get_candidate_draft_dir() -> pathlib.Path:
- return pathlib.Path(config.get().PHASE_STORAGE_DIR) / "candidate-draft"
+def get_release_candidate_draft_dir() -> pathlib.Path:
+ return pathlib.Path(config.get().PHASE_STORAGE_DIR) /
"release-candidate-draft"
-def get_candidate_release_dir() -> pathlib.Path:
- return pathlib.Path(config.get().PHASE_STORAGE_DIR) / "candidate-release"
+def get_release_candidate_dir() -> pathlib.Path:
+ return pathlib.Path(config.get().PHASE_STORAGE_DIR) / "release-candidate"
-def get_distributable_draft_dir() -> pathlib.Path:
- return pathlib.Path(config.get().PHASE_STORAGE_DIR) / "distributable-draft"
+def get_release_draft_dir() -> pathlib.Path:
+ return pathlib.Path(config.get().PHASE_STORAGE_DIR) / "release-draft"
-def get_distributable_release_dir() -> pathlib.Path:
- return pathlib.Path(config.get().PHASE_STORAGE_DIR) /
"distributable-release"
+def get_release_dir() -> pathlib.Path:
+ return pathlib.Path(config.get().PHASE_STORAGE_DIR) / "release"
def is_admin(user_id: str | None) -> bool:
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]