feat: release 2.5.1
This commit is contained in:
+40
-27
@@ -796,33 +796,46 @@ export function createManagementService(dependencies: ManagementDependencies) {
|
||||
execution?: OperationExecution,
|
||||
): Promise<void> {
|
||||
const selected = await targets(workspace, deploymentTargets);
|
||||
for (const name of selected) {
|
||||
const event = {
|
||||
resource: {
|
||||
apiVersion: "apps/v1",
|
||||
kind: "Deployment",
|
||||
name,
|
||||
namespace: workspace.project,
|
||||
},
|
||||
phase: "wait" as const,
|
||||
};
|
||||
try {
|
||||
throwIfExecutionAborted(execution);
|
||||
await execution?.emit?.({ ...event, state: "started" });
|
||||
await dependencies.waitForDeployment(
|
||||
workspace.project,
|
||||
name,
|
||||
timeoutMs,
|
||||
execution,
|
||||
);
|
||||
await execution?.emit?.({ ...event, state: "succeeded" });
|
||||
} catch (error) {
|
||||
await execution?.emit?.({
|
||||
...event,
|
||||
state: execution?.signal?.aborted ? "aborted" : "failed",
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
const deadline = Date.now() + (timeoutMs ?? 300_000);
|
||||
const controller = new AbortController();
|
||||
const cancel = () => controller.abort();
|
||||
execution?.signal?.addEventListener("abort", cancel, { once: true });
|
||||
if (execution?.signal?.aborted) cancel();
|
||||
try {
|
||||
await Promise.all(
|
||||
selected.map(async (name) => {
|
||||
const event = {
|
||||
resource: {
|
||||
apiVersion: "apps/v1",
|
||||
kind: "Deployment",
|
||||
name,
|
||||
namespace: workspace.project,
|
||||
},
|
||||
phase: "wait" as const,
|
||||
};
|
||||
try {
|
||||
throwIfExecutionAborted({ signal: controller.signal });
|
||||
await execution?.emit?.({ ...event, state: "started" });
|
||||
await dependencies.waitForDeployment(
|
||||
workspace.project,
|
||||
name,
|
||||
Math.max(0, deadline - Date.now()),
|
||||
{ ...execution, signal: controller.signal },
|
||||
);
|
||||
await execution?.emit?.({ ...event, state: "succeeded" });
|
||||
} catch (error) {
|
||||
await execution?.emit?.({
|
||||
...event,
|
||||
state: controller.signal.aborted ? "aborted" : "failed",
|
||||
});
|
||||
controller.abort();
|
||||
throw error;
|
||||
}
|
||||
}),
|
||||
);
|
||||
} finally {
|
||||
controller.abort();
|
||||
execution?.signal?.removeEventListener("abort", cancel);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user