Fix image update checks against registries on Bare.
Release rolling / release (push) Has been cancelled

Registry HTTP now sets host/hostname, disables keep-alive, and times out cleanly; resolve container image tags/digests more reliably and surface check errors in the UI.
This commit is contained in:
Raven Scott
2026-07-15 15:31:46 -04:00
parent e9e78f52c9
commit 42f066fa47
3 changed files with 355 additions and 104 deletions
+24 -1
View File
@@ -1,5 +1,10 @@
import test from 'brittle'
import { parseImageRef } from '../server/services/image-updates.js'
import {
parseImageRef,
normalizeDigest,
digestsFromInspect,
preferredRepoTag,
} from '../server/services/image-updates.js'
test('parseImageRef handles Docker Hub short names', (t) => {
const r = parseImageRef('nginx:alpine')
@@ -38,6 +43,7 @@ test('parseImageRef digests and bare ids', (t) => {
t.is(parseImageRef('sha256:deadbeef'), null)
t.is(parseImageRef('a1b2c3d4e5f6'), null)
t.is(parseImageRef(''), null)
t.is(parseImageRef('<none>:<none>'), null)
})
test('parseImageRef defaults tag to latest', (t) => {
@@ -45,3 +51,20 @@ test('parseImageRef defaults tag to latest', (t) => {
t.is(r.tag, 'latest')
t.is(r.repository, 'library/postgres')
})
test('normalizeDigest and digestsFromInspect', (t) => {
t.is(normalizeDigest('sha256:abc'), 'sha256:abc')
t.is(normalizeDigest('abc'), 'sha256:abc')
t.is(normalizeDigest(''), null)
const digests = digestsFromInspect({
RepoDigests: [
'nginx@sha256:1111111111111111111111111111111111111111111111111111111111111111',
'docker.io/library/nginx@sha256:2222222222222222222222222222222222222222222222222222222222222222',
],
})
t.is(digests.length, 2)
t.ok(digests[0].startsWith('sha256:'))
t.is(preferredRepoTag({ RepoTags: ['<none>:<none>', 'nginx:alpine'] }), 'nginx:alpine')
t.is(preferredRepoTag({ RepoTags: [] }), null)
})