fix: buildx multiarch image date and history not shown (#309)

Support images created with buildx and `--provenance true`

fixes #309
This commit is contained in:
Joxit 2023-05-20 02:04:22 +02:00
parent d2222bef05
commit 9ebbbc3518
No known key found for this signature in database
GPG key ID: F526592B8E012263
5 changed files with 1305 additions and 4 deletions

45
test/docker-image.test.js Normal file
View file

@ -0,0 +1,45 @@
import { supportListManifest, filterWrongManifests } from '../src/scripts/docker-image.js';
import { dockerManifestList } from './fixtures/docker-manifest-list.js';
import { ociImageIndexLayer } from './fixtures/oci-image-index-layer.js';
import { ociImageIndexManifest } from './fixtures/oci-image-index-manifest.js';
import assert from 'assert';
describe('docker-image', () => {
describe('supportListManifest', () => {
/**
* Manifest of an image created with:
* docker buildx build --platform amd64,arm -t joxit/docker-registry-ui:buildx --push --provenance false .
*/
it('should support mediaType `application/vnd.docker.distribution.manifest.list.v2+json`', () => {
assert.ok(supportListManifest(dockerManifestList['application/vnd.docker.distribution.manifest.list.v2+json']));
});
/**
* Index of an image created with:
* docker buildx build --platform amd64,arm -t joxit/docker-registry-ui:buildx --push --provenance true .
*/
it('should support mediaType `application/vnd.oci.image.index.v1+json`', () => {
assert.ok(supportListManifest(ociImageIndexManifest['application/vnd.oci.image.index.v1+json']));
});
/**
* Index of an image created with:
* buildctl build --frontend=dockerfile.v0 --local context=. --local dockerfile=. --export-cache type=registry,ref=joxit/docker-registry-ui:buildkit
*/
it('should not support mediaType `application/vnd.oci.image.index.v1+json` with layers (`application/vnd.oci.image.layer.v1.tar+gzip`)', () => {
assert.ok(!supportListManifest(ociImageIndexLayer['application/vnd.oci.image.index.v1+json']));
});
});
describe('supportListManifest', () => {
it('should return all manifests for `application/vnd.docker.distribution.manifest.list.v2+json`', () => {
assert.equal(
filterWrongManifests(dockerManifestList['application/vnd.docker.distribution.manifest.list.v2+json']).length,
2
);
});
it('should return all manifests for `application/vnd.oci.image.index.v1+json`', () => {
assert.equal(
filterWrongManifests(ociImageIndexManifest['application/vnd.oci.image.index.v1+json']).length,
2
);
});
});
});