Release 2.6.2-rc1
This commit is contained in:
+24
-5
@@ -346,6 +346,7 @@ async function uploadBlob(
|
||||
request: ApiRequester,
|
||||
scheduler: TaskScheduler,
|
||||
project?: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<void> {
|
||||
const uploadPath = `/blobs/${encodeURIComponent(digest)}/uploads`;
|
||||
const projectQuery = project ? `?project=${encodeURIComponent(project)}` : "";
|
||||
@@ -354,6 +355,7 @@ async function uploadBlob(
|
||||
request<{ offset: number; complete: boolean }>(path, {
|
||||
method: "POST",
|
||||
json: { size: data.byteLength },
|
||||
signal,
|
||||
}),
|
||||
);
|
||||
let offset = progress.offset;
|
||||
@@ -362,6 +364,7 @@ async function uploadBlob(
|
||||
const uploaded = await scheduler.run(() =>
|
||||
request<{ offset: number }>(path, {
|
||||
method: "PATCH",
|
||||
signal,
|
||||
headers: {
|
||||
"content-type": "application/octet-stream",
|
||||
"upload-offset": String(offset),
|
||||
@@ -378,6 +381,7 @@ async function uploadBlob(
|
||||
request(`${uploadPath}/complete${projectQuery}`, {
|
||||
method: "POST",
|
||||
json: {},
|
||||
signal,
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -389,17 +393,24 @@ export async function uploadWorkspaceSnapshot(
|
||||
reporter?: BuildReporter,
|
||||
scheduler?: TaskScheduler,
|
||||
project?: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<void> {
|
||||
const blobs = new Map(snapshot.blobs.map((blob) => [blob.digest, blob.data]));
|
||||
blobs.set(snapshot.digest, serializeWorkspaceManifest(snapshot.manifest));
|
||||
const requestScheduler = scheduler ?? new TaskScheduler();
|
||||
|
||||
for (;;) {
|
||||
signal?.throwIfAborted();
|
||||
const negotiation = await requestScheduler.run(() =>
|
||||
request<SnapshotNegotiation>("/snapshots/negotiate", {
|
||||
method: "POST",
|
||||
json: { workspace: snapshot.digest, ...(project && { project }) },
|
||||
}),
|
||||
request<SnapshotNegotiation>(
|
||||
"/snapshots/negotiate",
|
||||
{
|
||||
method: "POST",
|
||||
json: { workspace: snapshot.digest, ...(project && { project }) },
|
||||
signal,
|
||||
},
|
||||
{ timeoutMs: 300_000 },
|
||||
),
|
||||
);
|
||||
if (negotiation.ready) return;
|
||||
if (negotiation.missing.length === 0)
|
||||
@@ -414,7 +425,14 @@ export async function uploadWorkspaceSnapshot(
|
||||
if (!data)
|
||||
throw new Error(`Server requested unknown workspace blob ${digest}`);
|
||||
await reporter?.progress?.(`Uploading ${digest}`);
|
||||
await uploadBlob(digest, data, request, requestScheduler, project);
|
||||
await uploadBlob(
|
||||
digest,
|
||||
data,
|
||||
request,
|
||||
requestScheduler,
|
||||
project,
|
||||
signal,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -712,6 +730,7 @@ export async function buildServices(
|
||||
reporter,
|
||||
options.scheduler,
|
||||
project,
|
||||
options.signal,
|
||||
);
|
||||
|
||||
const references: string[] = new Array(plans.length);
|
||||
|
||||
+1
-2
@@ -100,8 +100,7 @@ export const processLogger: ProcessLogger = {
|
||||
log(entry) {
|
||||
try {
|
||||
const line = requestLine(entry);
|
||||
if (line === "") return;
|
||||
console.log(line ?? `KUBER_REQUEST ${JSON.stringify(logValue(entry))}`);
|
||||
if (line) console.log(line);
|
||||
} catch {
|
||||
// Process logging must never change request behavior.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user