feat: add CI deployment and live progress

This commit is contained in:
2026-09-05 12:09:16 +00:00 Unverified
parent 321f4e807a
commit aa02826dbb
27 changed files with 2711 additions and 180 deletions
+45 -2
View File
@@ -14,7 +14,10 @@ import {
KubernetesWorkspacePersistence,
type LeaseObjects,
} from "../../server/kubernetes-state";
import type { Operation } from "../../server/operation-store";
import {
PersistentOperationStore,
type Operation,
} from "../../server/operation-store";
import type {
Workspace,
WorkspaceRevision,
@@ -183,6 +186,42 @@ describe("Kubernetes state persistence", () => {
);
});
test("keeps operation progress in the Kubernetes-backed operation record", async () => {
const fake = new FakeObjects();
const store = new PersistentOperationStore(
new KubernetesOperationPersistence(
fake as unknown as KubernetesObjectApi,
),
() => new Date(timestamp),
() => "event-id",
);
const created = await store.create({
workspaceId: "demo",
action: "resources.apply",
idempotencyKey: "events",
});
await store.emit(created.metadata.name, {
resource: { apiVersion: "v1", kind: "ConfigMap", name: "settings" },
phase: "apply",
state: "succeeded",
});
const reloaded = new PersistentOperationStore(
new KubernetesOperationPersistence(
fake as unknown as KubernetesObjectApi,
),
);
expect(await reloaded.events(created.metadata.name)).toMatchObject({
items: [
expect.objectContaining({
sequence: 1,
data: expect.objectContaining({ phase: "apply" }),
}),
],
retainedFirstSequence: 1,
cursorGap: false,
});
});
test("recovers replacement from a matching precreated revision", async () => {
const fake = new FakeObjects();
const persistence = new KubernetesWorkspacePersistence(
@@ -365,7 +404,11 @@ class FakeLeaseStore implements LeaseObjects {
return structuredClone(stored);
}
async delete(name: string, namespace: string, expectedResourceVersion?: string) {
async delete(
name: string,
namespace: string,
expectedResourceVersion?: string,
) {
this.beforeDelete?.();
this.beforeDelete = undefined;
const key = this.key(name, namespace);