mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-08-28 20:06:02 +00:00
fix to artifact diff. add missing file
This commit is contained in:
@@ -1489,6 +1489,39 @@ func UpdateFirehoseCursor(db DBTX, cursor int64) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// GetChildManifestPlatform returns the platform info for a manifest that is
|
||||
// referenced as a child of a manifest list. Returns nil if the digest is not
|
||||
// a child of any manifest list (i.e., it's a top-level single-arch manifest).
|
||||
// Used by the diff handler to match architectures when comparing a platform
|
||||
// child digest against a manifest list (or another child).
|
||||
func GetChildManifestPlatform(db DBTX, did, repository, digest string) (*PlatformInfo, error) {
|
||||
var p PlatformInfo
|
||||
var arch, os, variant, osVersion sql.NullString
|
||||
err := db.QueryRow(`
|
||||
SELECT
|
||||
COALESCE(mr.platform_os, ''),
|
||||
COALESCE(mr.platform_architecture, ''),
|
||||
COALESCE(mr.platform_variant, ''),
|
||||
COALESCE(mr.platform_os_version, '')
|
||||
FROM manifest_references mr
|
||||
JOIN manifests m ON mr.manifest_id = m.id
|
||||
WHERE m.did = ? AND m.repository = ? AND mr.digest = ?
|
||||
LIMIT 1
|
||||
`, did, repository, digest).Scan(&os, &arch, &variant, &osVersion)
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
p.OS = os.String
|
||||
p.Architecture = arch.String
|
||||
p.Variant = variant.String
|
||||
p.OSVersion = osVersion.String
|
||||
p.Digest = digest
|
||||
return &p, nil
|
||||
}
|
||||
|
||||
// IsManifestReferenced checks if a manifest digest is referenced as a child of
|
||||
// any manifest list for the given user. Used to protect manifest list children
|
||||
// from auto-removal (they are untagged but still needed by their parent list).
|
||||
|
||||
@@ -333,6 +333,26 @@ func (h *ManifestDiffHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
|
||||
fromPlatformDigest := ""
|
||||
toPlatformDigest := ""
|
||||
|
||||
// platKey returns "os/arch[/variant]" for a platform.
|
||||
platKey := func(os, arch, variant string) string {
|
||||
k := os + "/" + arch
|
||||
if variant != "" {
|
||||
k += "/" + variant
|
||||
}
|
||||
return k
|
||||
}
|
||||
|
||||
// pickPlatformChild returns the child digest from a manifest list whose
|
||||
// platform matches the given key. Returns "" if no match.
|
||||
pickPlatformChild := func(m *db.ManifestWithMetadata, key string) string {
|
||||
for _, p := range m.Platforms {
|
||||
if platKey(p.OS, p.Architecture, p.Variant) == key {
|
||||
return p.Digest
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
if isMultiArch {
|
||||
// Build intersection of platforms
|
||||
for _, fp := range fromManifest.Platforms {
|
||||
@@ -348,33 +368,47 @@ func (h *ManifestDiffHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
|
||||
selectedPlatform = r.URL.Query().Get("platform")
|
||||
if len(commonPlatforms) > 0 {
|
||||
if selectedPlatform == "" {
|
||||
selectedPlatform = commonPlatforms[0].OS + "/" + commonPlatforms[0].Architecture
|
||||
if commonPlatforms[0].Variant != "" {
|
||||
selectedPlatform += "/" + commonPlatforms[0].Variant
|
||||
}
|
||||
selectedPlatform = platKey(commonPlatforms[0].OS, commonPlatforms[0].Architecture, commonPlatforms[0].Variant)
|
||||
}
|
||||
// Find matching platform digests
|
||||
for _, fp := range fromManifest.Platforms {
|
||||
platKey := fp.OS + "/" + fp.Architecture
|
||||
if fp.Variant != "" {
|
||||
platKey += "/" + fp.Variant
|
||||
}
|
||||
if platKey == selectedPlatform {
|
||||
fromPlatformDigest = fp.Digest
|
||||
break
|
||||
}
|
||||
}
|
||||
for _, tp := range toManifest.Platforms {
|
||||
platKey := tp.OS + "/" + tp.Architecture
|
||||
if tp.Variant != "" {
|
||||
platKey += "/" + tp.Variant
|
||||
}
|
||||
if platKey == selectedPlatform {
|
||||
toPlatformDigest = tp.Digest
|
||||
fromPlatformDigest = pickPlatformChild(fromManifest, selectedPlatform)
|
||||
toPlatformDigest = pickPlatformChild(toManifest, selectedPlatform)
|
||||
}
|
||||
} else if fromManifest.IsManifestList != toManifest.IsManifestList {
|
||||
// Mixed: one side is a manifest list, the other is a platform child.
|
||||
// Match them by looking up the single-arch side's platform via its
|
||||
// parent manifest_references row and picking the matching child from
|
||||
// the manifest list side.
|
||||
var listSide *db.ManifestWithMetadata
|
||||
var childDigest string
|
||||
if fromManifest.IsManifestList {
|
||||
listSide = fromManifest
|
||||
childDigest = toDigest
|
||||
} else {
|
||||
listSide = toManifest
|
||||
childDigest = fromDigest
|
||||
}
|
||||
|
||||
plat, _ := db.GetChildManifestPlatform(h.ReadOnlyDB, owner.DID, repo, childDigest)
|
||||
var listChildDigest string
|
||||
if plat != nil {
|
||||
listChildDigest = pickPlatformChild(listSide, platKey(plat.OS, plat.Architecture, plat.Variant))
|
||||
}
|
||||
// Fallback: if we couldn't determine the platform (or no match),
|
||||
// default to the first non-attestation child of the manifest list so
|
||||
// the diff at least shows real layers instead of an empty index.
|
||||
if listChildDigest == "" {
|
||||
for _, p := range listSide.Platforms {
|
||||
if p.Digest != "" {
|
||||
listChildDigest = p.Digest
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if fromManifest.IsManifestList {
|
||||
fromPlatformDigest = listChildDigest
|
||||
} else {
|
||||
toPlatformDigest = listChildDigest
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch layer/vuln data in parallel
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -293,11 +293,10 @@ function initTabController() {
|
||||
const content = document.getElementById('tag-content');
|
||||
const selector = document.getElementById('tag-selector');
|
||||
if (!content || !selector || !to) return;
|
||||
const fromDigest = content.dataset.digest;
|
||||
const currentTag = selector.value;
|
||||
if (!fromDigest || to === currentTag) return;
|
||||
if (!currentTag || to === currentTag) return;
|
||||
window.location.href = '/diff/' + content.dataset.owner + '/' + content.dataset.repo +
|
||||
'?from=' + encodeURIComponent(fromDigest) + '&to=' + encodeURIComponent(to);
|
||||
'?from=' + encodeURIComponent(currentTag) + '&to=' + encodeURIComponent(to);
|
||||
};
|
||||
|
||||
window.switchRepoTab = function(tabId) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{{ define "nav-brand" }}
|
||||
<a href="/" class="flex items-center gap-2 text-2xl font-display font-bold text-base-content no-underline tracking-tight focus-visible:outline-2 focus-visible:outline-primary focus-visible:outline-offset-2 rounded-sm">
|
||||
<svg class="nav-brand-logo h-12 w-auto" viewBox="-77.86658 0 736.12415 736.12415" width="48" height="48" aria-hidden="true" focusable="false">
|
||||
<g transform="translate(-221.72255,-136.52091)">
|
||||
<path fill="#fdfdfd" d="M 617.5495,871.8604 C 578.11386,869.03851 541.82227,858.4385 500.12778,837.56397 465.36235,820.15851 436.76514,811.07059 403.5,806.85656 c -12.84516,-1.62722 -49.07301,-1.60244 -62,0.0424 -33.91367,4.31524 -65.77468,15.2698 -95.98413,33.00161 -9.12922,5.35851 -13.94133,5.5727 -19.08341,0.84942 -5.98616,-5.4986 -6.2808,-13.15645 -0.72998,-18.97261 3.25811,-3.41385 18.13488,-11.95914 32.64892,-18.7537 20.1575,-9.43648 48.25209,-17.77664 72.6486,-21.56648 16.14087,-2.50738 56.00489,-3.09183 73.35439,-1.07546 38.90127,4.52113 66.90782,13.35774 110.65324,34.91324 32.03372,15.78457 54.63895,23.156 85.328,27.82494 17.10618,2.60249 48.21475,3.55343 64.17738,1.9618 39.21587,-3.91019 79.89818,-17.74495 111.98699,-38.0832 9.49605,-6.01871 11.46031,-6.6266 16.5169,-5.11161 7.93123,2.37625 11.12157,9.92854 7.78731,18.43441 -2.64662,6.75168 -37.55875,25.98896 -64.92934,35.77736 -37.43027,13.386 -77.3022,18.6972 -118.32537,15.76171 z M 618,805.41223 c -1.925,-0.22171 -7.775,-0.8899 -13,-1.48485 -21.24321,-2.41892 -50.05582,-9.3996 -70.2951,-17.03102 C 530.1922,785.1948 515.025,778.25587 501,771.47651 471.8442,757.38326 456.97198,751.58624 437.3313,746.65917 411.89585,740.27843 404.77,739.49571 372.5,739.538 c -22.47927,0.0295 -31.33872,0.42211 -39.40113,1.74626 -29.96332,4.92111 -60.43175,15.82046 -84.68974,30.29572 -10.43562,6.22716 -14.40931,7.02265 -20.17816,4.03946 -5.94688,-3.07525 -8.46008,-12.56844 -4.80438,-18.14775 3.66647,-5.59574 29.31775,-19.52383 51.07341,-27.73175 24.58467,-9.27525 43.08892,-13.51256 71,-16.25837 31.52697,-3.10152 63.72313,-0.73488 96.09111,7.06336 13.26193,3.19513 29.91602,8.61443 39.90889,12.98649 1.65,0.72191 5.25,2.20206 8,3.28923 2.75,1.08718 14.45,6.64838 26,12.35823 11.55,5.70985 23.25,11.12029 26,12.02321 2.75,0.90292 8.01923,2.7551 11.70941,4.11596 30.31402,11.17918 74.29895,16.77162 107.36691,13.65112 43.37883,-4.09349 80.37395,-16.50011 117.3777,-39.36357 8.46646,-5.23116 13.48207,-5.95296 18.47855,-2.65926 3.98502,2.62694 5.48994,5.68112 5.53199,11.22693 0.0474,6.25411 -2.48022,9.11099 -14.79473,16.72177 -30.30214,18.72775 -68.52877,32.58103 -105.50546,38.23503 -12.567,1.92158 -53.92342,3.40408 -63.66437,2.28216 z"/>
|
||||
<path fill="#f9d911" d="m 617.5,778.92769 c -22.78112,-2.29598 -48.20714,-7.6784 -64.29059,-13.60964 -3.69018,-1.36086 -8.95941,-3.21304 -11.70941,-4.11596 -2.75,-0.90292 -14.45,-6.31336 -26,-12.02321 -11.55,-5.70985 -23.25,-11.27105 -26,-12.35823 -2.75,-1.08717 -6.35,-2.56732 -8,-3.28923 -9.99287,-4.37206 -26.64696,-9.79136 -39.90889,-12.98649 -32.36798,-7.79824 -64.56414,-10.16488 -96.09111,-7.06336 -14.17395,1.39439 -19.56653,2.1545 -30.75,4.33436 l -4.75,0.92586 0.008,-21.6209 c 0.004,-11.89149 0.4721,-24.48375 1.03986,-27.98279 1.90217,-11.72272 9.10364,-22.18111 18.9719,-27.55209 2.80287,-1.52551 14.63265,-6.51166 26.2884,-11.08032 17.63653,-6.91292 21.32151,-8.70088 21.96242,-10.65618 0.42358,-1.29223 3.70527,-19.67451 7.29266,-40.84951 10.93432,-64.54115 36.65053,-214.58556 47.9037,-279.5 1.90689,-11 4.40006,-25.625 5.54037,-32.5 1.1403,-6.875 2.31057,-13.2875 2.6006,-14.25 0.47966,-1.59334 -0.4683,-1.75 -10.59018,-1.75 C 416.06978,251 412,248.85761 412,240.98882 c 0,-2.14014 0.93248,-4.07514 2.92308,-6.06574 L 417.84615,232 h 94.62238 94.62238 l 2.45454,2.45455 c 3.63107,3.63106 3.42121,9.73263 -0.46853,13.62237 C 606.18281,250.97104 606.03914,251 594.57692,251 583.42789,251 583,251.0788 583,253.13192 c 0,1.17255 1.38641,10.06005 3.0809,19.75 4.02848,23.03676 22.95628,133.28638 39.93618,232.61808 3.76071,22 8.66683,50.58443 10.90248,63.52095 2.23566,12.93652 5.15946,29.98903 6.49734,37.89445 1.36905,8.08956 2.98675,14.71603 3.70023,15.15699 0.69723,0.43091 11.19361,4.71484 23.32528,9.51983 12.13168,4.80499 23.63509,9.72363 25.56316,10.93031 8.44769,5.28698 15.21532,16.07918 17.02955,27.1567 0.52431,3.20142 0.9559,26.82634 0.95909,52.49981 l 0.006,46.67904 -5.26963,1.53193 c -26.98949,7.84605 -63.85821,11.29637 -91.23037,8.53768 z M 616.00462,561.75 c 0.0111,-3.02045 -11.42676,-68.33901 -12.1049,-69.12748 -0.41508,-0.48262 -8.32482,1.69447 -17.5772,4.83798 -9.25239,3.1435 -52.73341,17.81377 -96.6245,32.60059 -43.89109,14.78682 -80.22859,27.14879 -80.75,27.47104 C 408.42661,557.85438 408,559.21648 408,560.55902 V 563 h 104 c 82.53087,0 104.00095,-0.25804 104.00462,-1.25 z M 503.64748,483.89936 c 47.21888,-16.00535 87.3399,-29.53337 89.1578,-30.06227 1.8179,-0.52889 3.55299,-1.60715 3.85575,-2.39613 0.4452,-1.16018 -3.19945,-25.14729 -5.18715,-34.13899 -0.46799,-2.11701 -2.89118,-1.38503 -65.72989,19.85499 -35.88419,12.12917 -73.34399,24.763 -83.24399,28.07518 -9.9,3.31219 -18.31011,6.30244 -18.68913,6.64501 -0.37902,0.34257 -2.07159,8.72285 -3.76128,18.62285 -1.68968,9.9 -3.30065,19.0125 -3.57992,20.25 -0.27928,1.2375 -0.0953,2.25 0.40876,2.25 0.50409,0 39.55016,-13.09529 86.76905,-29.10064 z m -12.00479,-76.80553 c 32.37152,-10.9484 66.24488,-22.4234 75.27412,-25.5 9.02925,-3.07661 16.56675,-5.59383 16.75,-5.59383 0.78989,0 0.2413,-6.30318 -0.70199,-8.06574 C 581.95652,366.05023 580.11419,366 512.02383,366 c -44.20346,0 -70.12676,0.35753 -70.50679,0.97242 -0.50686,0.82012 -10.47609,57.06549 -10.50667,59.27758 -0.006,0.4125 0.39134,0.75 0.88232,0.75 0.49098,0 27.37848,-8.95778 59.75,-19.90617 z M 464.69411,214.25 c 1.35047,-3.74335 4.751,-7.53803 7.95455,-8.87656 L 476,203.97316 v -17.27648 c 0,-19.53223 1.2134,-26.23741 6.13635,-33.90916 3.94773,-6.15201 8.94216,-10.46656 15.81802,-13.66476 4.57517,-2.12807 7.03676,-2.58325 14.06666,-2.60111 7.61634,-0.0194 9.22192,0.3234 15.12258,3.22828 7.83094,3.85516 13.97677,10.13512 17.68889,18.07492 2.52613,5.4031 2.67763,6.64616 3.16041,25.93123 l 0.50709,20.25609 3.48007,1.74391 C 555.13579,207.33747 560,213.03373 560,215.14788 560,215.61655 538.41412,216 512.03138,216 c -45.25823,0 -47.93294,-0.0989 -47.33727,-1.75 z"/>
|
||||
</g>
|
||||
</svg>
|
||||
<span class="min-w-0 max-w-56 truncate sm:max-w-none">{{ .ClientName }}</span>
|
||||
</a>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user