Skip to content

Commit 877d015

Browse files
authored
feat: add support for single arch with attestation (#674)
Add seamless support for single arch OCI archives that contain an attestation manifest
1 parent 7dcb62f commit 877d015

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

lib/extractor/oci-archive/layer.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,14 @@ function getLayersContentAndArchiveManifest(
133133
manifest: OciArchiveManifest;
134134
imageConfig: ImageConfig;
135135
} {
136+
const filteredConfigs = configs.filter((config) => {
137+
return config?.os !== "unknown" || config?.architecture !== "unknown";
138+
});
136139
const platform =
137140
options?.platform ||
138-
(configs.length === 1 ? getPlatformFromConfig(configs[0]) : "linux/amd64");
141+
(filteredConfigs.length === 1
142+
? getPlatformFromConfig(filteredConfigs[0])
143+
: "linux/amd64");
139144
const platformInfo = getOciPlatformInfoFromOptionString(platform as string);
140145

141146
// get manifest file first
Binary file not shown.

test/lib/extractor/extractor.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ describe("extractImageContent", () => {
154154
extractImageContent(type, fixture, [], { platform: "linux/arm/v4" }),
155155
).rejects.toThrow();
156156
});
157+
158+
it("succeeds for single platform image containing an attestation manifest", async () => {
159+
const fixture = getFixture(
160+
"containerd-archives/busybox-single-arch-with-attestation-manifest.tar",
161+
);
162+
await expect(
163+
extractImageContent(type, fixture, [], {}),
164+
).resolves.not.toThrow();
165+
});
157166
});
158167
});
159168
});

0 commit comments

Comments
 (0)