@blaxel/core 0.3.26-preview.315 → 0.3.27-preview.317
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/common/settings.js +2 -2
- package/dist/cjs/image/image.js +42 -18
- package/dist/cjs/image/image.test.js +30 -5
- package/dist/cjs/types/image/image.d.ts +5 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/image/image.test.js +30 -5
- package/dist/cjs-browser/types/image/image.d.ts +5 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/image/image.js +42 -18
- package/dist/esm/image/image.test.js +30 -5
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/image/image.test.js +30 -5
- package/package.json +1 -1
|
@@ -24,8 +24,8 @@ function missingCredentialsMessage() {
|
|
|
24
24
|
return "No Blaxel credentials found. Set the BL_API_KEY and BL_WORKSPACE environment variables, or run `bl login`.";
|
|
25
25
|
}
|
|
26
26
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
27
|
-
const BUILD_VERSION = "0.3.
|
|
28
|
-
const BUILD_COMMIT = "
|
|
27
|
+
const BUILD_VERSION = "0.3.27-preview.317";
|
|
28
|
+
const BUILD_COMMIT = "b818d0f5560b92040baeb620b8d89bf148cba56d";
|
|
29
29
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
30
30
|
const BLAXEL_API_VERSION = "2026-09-22";
|
|
31
31
|
// Bun < 1.3.11 never sends connection-level WINDOW_UPDATE: the pooled h2
|
|
@@ -543,8 +543,12 @@ describe("Dockerfile instruction order", () => {
|
|
|
543
543
|
});
|
|
544
544
|
});
|
|
545
545
|
describe("ImageInstance.build worker resources", () => {
|
|
546
|
-
|
|
547
|
-
|
|
546
|
+
// signing: "all" signs every build label, "update" signs only on PUT after a
|
|
547
|
+
// 404 then POST create (production today), "none" never signs them.
|
|
548
|
+
let calls = [];
|
|
549
|
+
async function buildWith(options, storedLabels, signing = "all") {
|
|
550
|
+
calls = [];
|
|
551
|
+
let created = false;
|
|
548
552
|
vi.spyOn(settings, "authenticate").mockResolvedValue(undefined);
|
|
549
553
|
vi.spyOn(settings, "headers", "get").mockReturnValue({});
|
|
550
554
|
vi.spyOn(settings, "baseUrl", "get").mockReturnValue("https://api.test");
|
|
@@ -553,10 +557,18 @@ describe("ImageInstance.build worker resources", () => {
|
|
|
553
557
|
const body = typeof init.body === "string" ? JSON.parse(init.body) : undefined;
|
|
554
558
|
calls.push({ url, method: init.method ?? "GET", headers, body });
|
|
555
559
|
if (url.includes("upload=true")) {
|
|
556
|
-
|
|
557
|
-
|
|
560
|
+
if (signing === "update" && init.method === "PUT" && !created) {
|
|
561
|
+
return Promise.resolve(new Response("{}", { status: 404 }));
|
|
562
|
+
}
|
|
563
|
+
created ||= init.method === "POST";
|
|
564
|
+
const labels = storedLabels ?? body.metadata?.labels ?? {};
|
|
565
|
+
const signed = ["host"];
|
|
566
|
+
if (signing === "all" || (signing === "update" && init.method === "PUT")) {
|
|
567
|
+
signed.push(...Object.keys(labels).filter((k) => k.startsWith("x-blaxel-build")).map((k) => `x-amz-meta-${k}`));
|
|
568
|
+
}
|
|
569
|
+
return Promise.resolve(new Response(JSON.stringify({ metadata: { name: "img", labels } }), {
|
|
558
570
|
status: 200,
|
|
559
|
-
headers: { "x-blaxel-upload-url":
|
|
571
|
+
headers: { "x-blaxel-upload-url": `https://upload.test/object?X-Amz-SignedHeaders=${signed.join(";")}` },
|
|
560
572
|
}));
|
|
561
573
|
}
|
|
562
574
|
if (url.startsWith("https://upload.test")) {
|
|
@@ -589,6 +601,19 @@ describe("ImageInstance.build worker resources", () => {
|
|
|
589
601
|
expect(upload.headers["x-amz-meta-x-blaxel-build-volume"]).toBe("32768");
|
|
590
602
|
expect(upload.headers["x-amz-meta-x-blaxel-auto-generated"]).toBeUndefined();
|
|
591
603
|
});
|
|
604
|
+
it("asks again when creating a sandbox does not sign the settings", async () => {
|
|
605
|
+
const { upload } = await buildWith({ buildMemoryMb: 2048 }, undefined, "update");
|
|
606
|
+
expect(calls.filter((call) => call.url.includes("upload=true")).map((call) => call.method)).toEqual(["PUT", "POST", "PUT"]);
|
|
607
|
+
expect(upload.headers["x-amz-meta-x-blaxel-build-memory"]).toBe("2048");
|
|
608
|
+
});
|
|
609
|
+
it("fails clearly when the settings are never signed", async () => {
|
|
610
|
+
await expect(buildWith({ buildVolumeMb: 32768 }, undefined, "none")).rejects.toThrow("x-blaxel-build-volume");
|
|
611
|
+
expect(calls.some((call) => call.url.startsWith("https://upload.test"))).toBe(false);
|
|
612
|
+
});
|
|
613
|
+
it("drops stored labels the upload URL was not signed for", async () => {
|
|
614
|
+
const { upload } = await buildWith({}, { "x-blaxel-auto-generated": "true", "x-blaxel-build-memory": "8192" }, "none");
|
|
615
|
+
expect(upload.headers["x-amz-meta-x-blaxel-build-memory"]).toBeUndefined();
|
|
616
|
+
});
|
|
592
617
|
it("keeps an explicit zero volume", async () => {
|
|
593
618
|
const { upload } = await buildWith({ buildVolumeMb: 0 });
|
|
594
619
|
expect(upload.headers["x-amz-meta-x-blaxel-build-volume"]).toBe("0");
|