mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-09-20 17:24:16 +00:00
add attestation badge to tags
This commit is contained in:
@@ -148,8 +148,9 @@ type PlatformInfo struct {
|
||||
// TagWithPlatforms extends Tag with platform information
|
||||
type TagWithPlatforms struct {
|
||||
Tag
|
||||
Platforms []PlatformInfo
|
||||
IsMultiArch bool
|
||||
Platforms []PlatformInfo
|
||||
IsMultiArch bool
|
||||
HasAttestations bool // true if manifest list contains attestation references
|
||||
}
|
||||
|
||||
// ManifestWithMetadata extends Manifest with tags and platform information
|
||||
|
||||
@@ -596,6 +596,7 @@ func DeleteTag(db *sql.DB, did, repository, tag string) error {
|
||||
// GetTagsWithPlatforms returns all tags for a repository with platform information
|
||||
// Only multi-arch tags (manifest lists) have platform info in manifest_references
|
||||
// Single-arch tags will have empty Platforms slice (platform is obvious for single-arch)
|
||||
// Attestation references (unknown/unknown platforms) are filtered out but tracked via HasAttestations
|
||||
func GetTagsWithPlatforms(db *sql.DB, did, repository string) ([]TagWithPlatforms, error) {
|
||||
rows, err := db.Query(`
|
||||
SELECT
|
||||
@@ -609,7 +610,8 @@ func GetTagsWithPlatforms(db *sql.DB, did, repository string) ([]TagWithPlatform
|
||||
COALESCE(mr.platform_os, '') as platform_os,
|
||||
COALESCE(mr.platform_architecture, '') as platform_architecture,
|
||||
COALESCE(mr.platform_variant, '') as platform_variant,
|
||||
COALESCE(mr.platform_os_version, '') as platform_os_version
|
||||
COALESCE(mr.platform_os_version, '') as platform_os_version,
|
||||
COALESCE(mr.is_attestation, 0) as is_attestation
|
||||
FROM tags t
|
||||
JOIN manifests m ON t.digest = m.digest AND t.did = m.did AND t.repository = m.repository
|
||||
LEFT JOIN manifest_references mr ON m.id = mr.manifest_id
|
||||
@@ -629,9 +631,10 @@ func GetTagsWithPlatforms(db *sql.DB, did, repository string) ([]TagWithPlatform
|
||||
for rows.Next() {
|
||||
var t Tag
|
||||
var mediaType, platformOS, platformArch, platformVariant, platformOSVersion string
|
||||
var isAttestation bool
|
||||
|
||||
if err := rows.Scan(&t.ID, &t.DID, &t.Repository, &t.Tag, &t.Digest, &t.CreatedAt,
|
||||
&mediaType, &platformOS, &platformArch, &platformVariant, &platformOSVersion); err != nil {
|
||||
&mediaType, &platformOS, &platformArch, &platformVariant, &platformOSVersion, &isAttestation); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -645,6 +648,13 @@ func GetTagsWithPlatforms(db *sql.DB, did, repository string) ([]TagWithPlatform
|
||||
tagOrder = append(tagOrder, tagKey)
|
||||
}
|
||||
|
||||
// Track if manifest list has attestations
|
||||
if isAttestation {
|
||||
tagMap[tagKey].HasAttestations = true
|
||||
// Skip attestation references in platform display
|
||||
continue
|
||||
}
|
||||
|
||||
// Add platform info if present (only for multi-arch manifest lists)
|
||||
if platformOS != "" || platformArch != "" {
|
||||
tagMap[tagKey].Platforms = append(tagMap[tagKey].Platforms, PlatformInfo{
|
||||
|
||||
@@ -1004,13 +1004,6 @@ a.license-badge:hover {
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
/* Load More Button */
|
||||
.load-more {
|
||||
width: 100%;
|
||||
margin-top: 1rem;
|
||||
background: var(--secondary);
|
||||
}
|
||||
|
||||
/* Login Page */
|
||||
.login-page {
|
||||
max-width: 450px;
|
||||
|
||||
@@ -130,6 +130,9 @@
|
||||
{{ if .IsMultiArch }}
|
||||
<span class="badge-multi">Multi-arch</span>
|
||||
{{ end }}
|
||||
{{ if .HasAttestations }}
|
||||
<span class="badge-attestation"><i data-lucide="shield-check"></i> Attestations</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div style="display: flex; gap: 1rem; align-items: center;">
|
||||
<time class="tag-timestamp" datetime="{{ .Tag.CreatedAt.Format "2006-01-02T15:04:05Z07:00" }}">
|
||||
|
||||
@@ -44,15 +44,6 @@
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ if .HasMore }}
|
||||
<button class="load-more"
|
||||
hx-get="/api/recent-pushes?offset={{ .NextOffset }}"
|
||||
hx-target="#push-list"
|
||||
hx-swap="beforeend">
|
||||
Load More
|
||||
</button>
|
||||
{{ end }}
|
||||
|
||||
{{ if eq (len .Pushes) 0 }}
|
||||
<div class="empty-state">
|
||||
<p>No pushes yet. Start using ATCR by pushing your first image!</p>
|
||||
|
||||
Reference in New Issue
Block a user