feat: project Nexus SBOM state into summaries
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Build and Publish Multi-Context Image / build-and-push (push) Successful in 25s

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a028f0-a42f-7582-89a8-ebaad7343834
This commit is contained in:
tegwick 2026-08-22 20:12:16 +02:00
parent e1e259cf87
commit 76e6eda086
4 changed files with 172 additions and 42 deletions

View file

@ -27,6 +27,8 @@ from api.models.workplan import Workplan
from api.models.workplan_dependency import WorkplanDependency
from api.schemas.progress_event import ProgressEventRead
from api.schemas.state import StateSummary
from api.services.sbom_nexus import get_json as get_sbom_nexus_json
from api.services.sbom_nexus import reads_from_nexus
logger = logging.getLogger(__name__)
@ -88,9 +90,17 @@ async def fetch_summary_revision(session: AsyncSession) -> SummaryRevision:
if value is not None:
core_parts.append(value)
sbom_at = (
await session.execute(select(func.max(SBOMSnapshot.snapshot_at)))
).scalar_one_or_none()
if reads_from_nexus():
snapshots = await get_sbom_nexus_json("/sbom/snapshots/")
snapshot_times = [
datetime.fromisoformat(item["snapshot_at"].replace("Z", "+00:00"))
for item in snapshots
]
sbom_at = max(snapshot_times, default=None)
else:
sbom_at = (
await session.execute(select(func.max(SBOMSnapshot.snapshot_at)))
).scalar_one_or_none()
progress_at = (
await session.execute(select(func.max(ProgressEvent.created_at)))
@ -285,4 +295,4 @@ async def apply_progress_section(
cache._entry.progress_revision = revision.progress_fingerprint()
else:
cache.store(merged, revision)
return merged
return merged