You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ar...@apache.org on 2026/09/16 09:29:51 UTC
(tooling-trusted-releases) branch arm updated (c0a0b67f -> 7f9da5b2)
This is an automated email from the ASF dual-hosted git repository.
alitheg pushed a change to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
discard c0a0b67f Add created date back into json file
discard 05a7eb47 #1386 - update SBOM docs
add ee3ceb01 Display more details about concerns in SBOM report pages
add 9b3b9086 Update introduction docs
add 5cbc4024 doc: add more upload options
new 33b9b9cd #1386 - update SBOM docs
new fc0a242d Add created date back into json file
new c04e457a #1590 - some more wording tweaks and introduce strings module
new 396d497c Move more strings to strings module and abstract some reused error messages
new 7f9da5b2 Extract some duplicated code in distribution list pages
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (c0a0b67f)
\
N -- N -- N refs/heads/arm (7f9da5b2)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 5 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/api/__init__.py | 3 +-
atr/blueprints/common.py | 3 +-
atr/db/interaction.py | 3 +-
atr/docs/introduction-to-atr.md | 77 +++++++--
atr/docs/staging-and-voting.md | 11 +-
atr/docs/trusted-publishing.md | 2 +
atr/errors.py | 8 +-
atr/get/announce.py | 5 +-
atr/get/checks.py | 22 +--
atr/get/committees.py | 3 +-
atr/get/compose.py | 9 +-
atr/get/distribution.py | 87 ++--------
atr/get/download.py | 2 +-
atr/get/draft.py | 3 +-
atr/get/finish.py | 83 ++-------
atr/get/keys.py | 3 +-
atr/get/manual.py | 5 +-
atr/get/report.py | 11 +-
atr/get/resolve.py | 3 +-
atr/get/result.py | 5 +-
atr/get/sbom.py | 198 ++++++++++++++++++++-
atr/get/vote.py | 22 +--
atr/get/voting.py | 3 +-
atr/post/announce.py | 3 +-
atr/post/distribution.py | 3 +-
atr/post/vote.py | 3 +-
atr/sbom/licenses.py | 1 +
atr/server.py | 2 +
atr/shared/distribution.py | 64 ++++++-
atr/static/css/atr.css | 17 ++
atr/storage/writers/vote.py | 3 +-
atr/{blueprints/icons.py => strings.py} | 16 +-
atr/tasks/checks/__init__.py | 5 +-
atr/tasks/checks/sbom.py | 36 ++--
atr/templates/check-selected-path-table.html | 12 +-
atr/templates/check-selected.html | 6 +-
atr/templates/includes/topnav.html | 5 +
atr/web.py | 5 +-
tests/unit/test_get_sbom_review.py | 250 +++++++++++++++++++++++++++
tests/unit/test_sbom_licenses.py | 29 ++++
tests/unit/test_sbom_review.py | 16 +-
typestubs/cyclonedx/model/component.pyi | 4 +
42 files changed, 785 insertions(+), 266 deletions(-)
copy atr/{blueprints/icons.py => strings.py} (55%)
create mode 100644 tests/unit/test_get_sbom_review.py
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org
(tooling-trusted-releases) 04/05: Move more strings to strings module and abstract some reused error messages
Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
alitheg pushed a commit to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit 396d497c7b2a95df5e2f7cf2a1cef2cacea068e9
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Wed Sep 16 10:07:53 2026 +0100
Move more strings to strings module and abstract some reused error messages
---
atr/api/__init__.py | 3 ++-
atr/blueprints/common.py | 3 ++-
atr/db/interaction.py | 3 ++-
atr/errors.py | 8 +++++++-
atr/get/announce.py | 5 +++--
atr/get/checks.py | 22 ++++++++++++----------
atr/get/committees.py | 3 ++-
atr/get/compose.py | 9 +++++----
atr/get/distribution.py | 3 ++-
atr/get/download.py | 2 +-
atr/get/draft.py | 3 ++-
atr/get/finish.py | 7 ++++---
atr/get/keys.py | 3 ++-
atr/get/manual.py | 5 +++--
atr/get/report.py | 11 ++++++-----
atr/get/resolve.py | 3 ++-
atr/get/result.py | 5 +++--
atr/get/vote.py | 22 ++++++++++++----------
atr/get/voting.py | 3 ++-
atr/post/announce.py | 3 ++-
atr/post/distribution.py | 3 ++-
atr/post/vote.py | 3 ++-
atr/storage/writers/vote.py | 3 ++-
atr/strings.py | 12 ++++++++++++
atr/tasks/checks/__init__.py | 5 +++--
atr/templates/check-selected-path-table.html | 12 ++++++------
atr/web.py | 5 +++--
27 files changed, 106 insertions(+), 63 deletions(-)
diff --git a/atr/api/__init__.py b/atr/api/__init__.py
index b4aa217a..ea9be780 100644
--- a/atr/api/__init__.py
+++ b/atr/api/__init__.py
@@ -41,6 +41,7 @@ import atr.constants as constants
import atr.construct as construct
import atr.db as db
import atr.db.interaction as interaction
+import atr.errors as errors
import atr.ldap as ldap
import atr.log as log
import atr.models as models
@@ -2605,7 +2606,7 @@ async def _vote_tabulate_trusted(
if not is_trusted:
return None, None, None
if release.committee is None:
- raise exceptions.InternalServerError("Release has no committee")
+ raise exceptions.InternalServerError(errors.RELEASE_NO_COMMITTEE)
vote_seq = release.current_vote_seq
if vote_seq is None:
return None, None, None
diff --git a/atr/blueprints/common.py b/atr/blueprints/common.py
index a6d13b27..de3bb5fd 100644
--- a/atr/blueprints/common.py
+++ b/atr/blueprints/common.py
@@ -30,6 +30,7 @@ import werkzeug.exceptions as exceptions
import atr.config as config
import atr.db as db
+import atr.errors as errors
import atr.form as form
import atr.models.safe as safe
import atr.models.sql as sql
@@ -210,7 +211,7 @@ async def confidential_release_block(
uid = session.uid if (session is not None) else None
is_member = bool(allow_asf_member and (session is not None) and session.is_member)
if user.embargo_hides_release(release, uid, is_member=is_member):
- raise base.ASFQuartException("Release does not exist", errorcode=404)
+ raise base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404)
def setup_wrapper(wrapper: Callable[..., Any], func: Callable[..., Any], blueprint_name: str) -> str:
diff --git a/atr/db/interaction.py b/atr/db/interaction.py
index 36115820..c56d011e 100644
--- a/atr/db/interaction.py
+++ b/atr/db/interaction.py
@@ -32,6 +32,7 @@ import atr.attestable as attestable
import atr.config as config
import atr.cycles as cycles
import atr.db as db
+import atr.errors as errors
import atr.jwtoken as jwtoken
import atr.ldap as ldap
import atr.log as log
@@ -1308,7 +1309,7 @@ async def _trusted_ballot_details_from_ballots(
caller_data: db.Session | None = None,
) -> tuple[list[TrustedBallotDetail], TrustedVoteSummary]:
if release.committee is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
active_round = trusted_vote_round(release)
details: list[TrustedBallotDetail] = []
summary = TrustedVoteSummary()
diff --git a/atr/errors.py b/atr/errors.py
index 8a83d01c..793952be 100644
--- a/atr/errors.py
+++ b/atr/errors.py
@@ -16,7 +16,7 @@
# under the License.
import traceback
-from typing import Any
+from typing import Any, Final
import asfquart.base as base
import quart
@@ -24,6 +24,12 @@ import werkzeug.exceptions as exceptions
import atr.log as log
+# Strings for re-use throughout the app
+FILE_NOT_FOUND: Final = "File does not exist"
+RELEASE_ACTIONS_DISABLED: Final = "Release actions are disabled."
+RELEASE_NO_COMMITTEE: Final = "Release has no committee"
+RELEASE_NOT_FOUND: Final = "Release does not exist"
+
def action_error_response(
error: BaseException,
diff --git a/atr/get/announce.py b/atr/get/announce.py
index 01f1d2ba..f581ec7e 100644
--- a/atr/get/announce.py
+++ b/atr/get/announce.py
@@ -25,6 +25,7 @@ import atr.blueprints.get as get
import atr.config as config
import atr.construct as construct
import atr.db.interaction as interaction
+import atr.errors as errors
import atr.form as form
import atr.get.projects as projects
import atr.htm as htm
@@ -66,7 +67,7 @@ async def selected(
subject_template_hash = construct.template_hash(default_subject_template)
if (committee := release.project.committee) is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
# Expand the templates
options = construct.AnnounceReleaseOptions(
@@ -307,7 +308,7 @@ async def _render_page(
page.append(_render_release_card(release))
page.h2["Announce this release"]
- if banner := render.archived_project_banner(release.project, "Release actions are disabled."):
+ if banner := render.archived_project_banner(release.project, errors.RELEASE_ACTIONS_DISABLED):
page.append(banner)
announce_msg = _missing_distributions_message(release)
diff --git a/atr/get/checks.py b/atr/get/checks.py
index 1d68a814..9edda201 100644
--- a/atr/get/checks.py
+++ b/atr/get/checks.py
@@ -30,6 +30,7 @@ import atr.blueprints.get as get
import atr.classify as classify
import atr.db as db
import atr.db.interaction as interaction
+import atr.errors as errors
import atr.form as form
import atr.get.download as download
import atr.get.release
@@ -46,6 +47,7 @@ import atr.render as render
import atr.shared.draft as draft
import atr.storage as storage
import atr.storage.datatypes as datatypes
+import atr.strings as strings
import atr.template as template
import atr.util as util
import atr.web as web
@@ -104,12 +106,12 @@ async def selected(
version=str(version_key),
_committee=True,
_project_release_policy=True,
- ).demand(base.ASFQuartException("Release does not exist", errorcode=404))
+ ).demand(base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404))
if release.phase not in (sql.ReleasePhase.RELEASE_CANDIDATE, sql.ReleasePhase.RELEASE):
- raise base.ASFQuartException("Release does not exist", errorcode=404)
+ raise base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404)
if release.committee is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
if release.phase == sql.ReleasePhase.RELEASE:
revision, all_paths, file_types = await _published_paths(project_key, version_key)
@@ -166,7 +168,7 @@ async def selected_revision(
_committee=True,
# _project=True is included in _project_release_policy=True
_project_release_policy=True,
- ).demand(base.ASFQuartException("Release does not exist", errorcode=404))
+ ).demand(base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404))
base_path = paths.release_directory(release)
all_paths = [path async for path in util.paths_recursive(base_path)]
@@ -230,17 +232,17 @@ def _classification_badge_cell(
file_type = info.file_types.get(path) if (info is not None) else None
match file_type:
case classify.FileType.DISALLOWED:
- label, title = "bad", "Disallowed file"
+ label, title = "bad", strings.FILE_CLASS_DISALLOWED
case classify.FileType.SOURCE:
- label, title = "src", "Source artifact"
+ label, title = "src", strings.FILE_CLASS_SOURCE
case classify.FileType.METADATA:
- label, title = "meta", "Metadata file"
+ label, title = "meta", strings.FILE_CLASS_METADATA
case classify.FileType.SBOM:
- label, title = "sbom", "SBOM"
+ label, title = "sbom", strings.FILE_CLASS_SBOM
case classify.FileType.DIRECTORY:
- label, title = "dir", "Directory"
+ label, title = "dir", strings.FILE_CLASS_DIRECTORY
case classify.FileType.DOCS | classify.FileType.BINARY | None:
- label, title = "bin", "Binary artifact"
+ label, title = "bin", strings.FILE_CLASS_BINARY
if severity is not None:
icon_class = render.PATH_STYLE_CLASS.get(severity, "text-success")
else:
diff --git a/atr/get/committees.py b/atr/get/committees.py
index 4d1ec211..e53b5a77 100644
--- a/atr/get/committees.py
+++ b/atr/get/committees.py
@@ -31,6 +31,7 @@ import atr.models.safe as safe
import atr.models.sql as sql
import atr.post as post
import atr.shared as shared
+import atr.strings as strings
import atr.template as template
import atr.util as util
import atr.web as web
@@ -177,7 +178,7 @@ async def view(session: web.Committer, _committees: Literal["committees"], name:
action=util.as_url(post.keys.keys),
# Inline block so the button sits beside the Upload link, not on its own row
form_classes=".d-inline-block.m-0",
- submit_label="Regenerate KEYS file",
+ submit_label=strings.REGENERATE_KEYS_BUTTON,
defaults={"committee_key": committee.key},
empty=True,
),
diff --git a/atr/get/compose.py b/atr/get/compose.py
index 3bbc5996..4ed6fa8b 100644
--- a/atr/get/compose.py
+++ b/atr/get/compose.py
@@ -45,6 +45,7 @@ import atr.shared as shared
import atr.shared.activity as activity
import atr.shared.draft as draft
import atr.storage as storage
+import atr.strings as strings
import atr.template as template
import atr.user as user
import atr.util as util
@@ -80,7 +81,7 @@ async def selected(
_committee=True,
_release_policy=True,
_project_release_policy=True,
- ).demand(base.ASFQuartException("Release does not exist", errorcode=404))
+ ).demand(base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404))
if release.phase != sql.ReleasePhase.RELEASE_CANDIDATE_DRAFT:
return await mapping.release_as_redirect(session, release)
@@ -214,7 +215,7 @@ async def selected(
)[""],
]
- archived_banner = render.archived_project_banner(release.project, "Release actions are disabled.")
+ archived_banner = render.archived_project_banner(release.project, errors.RELEASE_ACTIONS_DISABLED)
archived_banner_html = str(archived_banner) if archived_banner is not None else ""
return await template.render(
@@ -286,7 +287,7 @@ async def _activity_form_html(release: sql.Release, session: web.Committer) -> s
activity_form = await form.render(
model_cls=form.Empty,
action=util.as_url(post.release.activity, project_key=release.project.key, version_key=release.version),
- submit_label="Reset inactivity clock",
+ submit_label=strings.RESET_INACTIVITY_CLOCK_BUTTON,
submit_classes="btn-outline-primary",
pre_submit=activity.inactivity_form_intro(release),
)
@@ -642,7 +643,7 @@ async def _status_selected_impl(
_committee=True,
_release_policy=True,
_project_release_policy=True,
- ).demand(base.ASFQuartException("Release does not exist", errorcode=404))
+ ).demand(base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404))
if release.phase != sql.ReleasePhase.RELEASE_CANDIDATE_DRAFT:
return quart.jsonify(
diff --git a/atr/get/distribution.py b/atr/get/distribution.py
index d5289470..452346c6 100644
--- a/atr/get/distribution.py
+++ b/atr/get/distribution.py
@@ -22,6 +22,7 @@ import htpy
import atr.blueprints.get as get
import atr.db as db
+import atr.errors as errors
import atr.form as form
import atr.htm as htm
import atr.models.args as args
@@ -244,7 +245,7 @@ async def _get_page_data(
project_key=str(project_key),
version=str(version_key),
_committee=True,
- ).demand(base.ASFQuartException("Release does not exist", errorcode=404))
+ ).demand(base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404))
distributions = await data.distribution(release_key=release.key).all()
tasks = [
t
diff --git a/atr/get/download.py b/atr/get/download.py
index 97774e5b..3826ea60 100644
--- a/atr/get/download.py
+++ b/atr/get/download.py
@@ -225,7 +225,7 @@ async def _download_or_list(
# We allow downloading files from any phase
async with db.session() as data:
release = await data.release(project_key=str(project_key), version=str(version_key)).demand(
- base.ASFQuartException("Release does not exist", errorcode=404)
+ base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404)
)
if release.phase == sql.ReleasePhase.RELEASE:
return await _published_response(release, validated_path)
diff --git a/atr/get/draft.py b/atr/get/draft.py
index 62b84e79..a33d3235 100644
--- a/atr/get/draft.py
+++ b/atr/get/draft.py
@@ -24,6 +24,7 @@ import aiofiles.os
import asfquart.base as base
import atr.blueprints.get as get
+import atr.errors as errors
import atr.form as form
import atr.models.safe as safe
import atr.paths as paths
@@ -54,7 +55,7 @@ async def tools(
# Check that the file exists
if not await aiofiles.os.path.exists(full_path):
- raise base.ASFQuartException("File does not exist", errorcode=404)
+ raise base.ASFQuartException(errors.FILE_NOT_FOUND, errorcode=404)
modified = int(await aiofiles.os.path.getmtime(full_path))
file_size = await aiofiles.os.path.getsize(full_path)
diff --git a/atr/get/finish.py b/atr/get/finish.py
index c11d4eae..e1c1208f 100644
--- a/atr/get/finish.py
+++ b/atr/get/finish.py
@@ -27,6 +27,7 @@ import atr.blueprints.get as get
import atr.construct as construct
import atr.db as db
import atr.db.interaction as interaction
+import atr.errors as errors
import atr.form as form
import atr.get.announce as announce
import atr.get.distribution as distribution
@@ -119,7 +120,7 @@ async def _get_page_data(
_release_policy=True,
_project_release_policy=True,
_distributions=True,
- ).demand(base.ASFQuartException("Release does not exist", errorcode=404))
+ ).demand(base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404))
tasks = [
t
for t in (
@@ -247,7 +248,7 @@ async def _render_page(
htm.em[release.version],
]
- if banner := render.archived_project_banner(release.project, "Release actions are disabled."):
+ if banner := render.archived_project_banner(release.project, errors.RELEASE_ACTIONS_DISABLED):
page.append(banner)
# Release info card
@@ -289,7 +290,7 @@ async def _render_page(
activity_form = await form.render(
model_cls=form.Empty,
action=util.as_url(post.release.activity, project_key=release.project.key, version_key=release.version),
- submit_label="Reset inactivity clock",
+ submit_label=strings.RESET_INACTIVITY_CLOCK_BUTTON,
submit_classes="btn-outline-primary",
pre_submit=activity.inactivity_form_intro(release, action="flagged", noun="preview"),
)
diff --git a/atr/get/keys.py b/atr/get/keys.py
index 69858474..e7dd3d6e 100644
--- a/atr/get/keys.py
+++ b/atr/get/keys.py
@@ -33,6 +33,7 @@ import atr.models.unsafe as unsafe
import atr.post as post
import atr.shared as shared
import atr.storage as storage
+import atr.strings as strings
import atr.template as template
import atr.util as util
import atr.web as web
@@ -412,7 +413,7 @@ async def _committee_keys(
model_cls=shared.keys.UpdateCommitteeKeysForm,
action=util.as_url(post.keys.keys),
form_classes=".mb-4.d-inline-block",
- submit_label="Regenerate KEYS file",
+ submit_label=strings.REGENERATE_KEYS_BUTTON,
submit_classes="btn btn-sm btn-outline-secondary",
defaults={"committee_key": committee.key},
empty=True,
diff --git a/atr/get/manual.py b/atr/get/manual.py
index 4724de18..eddf0942 100644
--- a/atr/get/manual.py
+++ b/atr/get/manual.py
@@ -33,6 +33,7 @@ import atr.render as render
import atr.sessions as sessions
import atr.shared as shared
import atr.storage as storage
+import atr.strings as strings
import atr.template as template
import atr.util as util
import atr.web as web
@@ -63,7 +64,7 @@ async def resolve_selected(
content = await _render_resolve_page(release)
return await template.blank(
- title="Resolve vote",
+ title=strings.RESOLVE_VOTE_BUTTON,
description="Resolve vote for a release.",
content=content,
)
@@ -200,7 +201,7 @@ async def _render_resolve_page(release: sql.Release) -> htm.Element:
page,
model_cls=shared.manual.ResolveVoteForm,
form_classes=".atr-canary.py-4.px-5.mb-4.border.rounded",
- submit_label="Resolve vote",
+ submit_label=strings.RESOLVE_VOTE_BUTTON,
)
return page.collect()
diff --git a/atr/get/report.py b/atr/get/report.py
index cfebf2d7..eb3679bb 100644
--- a/atr/get/report.py
+++ b/atr/get/report.py
@@ -26,6 +26,7 @@ import asfquart.base as base
import atr.attestable as attestable
import atr.blueprints.get as get
import atr.db as db
+import atr.errors as errors
import atr.models.attestable
import atr.models.safe as safe
import atr.models.sql as sql
@@ -69,16 +70,16 @@ async def selected_path(
_committee=True,
_release_policy=True,
_project_release_policy=True,
- ).demand(base.ASFQuartException("Release does not exist", errorcode=404))
+ ).demand(base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404))
if release.phase not in (
sql.ReleasePhase.RELEASE_CANDIDATE_DRAFT,
sql.ReleasePhase.RELEASE_CANDIDATE,
sql.ReleasePhase.RELEASE,
):
- raise base.ASFQuartException("Release does not exist", errorcode=404)
+ raise base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404)
if release.committee is None:
- raise base.ASFQuartException("Release has no committee", errorcode=500)
+ raise base.ASFQuartException(errors.RELEASE_NO_COMMITTEE, errorcode=500)
if release.phase == sql.ReleasePhase.RELEASE:
revision, attestable_data, file_size = await _published_file(project_key, version_key, str(rel_path))
@@ -91,7 +92,7 @@ async def selected_path(
# Check that the file exists
if not await aiofiles.os.path.exists(abs_path):
- raise base.ASFQuartException("File does not exist", errorcode=404)
+ raise base.ASFQuartException(errors.FILE_NOT_FOUND, errorcode=404)
modified = int(await aiofiles.os.path.getmtime(abs_path))
uploaded = datetime.datetime.fromtimestamp(modified, tz=datetime.UTC)
@@ -144,7 +145,7 @@ async def _published_file(
attested = await attestable.load(project_key, version_key, revision) if (revision is not None) else None
content_hash = attestable.path_hash(attested, rel_path) if (attested is not None) else None
if (revision is None) or (attested is None) or (content_hash is None):
- raise base.ASFQuartException("File does not exist", errorcode=404)
+ raise base.ASFQuartException(errors.FILE_NOT_FOUND, errorcode=404)
return revision, attested, attested.hashes[content_hash].size
diff --git a/atr/get/resolve.py b/atr/get/resolve.py
index 9f242fcd..a1996f7f 100644
--- a/atr/get/resolve.py
+++ b/atr/get/resolve.py
@@ -34,6 +34,7 @@ import atr.post as post
import atr.render as render
import atr.shared as shared
import atr.storage as storage
+import atr.strings as strings
import atr.tabulate as tabulate
import atr.template as template
import atr.user as user
@@ -243,7 +244,7 @@ async def selected( # noqa: C901
cancel_only = False
submit_classes = "btn-primary"
- submit_label = "Resolve vote"
+ submit_label = strings.RESOLVE_VOTE_BUTTON
duration_blocks_result = (not pass_fail_allowed) and (not bypass_active)
if duration_blocks_result:
cancel_only = True
diff --git a/atr/get/result.py b/atr/get/result.py
index 05733d96..d5446193 100644
--- a/atr/get/result.py
+++ b/atr/get/result.py
@@ -22,6 +22,7 @@ import asfquart.base as base
import atr.blueprints.get as get
import atr.db as db
+import atr.errors as errors
import atr.models.safe as safe
import atr.web as web
@@ -43,10 +44,10 @@ async def data(
project_key=str(project_key),
version=str(version_key),
_committee=True,
- ).demand(base.ASFQuartException("Release does not exist", errorcode=404))
+ ).demand(base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404))
if release.committee is None:
- raise base.ASFQuartException("Release has no committee", errorcode=500)
+ raise base.ASFQuartException(errors.RELEASE_NO_COMMITTEE, errorcode=500)
check_result = await data.check_result(
id=check_id,
diff --git a/atr/get/vote.py b/atr/get/vote.py
index fd7637a5..b4ac175a 100644
--- a/atr/get/vote.py
+++ b/atr/get/vote.py
@@ -29,6 +29,7 @@ import atr.blueprints.get as get
import atr.config as config
import atr.db as db
import atr.db.interaction as interaction
+import atr.errors as errors
import atr.form as form
import atr.get.checklist as checklist
import atr.get.download as download
@@ -45,6 +46,7 @@ import atr.post as post
import atr.render as render
import atr.shared as shared
import atr.storage as storage
+import atr.strings as strings
import atr.template as template
import atr.user as user
import atr.util as util
@@ -72,10 +74,10 @@ async def category_and_release(
_committee=True,
_release_policy=True,
_project_release_policy=True,
- ).demand(base.ASFQuartException("Release does not exist", errorcode=404))
+ ).demand(base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404))
if release.committee is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
latest_vote_task = await interaction.release_current_vote_task(release, data)
@@ -424,7 +426,7 @@ def _render_header(
page.append(htm.p[badge])
if release.committee is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
voting_committee_name = _vote_committee_name(release)
page.p[
@@ -590,7 +592,7 @@ def _render_section_resolve(page: htm.Block, release: sql.Release, user_category
page.div[
htpy.a(".btn.btn-success", href=resolve_url)[
htpy.i(".bi.bi-clipboard-check.me-1"),
- "Resolve vote",
+ strings.RESOLVE_VOTE_BUTTON,
],
]
@@ -606,7 +608,7 @@ async def _render_section_vote(
page.h2("#vote")["3. Cast your vote"]
if release.committee is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
if release.effective_vote_mode == sql.VoteMode.MANUAL:
_render_vote_manual(page)
@@ -628,7 +630,7 @@ async def _render_trusted_vote_authenticated(
latest_vote_task: sql.Task | None,
) -> None:
if release.committee is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
latest_ballot = None
if release.current_vote_seq is not None:
@@ -692,7 +694,7 @@ async def _render_vote_authenticated(
latest_vote_task: sql.Task | None,
) -> None:
if release.committee is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
if session is None:
raise ValueError("Session required for authenticated vote")
@@ -743,7 +745,7 @@ def _render_vote_delivery(
]
else:
page.p["Your vote will be sent to ", htpy.code[vote_recipient], "."]
- if banner := render.archived_project_banner(release.project, "Release actions are disabled."):
+ if banner := render.archived_project_banner(release.project, errors.RELEASE_ACTIONS_DISABLED):
page.append(banner)
@@ -885,7 +887,7 @@ def _trusted_vote_status(
def _vote_committee_name(release: sql.Release) -> str:
if release.committee is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
if _is_podling_round_two(release):
return "Incubator"
return release.committee.display_name
@@ -935,7 +937,7 @@ def _vote_recipient(release: sql.Release, latest_vote_task: sql.Task | None) ->
if isinstance(task_email_to, str) and task_email_to:
return task_email_to
if release.committee is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
if _is_podling_round_two(release):
return util.INCUBATOR_GENERAL_ADDRESS
return f"dev@{release.committee.key}.apache.org"
diff --git a/atr/get/voting.py b/atr/get/voting.py
index 8a6d5b66..109f5b9a 100644
--- a/atr/get/voting.py
+++ b/atr/get/voting.py
@@ -26,6 +26,7 @@ import atr.config as config
import atr.construct as construct
import atr.db as db
import atr.db.interaction as interaction
+import atr.errors as errors
import atr.form as form
import atr.get.compose as compose
import atr.get.projects as projects
@@ -249,7 +250,7 @@ async def _render_page( # noqa: C901
htm.em[release.version],
]
- if banner := render.archived_project_banner(release.project, "Release actions are disabled."):
+ if banner := render.archived_project_banner(release.project, errors.RELEASE_ACTIONS_DISABLED):
page.append(banner)
page.div(".px-3.py-4.mb-4.bg-light.border.rounded")[
diff --git a/atr/post/announce.py b/atr/post/announce.py
index 2c161f6a..51dfcfa8 100644
--- a/atr/post/announce.py
+++ b/atr/post/announce.py
@@ -27,6 +27,7 @@ import quart
import atr.blueprints.post as post
import atr.config as config
import atr.construct as construct
+import atr.errors as errors
import atr.get as get
import atr.models.safe as safe
import atr.models.sql as sql
@@ -69,7 +70,7 @@ async def selected(
preview_revision_number = release.safe_latest_revision_number
if (committee := release.project.committee) is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
if response := await _validate_recipients(session, announce_form, util.unwrap(committee.key), release.project):
return response
diff --git a/atr/post/distribution.py b/atr/post/distribution.py
index 31694cfa..00c4046f 100644
--- a/atr/post/distribution.py
+++ b/atr/post/distribution.py
@@ -22,6 +22,7 @@ from typing import Final, Literal
import atr.blueprints.post as post
import atr.db as db
import atr.db.interaction as interaction
+import atr.errors as errors
import atr.get as get
import atr.models.distribution as distribution
import atr.models.safe as safe
@@ -137,7 +138,7 @@ async def delete(
async with db.session() as data:
release = await data.release(project_key=str(project_key), version=str(version_key)).demand(
- RuntimeError("Release does not exist")
+ RuntimeError(errors.RELEASE_NOT_FOUND)
)
if release.safe_key != delete_form.release_key:
raise RuntimeError("Release name mismatch")
diff --git a/atr/post/vote.py b/atr/post/vote.py
index c11f39c4..15cd9f6e 100644
--- a/atr/post/vote.py
+++ b/atr/post/vote.py
@@ -19,6 +19,7 @@ from typing import Literal
import quart
import atr.blueprints.post as post
+import atr.errors as errors
import atr.get as get
import atr.models.safe as safe
import atr.models.sql as sql
@@ -48,7 +49,7 @@ async def selected_post( # noqa: C901
)
if release.committee is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
if release.effective_vote_mode != cast_vote_form.vote_mode:
await quart.flash("The vote form is stale, please refresh and try again.", "error")
diff --git a/atr/storage/writers/vote.py b/atr/storage/writers/vote.py
index 57f0bc86..c4f43dce 100644
--- a/atr/storage/writers/vote.py
+++ b/atr/storage/writers/vote.py
@@ -27,6 +27,7 @@ import sqlmodel
import atr.construct as construct
import atr.db as db
import atr.db.interaction as interaction
+import atr.errors as errors
import atr.log as log
import atr.mail as mail
import atr.models.args as args
@@ -373,7 +374,7 @@ class ReleaseManager(CommitteeParticipant):
)
committee = await self._committee_for_release(release)
if committee is None:
- raise storage.AccessError("Release has no committee", status=500)
+ raise storage.AccessError(errors.RELEASE_NO_COMMITTEE, status=500)
if release.expedited:
email_to = f"private@{committee.key}.apache.org"
email_cc = []
diff --git a/atr/strings.py b/atr/strings.py
index 0a4839cf..b5fccada 100644
--- a/atr/strings.py
+++ b/atr/strings.py
@@ -19,4 +19,16 @@
from typing import Final
+# Button labels
+REGENERATE_KEYS_BUTTON: Final = "Regenerate KEYS file"
+RESET_INACTIVITY_CLOCK_BUTTON: Final = "Reset inactivity clock"
+RESOLVE_VOTE_BUTTON: Final = "Resolve vote"
VERIFY_DISTRIBUTION_BUTTON: Final = "Verify a third-party distribution"
+
+# File classification labels
+FILE_CLASS_BINARY: Final = "Binary artifact"
+FILE_CLASS_DIRECTORY: Final = "Directory"
+FILE_CLASS_DISALLOWED: Final = "Disallowed file"
+FILE_CLASS_METADATA: Final = "Metadata file"
+FILE_CLASS_SBOM: Final = "SBOM"
+FILE_CLASS_SOURCE: Final = "Source artifact"
diff --git a/atr/tasks/checks/__init__.py b/atr/tasks/checks/__init__.py
index c60e9d9b..505844fb 100644
--- a/atr/tasks/checks/__init__.py
+++ b/atr/tasks/checks/__init__.py
@@ -36,6 +36,7 @@ import atr.analysis as analysis
import atr.attestable as attestable
import atr.classify as classify
import atr.db as db
+import atr.errors as errors
import atr.hashes as hashes
import atr.log as log
import atr.models.safe as safe
@@ -490,13 +491,13 @@ async def _resolve_all_files(release: sql.Release, rel_path: str | None = None)
async def _resolve_committee_key(release: sql.Release, rel_path: str | None = None) -> str:
if release.committee is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
return release.committee.key
async def _resolve_committee_signing_keys(release: sql.Release, rel_path: str | None = None) -> list[str]:
if release.committee is None:
- raise ValueError("Release has no committee")
+ raise ValueError(errors.RELEASE_NO_COMMITTEE)
via = sql.validate_instrumented_attribute
committee_key = release.committee.key
async with db.session() as data:
diff --git a/atr/templates/check-selected-path-table.html b/atr/templates/check-selected-path-table.html
index 57386df7..35efd3a3 100644
--- a/atr/templates/check-selected-path-table.html
+++ b/atr/templates/check-selected-path-table.html
@@ -60,18 +60,18 @@
{% set file_type = info.file_types[path].value if (info and (path in info.file_types)) else None %}
{% if file_type == "disallowed" %}
- <span class="atr-classification-badge" title="Disallowed file">bad</span>
+ <span class="atr-classification-badge" title="{{ strings.FILE_CLASS_DISALLOWED }}">bad</span>
{% elif file_type == "source" %}
- <span class="atr-classification-badge" title="Source artifact">src</span>
+ <span class="atr-classification-badge" title="{{ strings.FILE_CLASS_SOURCE }}">src</span>
{% elif file_type == "directory" %}
- <span class="atr-classification-badge" title="Directory">dir</span>
+ <span class="atr-classification-badge" title="{{ strings.FILE_CLASS_DIRECTORY }}">dir</span>
{% elif file_type == "metadata" %}
- <span class="atr-classification-badge" title="Metadata file">meta</span>
+ <span class="atr-classification-badge" title="{{ strings.FILE_CLASS_METADATA }}">meta</span>
{% elif file_type == "sbom" %}
- <span class="atr-classification-badge" title="SBOM">sbom</span>
+ <span class="atr-classification-badge" title="{{ strings.FILE_CLASS_SBOM }}">sbom</span>
{# elif file_type == "binary" #}
{% else %}
- <span class="atr-classification-badge" title="Binary artifact">bin</span>
+ <span class="atr-classification-badge" title="{{ strings.FILE_CLASS_BINARY }}">bin</span>
{% endif %}
</td>
<td class="py-2">
diff --git a/atr/web.py b/atr/web.py
index 4f063b6e..7fc37e74 100644
--- a/atr/web.py
+++ b/atr/web.py
@@ -29,6 +29,7 @@ import werkzeug.datastructures.headers
import atr.config as config
import atr.db as db
+import atr.errors as errors
import atr.form as form
import atr.htm as htm
import atr.models.safe as safe
@@ -209,7 +210,7 @@ class Committer:
_project_release_policy=with_project_release_policy,
_revisions=with_revisions,
_distributions=with_distributions,
- ).demand(base.ASFQuartException("Release does not exist", errorcode=404))
+ ).demand(base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404))
else:
release = await data.release(
project_key=str(project_key),
@@ -222,7 +223,7 @@ class Committer:
_project_release_policy=with_project_release_policy,
_revisions=with_revisions,
_distributions=with_distributions,
- ).demand(base.ASFQuartException("Release does not exist", errorcode=404))
+ ).demand(base.ASFQuartException(errors.RELEASE_NOT_FOUND, errorcode=404))
return release
@property
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org
(tooling-trusted-releases) 01/05: #1386 - update SBOM docs
Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
alitheg pushed a commit to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit 33b9b9cd6ce5e01cdd06594c83473489afbd9282
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Tue Sep 15 18:12:21 2026 +0100
#1386 - update SBOM docs
---
atr/docs/developer-guide.md | 1 +
atr/docs/index.md | 1 +
atr/docs/resource-management.md | 2 +-
atr/docs/sbom-architecture.md | 106 +++++++++++++++++++++++++
atr/docs/sbom-workflows.md | 167 +++++-----------------------------------
5 files changed, 130 insertions(+), 147 deletions(-)
diff --git a/atr/docs/developer-guide.md b/atr/docs/developer-guide.md
index 4cd64a61..aedd7779 100644
--- a/atr/docs/developer-guide.md
+++ b/atr/docs/developer-guide.md
@@ -28,6 +28,7 @@
* `3.18.` [API documentation policy](api-documentation-policy)
* `3.19.` [ASFQuart usage](asfquart-usage)
* `3.20.` [Resource management](resource-management)
+* `3.21.` [SBOM architecture](sbom-architecture)
**Sections**:
diff --git a/atr/docs/index.md b/atr/docs/index.md
index c64027be..cf187feb 100644
--- a/atr/docs/index.md
+++ b/atr/docs/index.md
@@ -42,3 +42,4 @@ NOTE: This documentation is a work in progress.
* `3.18.` [API documentation policy](api-documentation-policy)
* `3.19.` [ASFQuart usage](asfquart-usage)
* `3.20.` [Resource management](resource-management)
+ * `3.21.` [SBOM architecture](sbom-architecture)
diff --git a/atr/docs/resource-management.md b/atr/docs/resource-management.md
index 53f21522..a7d7d9c6 100644
--- a/atr/docs/resource-management.md
+++ b/atr/docs/resource-management.md
@@ -4,7 +4,7 @@
**Prev**: `3.19.` [ASFQuart usage](asfquart-usage)
-**Next**: (none)
+**Next**: `3.21.` [SBOM architecture](sbom-architecture)
**Sections**:
diff --git a/atr/docs/sbom-architecture.md b/atr/docs/sbom-architecture.md
new file mode 100644
index 00000000..bf2ee108
--- /dev/null
+++ b/atr/docs/sbom-architecture.md
@@ -0,0 +1,106 @@
+# 3.21. SBOM architecture
+
+**Up**: `3.` [Developer guide](developer-guide)
+
+**Prev**: `3.20.` [Resource management](resource-management)
+
+**Next**: (none)
+
+**Sections**:
+
+* [Overview](#overview)
+* [Current status](#current-status)
+* [The SBOM package](#the-sbom-package)
+* [The SBOM CLI](#the-sbom-cli)
+* [Package modules](#package-modules)
+* [External tools](#external-tools)
+* [How the server uses the package](#how-the-server-uses-the-package)
+* [The SBOM report](#the-sbom-report)
+* [Related documentation](#related-documentation)
+
+## Overview
+
+This page describes how ATR's SBOM support is put together, for developers working on ATR itself. For a release manager's view of what the SBOM features do and how to use them, see [SBOM workflows](sbom-workflows).
+
+ATR works with SBOMs in the CycloneDX format, stored as `.cdx.json` files (and other suffixes) that sit beside the artifact they describe. A project-supplied SBOM is always preferred. Most of the SBOM logic lives in its own package, `atr/sbom/`, which the ATR server drives through a set of background tasks. Only the read-only report is currently exposed in the UI; see [Current status](#current-status).
+
+## Current status
+
+Only the read-only SBOM report is currently reachable from the UI. A file that is a CycloneDX JSON SBOM gets a *View SBOM* button in a release's checks (`atr/get/checks.py`), which opens the report described below.
+
+The other workflows, generation, conversion, OSV scanning, and augmentation, are present in the code, as task handlers in `atr/tasks/sbom.py` and as routes in `atr/post/draft.py` and `atr/post/sbom.py`, but nothing in the UI triggers them, so they are dormant. The intention is to build these into external tooling rather than the server, which is what the package's own command line (below) is a step toward. The rest of this page describes the whole toolkit, dormant paths included, since t [...]
+
+## The SBOM package
+
+`atr/sbom/` is its own package with its own command line, so the SBOM operations can be driven directly, not only through the server. The standalone entry point is `python -m atr.sbom` (`__main__.py` just calls `cli.main()`), and `cli.py`'s `setup_cli_logging` wires the shared logging up to stderr, so a bare CLI run produces the same diagnostics as the in-server code.
+
+That standalone use is why part of the package reads differently from the rest of the codebase. The modules on the CLI path refer to each other with relative, direct-name imports, for example `from .cyclonedx import validate_cli`, rather than the absolute, module-only style, `import atr.x as x`, that ATR uses everywhere else. The package also holds some server-only modules (`heatmap`, `observations`, `streaming`, and `maintenance`, used by the SBOM tasks and the catalog site, not by the [...]
+
+The package is not fully decoupled from ATR, though. Its core imports `atr.util` (in `utilities.py` and `osv.py`) alongside `atr.log` and `atr.loggers`, and its `heatmap` and `observations` modules also pull in `atr.metadata` and `atr.models.results`. It is standalone in the sense of having a working command line, not in the sense of having no ATR dependencies.
+
+## The SBOM CLI
+
+`cli.py` is the standalone command line. It takes a command and an SBOM path:
+
+```shell
+python -m atr.sbom <command> <sbom-path>
+```
+
+The commands map onto the package's operations:
+
+* `license` - list the license warnings (Category B) and errors (Category X).
+* `missing` and `where` - list, and locate within the document, the NTIA 2021 fields an SBOM is missing.
+* `osv` - scan the components against OSV.
+* `outdated` - report an SBOM written by a known-outdated tool.
+* `patch-ntia` and `patch-vuln` - emit the JSON patch that would add the missing NTIA metadata, or the OSV findings.
+* `merge` - apply the NTIA patch and print the resulting document.
+* `scores` - print the sbomqs score, before and after an NTIA merge.
+* `validate-cli` and `validate-py` - validate the document, through the CycloneDX CLI and through the CycloneDX Python library respectively.
+
+## Package modules
+
+Each command is a thin wrapper over a module that does the work, and the ATR server calls those same modules directly:
+
+* `cyclonedx.py` validates a document two ways: `validate_cli` shells out to the external `cyclonedx` binary, and `validate_py` uses the CycloneDX Python library.
+* `conformance.py` checks a document against the NTIA 2021 minimum data fields.
+* `licenses.py` places each declared license into an ASF policy category.
+* `sbomqs.py` runs the sbomqs scorer.
+* `osv.py` looks components up in OSV.
+* `tool.py` detects an SBOM written by an outdated tool version.
+* `utilities.py` loads a file into a `Bundle`, builds the NTIA and vulnerability patches, applies them, and writes documents back out.
+* `components.py` reads a document into the component breakdown the report renders.
+* `models/` holds the typed models the rest of the package passes around, including `bundle`, `conformance`, `licenses`, and `components`.
+
+The package also carries `maven.py`, which maps a date to the Maven plugin version current at that time, `spdx.py`, an SPDX license-expression parser, and a `constants` subpackage.
+
+## External tools
+
+The package, and the tasks around it, drive several external tools:
+
+* **syft** generates a CycloneDX SBOM from an artifact. This runs in the task layer (`atr/tasks/sbom.py`) under the sandbox, not in the package. Generation is currently dormant (see [Current status](#current-status)).
+* the **CycloneDX CLI** (`cyclonedx`) validates documents, through `cyclonedx.py`'s `validate_cli`.
+* **sbomqs** scores documents, through `sbomqs.py`.
+* **OSV** supplies vulnerability data, through `osv.py`.
+
+The CycloneDX Python library is a direct dependency too, used for validation and for writing documents out.
+
+## How the server uses the package
+
+The ATR server wraps the package's operations as background [tasks](tasks):
+
+* `atr/tasks/sbom.py` holds the task handlers. It runs syft for generation, and calls into `atr/sbom/` for conversion, scoring, scanning, and augmentation. The task types include `SBOM_GENERATE_CYCLONEDX`, `SBOM_CONVERT`, `SBOM_TOOL_SCORE`, `SBOM_QS_SCORE`, `SBOM_OSV_SCAN`, and `SBOM_AUGMENT`.
+* `atr/storage/writers/sbom.py` queues those tasks as the acting committee member.
+* `atr/post/draft.py` holds the generation and conversion routes (each would land its output as a new revision), and `atr/post/sbom.py` holds the report's scan and augment routes. None of these is currently triggered from the UI (see [Current status](#current-status)).
+* `atr/analysis.py` classifies files, with `is_cyclonedx_json` and `is_cyclonedx_xml` gating which operations apply to a given file.
+
+## The SBOM report
+
+`atr/get/sbom.py` builds the report programmatically with `atr/htm.py` rather than a template. The `quality` handler serves `/sbom/quality/<project>/<version>/<file>` and is reached from a file's check row (see `atr/get/checks.py` and `check-selected-path-table.html`).
+
+The page reads the most recent `SBOM_TOOL_SCORE` task for the file at the release's latest revision, and reads the component breakdown straight from the SBOM through `atr/sbom/components.py`. It deliberately does not render a single headline score: it surfaces the component list, license categories, declared vulnerabilities, and the conformance, outdated-tool, and CycloneDX CLI findings, so a reader sees the underlying issues rather than a number.
+
+## Related documentation
+
+* [SBOM workflows](sbom-workflows) is the user-facing counterpart to this page.
+* [Tasks](tasks) explains the background task system these operations run on.
+* [Checks](checks) covers the wider check pipeline the SBOM report is reached from.
diff --git a/atr/docs/sbom-workflows.md b/atr/docs/sbom-workflows.md
index 7545c028..0948bfdc 100644
--- a/atr/docs/sbom-workflows.md
+++ b/atr/docs/sbom-workflows.md
@@ -9,170 +9,45 @@
**Sections**:
* [Overview](#overview)
-* [Supported SBOM operations](#supported-sbom-operations)
-* [Convert XML SBOM to JSON](#convert-xml-sbom-to-json)
-* [CycloneDX validation](#cyclonedx-validation)
-* [SBOM scoring and validation](#sbom-scoring-and-validation)
-* [Vulnerability scanning](#vulnerability-scanning)
-* [SBOM augmentation](#sbom-augmentation)
-* [Related interfaces](#related-interfaces)
+* [Reading the SBOM report](#reading-the-sbom-report)
* [Related documentation](#related-documentation)
## Overview
-ATR provides multiple Software Bill of Materials (SBOM) workflows based on the CycloneDX specification. These workflows help projects generate, validate, augment, convert, and analyze SBOM files for release artifacts.
+A Software Bill of Materials (SBOM) lists the components that make up a release artifact, so that consumers can see what they are pulling in and check it against known vulnerabilities and license policy. ATR works with SBOMs in the [CycloneDX](https://cyclonedx.org/) format, stored as JSON files with a `.cdx.json` extension.
-ATR integrates several external tools including:
+The best SBOM is one your own build produces, because it knows what actually went into the artifact. When your build produces a CycloneDX JSON SBOM, include it in your release alongside the artifact it describes, and ATR will check it and give you an SBOM report for that file, described below.
-* syft
-* CycloneDX CLI
-* sbomqs
-* OSV
+ATR reads the SBOMs you supply. Producing them, and converting them from other formats, is a job for your own build.
-These workflows are primarily implemented in the `atr/tasks/sbom.py` module and exposed through draft and report interfaces.
+## Reading the SBOM report
-## Supported SBOM operations
+While a release is being prepared, its checks list each file with its results. Any file that is a CycloneDX JSON SBOM carries a **View SBOM** button that opens its SBOM report. The report has two halves: what the SBOM says about the release (Content), and how well-formed the SBOM itself is (Quality). Some of it, the Licenses and Vulnerabilities below and the whole Quality section, appears only once ATR's SBOM checks have run for the file, so parts may be blank on a first look.
-ATR supports several SBOM workflows for generation, conversion, analysis, and augmentation.
+### Content
-### Generate CycloneDX SBOM
+**Components** lists what the SBOM declares is in the artifact, grouped by type, with each component's name, version, licenses, and package URL (PURL) where the SBOM records one. If the SBOM names an overall subject, the report says which component that is. An SBOM that declares no components is worth a second look, as it usually means the tool that wrote it could not see inside the artifact.
-ATR can generate a CycloneDX JSON SBOM from supported release artifacts including:
+**Licenses** places each declared license in a category of the [ASF third party license policy](https://www.apache.org/legal/resolved.html): Category A (permitted), Category B (permitted with conditions), or Category X (not permitted). The categories are read from the license strings the SBOM tool wrote into the file, and those strings can be wrong. A project can declare its license inaccurately in its build file, and an SBOM tool can map a license name to the wrong identifier. A license [...]
-* `.tar.gz`
-* `.tgz`
-* `.zip`
-* `.jar`
+So treat anything unexpected as something to check rather than a verdict. Look it up against the upstream project, then report a wrong declaration to that project, a wrong mapping to the SBOM tool, and a correctly spelled license that ATR fails to place, or places wrongly, to [ATR](https://github.com/apache/tooling-trusted-release/issues).
-SBOM generation uses the `syft` tool and produces `.cdx.json` files.
+Where a component offers a choice of licenses (an `OR` expression), ATR picks the friendliest category and shows the half it chose in colour, with the alternatives it set aside greyed out, so you can see what was on offer without the alternatives reading as a problem.
-Generation tasks are queued through:
+**Vulnerabilities** shows the known vulnerabilities recorded in the SBOM. An SBOM does not carry these unless whatever produced it added them, so this section is empty when the SBOM records none.
-* `atr/post/draft.py`
-* `atr/storage/writers/sbom.py`
+### Quality
-Core implementation:
+The Quality section reports on the SBOM document rather than the release:
-* `generate_cyclonedx`
-* `_generate_cyclonedx_core`
+* **Conformance** checks the SBOM against the NTIA 2021 minimum data fields and lists anything missing as warnings or errors.
+* **Outdated tool** flags an SBOM written by a tool version known to have problems.
+* **CycloneDX CLI validation** lists any structural or schema errors found in the file.
-## Convert XML SBOM to JSON
-
-ATR can convert CycloneDX XML SBOM files into JSON format.
-
-Supported input:
-
-* `.cdx.xml`
-
-Generated output:
-
-* `.cdx.json`
-
-Core implementation:
-
-* `convert_cyclonedx`
-* `_convert_cyclonedx_core`
-
-## CycloneDX validation
-
-ATR validates CycloneDX SBOM files using the CycloneDX CLI.
-
-Validation workflows detect:
-
-* schema violations
-* malformed SBOM structures
-* invalid metadata
-* specification compatibility issues
-
-Related modules include:
-
-* `atr/sbom/cyclonedx.py`
-
-## SBOM scoring and validation
-
-ATR performs several validation and scoring operations for CycloneDX SBOM files.
-
-These include:
-
-* CycloneDX CLI validation
-* NTIA 2021 conformance checks
-* license analysis
-* vulnerability analysis
-* tool version analysis
-
-License analysis places each declared license in a category of the [ASF third party license policy](https://www.apache.org/legal/resolved.html), reading the license strings that the SBOM tool wrote into the file. Those strings can be wrong. A project can declare its license inaccurately in its build file, and an SBOM tool can map a license name to the wrong identifier. A license that ATR does not recognise is treated as Category X. Check anything unexpected against the upstream project. [...]
-
-The scoring workflow is implemented through:
-
-* `score_tool`
-
-Related modules include:
-
-* `atr/sbom/conformance.py`
-* `atr/sbom/licenses.py`
-* `atr/sbom/cyclonedx.py`
-* `atr/sbom/sbomqs.py`
-
-## Vulnerability scanning
-
-ATR supports vulnerability analysis through OSV integration.
-
-The OSV workflow:
-
-* scans CycloneDX SBOM files
-* identifies known vulnerabilities
-* augments SBOM files with vulnerability information
-
-Core implementation:
-
-* `osv_scan`
-* `bundle_to_vuln_patch`
-
-Related modules:
-
-* `atr/sbom/osv.py`
-
-## SBOM augmentation
-
-ATR can augment existing SBOM files with additional metadata and NTIA-related properties.
-
-Augmentation workflows may generate updated revisions containing modified SBOM files.
-
-Core implementation:
-
-* `augment`
-* `bundle_to_ntia_patch`
-
-## Related interfaces
-
-SBOM functionality is exposed through several application layers.
-
-Task handlers:
-
-* `atr/tasks/sbom.py`
-
-POST endpoints:
-
-* `atr/post/sbom.py`
-* `atr/post/draft.py`
-
-GET interfaces:
-
-* `atr/get/sbom.py`
-
-Storage writers:
-
-* `atr/storage/writers/sbom.py`
-
-Templates:
-
-* `atr/templates/draft-tools.html`
-* `atr/templates/check-selected-path-table.html`
+The Quality section only has something to show once the checks behind it have run, so if it is empty, give it a moment and reload.
## Related documentation
-Additional SBOM-related behavior is described in:
-
-* [Checks](checks)
-* [Running the server](running-the-server)
-* [Overview of the code](overview-of-the-code)
+* [Checks](checks) covers the wider set of automated checks a release goes through, including how the SBOM report is reached.
+* [License checks](license-checks) explains the license checking that ATR applies to the release as a whole.
+* [SBOM architecture](sbom-architecture) describes how these workflows are built, for developers working on ATR itself.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org
(tooling-trusted-releases) 05/05: Extract some duplicated code in distribution list pages
Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
alitheg pushed a commit to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit 7f9da5b2ec0046ac79409efc660e6e4eb57b2947
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Wed Sep 16 10:25:20 2026 +0100
Extract some duplicated code in distribution list pages
---
atr/get/distribution.py | 69 ++++---------------------------------------
atr/get/finish.py | 73 ++++------------------------------------------
atr/shared/distribution.py | 64 +++++++++++++++++++++++++++++++++++++++-
3 files changed, 74 insertions(+), 132 deletions(-)
diff --git a/atr/get/distribution.py b/atr/get/distribution.py
index 452346c6..d7018c4d 100644
--- a/atr/get/distribution.py
+++ b/atr/get/distribution.py
@@ -25,7 +25,6 @@ import atr.db as db
import atr.errors as errors
import atr.form as form
import atr.htm as htm
-import atr.models.args as args
import atr.models.safe as safe
import atr.models.sql as sql
import atr.post as post
@@ -84,7 +83,11 @@ async def list_get(
block.h1["Third-party distribution list for ", htm.em[f"{project_key!s}-{version_key!s}"]]
if len(tasks) > 0:
- _render_distribution_tasks(tasks, block, project_key, version_key)
+ block.append(
+ shared.distribution.render_distribution_tasks(
+ tasks, util.as_url(list_get, project_key=str(project_key), version_key=str(version_key))
+ )
+ )
if not distributions:
block.p["No distributions found."]
@@ -323,71 +326,9 @@ async def _record_form_page(project: safe.ProjectKey, version: safe.VersionKey,
return await template.blank(title, content=block.collect())
-def _render_distribution_tasks(
- tasks: Sequence[sql.Task], block: htm.Block, project_key: safe.ProjectKey, version_key: safe.VersionKey
-):
- failed_tasks = [
- t for t in tasks if (t.status == sql.TaskStatus.FAILED) or (t.workflow and (t.workflow.status == "failed"))
- ]
- in_progress_tasks = [
- t
- for t in tasks
- if (t.status in [sql.TaskStatus.QUEUED, sql.TaskStatus.ACTIVE])
- or (t.workflow and (t.workflow.status not in ["completed", "success", "failed"]))
- ]
- if len(failed_tasks) > 0:
- summary = f"{len(failed_tasks)} distribution{'s' if (len(failed_tasks) != 1) else ''} failed for this version"
- block.append(
- htm.div(".alert.alert-danger.mb-3")[
- htm.h3["Failed distributions"],
- htm.details[
- htm.summary[summary],
- htm.div[*[_render_task(f) for f in failed_tasks]],
- ],
- ]
- )
- if len(in_progress_tasks) > 0:
- block.append(
- htm.div(".alert.alert-info.mb-3")[
- htm.h3["In-progress distributions"],
- htm.p["One or more automatic distributions are still in-progress:"],
- *[_render_task(f) for f in in_progress_tasks],
- htm.a(
- ".btn.btn-success.mt-2",
- href=util.as_url(
- list_get,
- project_key=str(project_key),
- version_key=str(version_key),
- ),
- )["Refresh"],
- ]
- )
-
-
def _render_embargo_banner(block: htm.Block) -> None:
block.div(".p-3.mb-4.bg-danger-subtle.border.border-danger.rounded")[
"This is an expedited security release, and is embargoed. Distributing on third party platforms"
" makes the release files public, which breaks the embargo. Please ensure that you have the"
" authority to lift the embargo before distributing. This action is not reversible."
]
-
-
-def _render_task(task: sql.Task) -> htm.Element:
- """Render a distribution task's details."""
- workflow_args: args.DistributionWorkflow = args.DistributionWorkflow.model_validate(task.task_args)
- task_date = task.added.strftime("%Y-%m-%d %H:%M:%S")
- task_status = task.status.value
- workflow_status = task.workflow.status if task.workflow else ""
- workflow_message = (
- task.workflow.message if (task.workflow and task.workflow.message) else workflow_status.capitalize()
- )
- if task_status != sql.TaskStatus.COMPLETED:
- return htm.details(".ms-4")[
- htm.summary[f"{task_date} {workflow_args.platform} ({workflow_args.package} {workflow_args.version})"],
- htm.p(".ms-4")[task.error if task.error else task_status.capitalize()],
- ]
- else:
- return htm.details(".ms-4")[
- htm.summary[f"{task_date} {workflow_args.platform} ({workflow_args.package} {workflow_args.version})"],
- *[htm.p(".ms-4")[w] for w in workflow_message.split("\n")],
- ]
diff --git a/atr/get/finish.py b/atr/get/finish.py
index e1c1208f..b5cc95d0 100644
--- a/atr/get/finish.py
+++ b/atr/get/finish.py
@@ -37,7 +37,6 @@ import atr.get.file as file
import atr.get.root as root
import atr.htm as htm
import atr.mapping as mapping
-import atr.models.args as args
import atr.models.results as results
import atr.models.safe as safe
import atr.models.sql as sql
@@ -180,50 +179,6 @@ def _render_distribution_buttons(release: sql.Release, is_admin: bool) -> htm.El
return htm.div()[htm.p(".mb-1")[buttons],]
-def _render_distribution_tasks(release: sql.Release, tasks: Sequence[sql.Task]) -> htm.Element:
- """Render current and failed distribution tasks."""
- failed_tasks = [
- t for t in tasks if (t.status == sql.TaskStatus.FAILED) or (t.workflow and (t.workflow.status == "failed"))
- ]
- in_progress_tasks = [
- t
- for t in tasks
- if (t.status in [sql.TaskStatus.QUEUED, sql.TaskStatus.ACTIVE])
- or (t.workflow and (t.workflow.status not in ["completed", "success", "failed"]))
- ]
-
- block = htm.Block()
-
- if len(failed_tasks) > 0:
- summary = f"{len(failed_tasks)} distribution{'s' if (len(failed_tasks) != 1) else ''} failed for this release"
- block.append(
- htm.div(".alert.alert-danger.mb-3")[
- htm.h3["Failed distributions"],
- htm.details[
- htm.summary[summary],
- htm.div[*[_render_task(f) for f in failed_tasks]],
- ],
- ]
- )
- if len(in_progress_tasks) > 0:
- block.append(
- htm.div(".alert.alert-info.mb-3")[
- htm.h3["In-progress distributions"],
- htm.p["One or more automatic distributions are still in-progress:"],
- *[_render_task(f) for f in in_progress_tasks],
- htm.a(
- ".btn.btn-success.mt-2",
- href=util.as_url(
- selected,
- project_key=release.project.key,
- version_key=release.version,
- ),
- )["Refresh"],
- ]
- )
- return block.collect()
-
-
async def _render_page(
session: web.Committer,
release: sql.Release,
@@ -280,7 +235,12 @@ async def _render_page(
]
if len(distribution_tasks) > 0:
- page.append(_render_distribution_tasks(release, distribution_tasks))
+ page.append(
+ shared.distribution.render_distribution_tasks(
+ distribution_tasks,
+ util.as_url(selected, project_key=release.project.key, version_key=release.version),
+ )
+ )
page.append(_render_dist_warning())
page.append(_render_distribution_buttons(release, session.is_admin))
@@ -443,27 +403,6 @@ def _render_svn_publish_completed(page: htm.Block, release: sql.Release, complet
page.div(".alert.alert-success.mb-4")[text, " at ", htm.a(href=url)[url]]
-def _render_task(task: sql.Task) -> htm.Element:
- """Render a distribution task's details."""
- workflow_args: args.DistributionWorkflow = args.DistributionWorkflow.model_validate(task.task_args)
- task_date = task.added.strftime("%Y-%m-%d %H:%M:%S")
- task_status = task.status.value
- workflow_status = task.workflow.status if task.workflow else ""
- workflow_message = (
- task.workflow.message if (task.workflow and task.workflow.message) else workflow_status.capitalize()
- )
- if task_status != sql.TaskStatus.COMPLETED:
- return htm.details(".ms-4")[
- htm.summary[f"{task_date} {workflow_args.platform} ({workflow_args.package} {workflow_args.version})"],
- htm.p(".ms-4")[task.error if task.error else task_status.capitalize()],
- ]
- else:
- return htm.details(".ms-4")[
- htm.summary[f"{task_date} {workflow_args.platform} ({workflow_args.package} {workflow_args.version})"],
- *[htm.p(".ms-4")[w] for w in workflow_message.split("\n")],
- ]
-
-
def _svn_download_path_default(release: sql.Release) -> str:
suffix = construct.effective_download_path_suffix(release)
return str(suffix) if suffix is not None else ""
diff --git a/atr/shared/distribution.py b/atr/shared/distribution.py
index 7d574bb6..aa0b7e99 100644
--- a/atr/shared/distribution.py
+++ b/atr/shared/distribution.py
@@ -20,7 +20,10 @@ from __future__ import annotations
import datetime
import enum
import urllib.parse
-from typing import Final
+from typing import TYPE_CHECKING, Final
+
+if TYPE_CHECKING:
+ from collections.abc import Sequence
import aiohttp
import pydantic
@@ -28,6 +31,7 @@ import pydantic
import atr.db as db
import atr.form as form
import atr.htm as htm
+import atr.models.args as args
import atr.models.basic as basic
import atr.models.distribution as distribution
import atr.models.safe as safe
@@ -456,6 +460,64 @@ async def release_validated_and_committee(
return release, committee
+def render_distribution_tasks(tasks: Sequence[sql.Task], refresh_url: str) -> htm.Element:
+ """Render current and failed distribution tasks."""
+ failed_tasks = [
+ t for t in tasks if (t.status == sql.TaskStatus.FAILED) or (t.workflow and (t.workflow.status == "failed"))
+ ]
+ in_progress_tasks = [
+ t
+ for t in tasks
+ if (t.status in [sql.TaskStatus.QUEUED, sql.TaskStatus.ACTIVE])
+ or (t.workflow and (t.workflow.status not in ["completed", "success", "failed"]))
+ ]
+
+ block = htm.Block()
+
+ if len(failed_tasks) > 0:
+ summary = f"{len(failed_tasks)} distribution{'s' if (len(failed_tasks) != 1) else ''} failed for this release"
+ block.append(
+ htm.div(".alert.alert-danger.mb-3")[
+ htm.h3["Failed distributions"],
+ htm.details[
+ htm.summary[summary],
+ htm.div[*[render_task(f) for f in failed_tasks]],
+ ],
+ ]
+ )
+ if len(in_progress_tasks) > 0:
+ block.append(
+ htm.div(".alert.alert-info.mb-3")[
+ htm.h3["In-progress distributions"],
+ htm.p["One or more automatic distributions are still in-progress:"],
+ *[render_task(f) for f in in_progress_tasks],
+ htm.a(".btn.btn-success.mt-2", href=refresh_url)["Refresh"],
+ ]
+ )
+ return block.collect()
+
+
+def render_task(task: sql.Task) -> htm.Element:
+ """Render a distribution task's details."""
+ workflow_args: args.DistributionWorkflow = args.DistributionWorkflow.model_validate(task.task_args)
+ task_date = task.added.strftime("%Y-%m-%d %H:%M:%S")
+ task_status = task.status.value
+ workflow_status = task.workflow.status if task.workflow else ""
+ workflow_message = (
+ task.workflow.message if (task.workflow and task.workflow.message) else workflow_status.capitalize()
+ )
+ if task_status != sql.TaskStatus.COMPLETED:
+ return htm.details(".ms-4")[
+ htm.summary[f"{task_date} {workflow_args.platform} ({workflow_args.package} {workflow_args.version})"],
+ htm.p(".ms-4")[task.error if task.error else task_status.capitalize()],
+ ]
+ else:
+ return htm.details(".ms-4")[
+ htm.summary[f"{task_date} {workflow_args.platform} ({workflow_args.package} {workflow_args.version})"],
+ *[htm.p(".ms-4")[w] for w in workflow_message.split("\n")],
+ ]
+
+
def _template_url(
dd: distribution.Data,
staging: bool | None = None,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org
(tooling-trusted-releases) 03/05: #1590 - some more wording tweaks and introduce strings module
Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
alitheg pushed a commit to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit c04e457a46ff788df45b4921048e6d15ac7a2f72
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Wed Sep 16 09:48:53 2026 +0100
#1590 - some more wording tweaks and introduce strings module
---
atr/get/distribution.py | 15 ++++++++-------
atr/get/finish.py | 3 ++-
atr/server.py | 2 ++
atr/strings.py | 22 ++++++++++++++++++++++
atr/templates/check-selected.html | 6 +++---
5 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/atr/get/distribution.py b/atr/get/distribution.py
index 2dee7a91..d5289470 100644
--- a/atr/get/distribution.py
+++ b/atr/get/distribution.py
@@ -30,6 +30,7 @@ import atr.models.sql as sql
import atr.post as post
import atr.render as render
import atr.shared as shared
+import atr.strings as strings
import atr.template as template
import atr.util as util
import atr.web as web
@@ -76,10 +77,10 @@ async def list_get(
project_key=str(project_key),
version_key=str(version_key),
),
- )["Record a distribution"]
+ )[strings.VERIFY_DISTRIBUTION_BUTTON]
# Distribution list for project-version
- block.h1["Distribution list for ", htm.em[f"{project_key!s}-{version_key!s}"]]
+ block.h1["Third-party distribution list for ", htm.em[f"{project_key!s}-{version_key!s}"]]
if len(tasks) > 0:
_render_distribution_tasks(tasks, block, project_key, version_key)
@@ -91,15 +92,15 @@ async def list_get(
"Distribution list",
content=block.collect(),
)
- block.p["Here are all of the distributions recorded for this release."]
+ block.p["Here are all of the third-party distributions recorded for this release."]
block.p[record_a_distribution]
# Table of contents
block.append(htm.ul_links(*[(f"#distribution-{dist.identifier}", dist.title) for dist in distributions]))
- ## Distributions on third party platforms
- block.h2["Distributions on third party platforms"]
+ ## Distributions on third-party platforms
+ block.h2["Distributions on third-party platforms"]
block.p[
- "These are distributions that are hosted on third party platforms such as Maven Central, PyPI, or Docker Hub."
+ "These are distributions that are hosted on third-party platforms such as Maven Central, PyPI, or Docker Hub."
]
for dist in distributions:
title_extra = []
@@ -272,7 +273,7 @@ async def _record_form_page(project: safe.ProjectKey, version: safe.VersionKey,
block = htm.Block()
render.html_nav_phase(block, str(project), str(version), staging=staging)
- title = "Record a manual staging distribution" if staging else "Record a third-party distribution"
+ title = "Record a staging third-party distribution" if staging else "Record a third-party distribution"
block.h1[title]
if (not staging) and release.is_embargoed:
diff --git a/atr/get/finish.py b/atr/get/finish.py
index 0ac90c7b..c11d4eae 100644
--- a/atr/get/finish.py
+++ b/atr/get/finish.py
@@ -44,6 +44,7 @@ import atr.post as post
import atr.render as render
import atr.shared as shared
import atr.shared.activity as activity
+import atr.strings as strings
import atr.template as template
import atr.user as user
import atr.util as util
@@ -173,7 +174,7 @@ def _render_distribution_buttons(release: sql.Release, is_admin: bool) -> htm.El
project_key=release.project.key,
version_key=release.version,
),
- )["Record a manual distribution"]
+ )[strings.VERIFY_DISTRIBUTION_BUTTON]
)
return htm.div()[htm.p(".mb-1")[buttons],]
diff --git a/atr/server.py b/atr/server.py
index 70070f5f..c45004f7 100644
--- a/atr/server.py
+++ b/atr/server.py
@@ -69,6 +69,7 @@ import atr.pubsub as pubsub
import atr.sessions as sessions
import atr.ssh as ssh
import atr.storage as storage
+import atr.strings as strings
import atr.svn as svn
import atr.tasks as tasks
import atr.tasks.quarantine as quarantine
@@ -335,6 +336,7 @@ def _app_setup_context(app: base.QuartApp) -> None:
"post": post,
"release_catalog_url": config.get().RELEASE_CATALOG_URL,
"static_url": util.static_url,
+ "strings": strings,
"topnav_unfinished_releases": topnav_unfinished_releases,
"topnav_user_projects": topnav_user_projects,
"release_as_url": mapping.release_as_url,
diff --git a/atr/strings.py b/atr/strings.py
new file mode 100644
index 00000000..0a4839cf
--- /dev/null
+++ b/atr/strings.py
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""User-facing UI strings, kept in one place so the same wording is shared between templates and code."""
+
+from typing import Final
+
+VERIFY_DISTRIBUTION_BUTTON: Final = "Verify a third-party distribution"
diff --git a/atr/templates/check-selected.html b/atr/templates/check-selected.html
index c775e009..9bfb3c34 100644
--- a/atr/templates/check-selected.html
+++ b/atr/templates/check-selected.html
@@ -134,9 +134,9 @@
</div>
</div>
{% if phase == "release_candidate_draft" %}
- <h3 id="distribution" class="mt-4">Distribution</h3>
+ <h3 id="distribution" class="mt-4">Third-party distribution</h3>
<p>
- While this release is in draft, you can create a staging distribution. Use the button below to record a manual distribution performed outside of ATR.
+ While this release is in draft, you can record a staging-level third-party distribution - an artifact published outside ATR, such as to Maven Central Staging. ATR will verify that it exists before recording it.
</p>
{# <div class="alert alert-warning mb-4">#}
{# <p class="fw-semibold mb-1">NOTE:</p>#}
@@ -146,7 +146,7 @@
{# <a class="btn btn-primary"#}
{# href="{{ as_url(get.distribution.stage_automate, project_key=release.project.key, version_key=release.version) }}">Distribute</a>#}
<a class="btn btn-primary"
- href="{{ as_url(get.distribution.stage_record, project_key=release.project.key, version_key=release.version) }}">Record a manual distribution</a>
+ href="{{ as_url(get.distribution.stage_record, project_key=release.project.key, version_key=release.version) }}">{{ strings.VERIFY_DISTRIBUTION_BUTTON }}</a>
</p>
<div id="move-files-container">
{% if move_file_html %}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org
(tooling-trusted-releases) 02/05: Add created date back into json file
Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
alitheg pushed a commit to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit fc0a242d86b92d2dbba4ccd3b50bc3840b09786d
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Wed Sep 16 09:38:06 2026 +0100
Add created date back into json file
---
atr/catalog_site.py | 5 ++---
tests/unit/test_catalog_site.py | 12 ++++++------
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/atr/catalog_site.py b/atr/catalog_site.py
index 288a72c1..3fb4c8f1 100644
--- a/atr/catalog_site.py
+++ b/atr/catalog_site.py
@@ -549,9 +549,7 @@ def _project_releases_entry(
}
# The rest are carried over only when the project holds them, so an absent field is
- # left out rather than sent as null, the same as projects.json does. There's no
- # "created": ATR only knows when it ingested the project, not when it was founded,
- # which is what projects.json means by it.
+ # left out rather than sent as null, the same as projects.json does.
def put(key: str, value: str | None) -> None:
if value:
entry[key] = value
@@ -564,6 +562,7 @@ def _project_releases_entry(
put("mailing-list", project.mailing_lists)
put("programming-language", project.programming_languages)
put("category", _categories(project.categories))
+ put("created", _date_only(project.created))
if project.repositories:
entry["repository"] = project.repositories
return entry
diff --git a/tests/unit/test_catalog_site.py b/tests/unit/test_catalog_site.py
index 4a92019f..e424b210 100644
--- a/tests/unit/test_catalog_site.py
+++ b/tests/unit/test_catalog_site.py
@@ -464,10 +464,9 @@ def test_project_releases_entry_maps_the_projects_json_fields() -> None:
assert entry["download-page"] == "https://example.apache.org/download"
assert entry["bug-database"] == "https://issues.apache.org/jira/browse/EXAMPLE"
assert entry["mailing-list"] == "https://example.apache.org/mailing-lists"
- # No project-level "created": ATR knows only when it ingested the project, not when it
- # was founded, so it's left out rather than published as the wrong date.
- assert "created" not in entry
- # Release-level dates are real, so those stay.
+ # Project-level "created" is the project's date, formatted as a day.
+ assert entry["created"] == "2012-03-26"
+ # Release-level dates are real too.
assert entry["release"] == [
{"name": "Apache Example", "revision": "2.0.0", "created": "2024-08-12"},
{"name": "Apache Example", "revision": "1.0.0", "created": "2022-11-01"},
@@ -480,8 +479,9 @@ def test_project_releases_entry_leaves_out_fields_the_project_does_not_hold() ->
entry = catalog_site._project_releases_entry(project, committee, [])
- # The always-present fields stay; the absent ones are left out rather than sent as null.
- assert set(entry) == {"name", "pmc", "license", "maintainer", "release"}
+ # The always-present fields stay (created included - project.created is never null);
+ # the absent ones are left out rather than sent as null.
+ assert set(entry) == {"name", "pmc", "license", "maintainer", "release", "created"}
assert entry["release"] == []
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org