import { type Result } from "@fjall/generator"; import type { ContainerDefinition, Tag, TaskDefinition } from "@aws-sdk/client-ecs"; import type { DeployCallbacks } from "../../types/callbacks.js"; import type { DeployServices } from "../serviceFactory.js"; /** The live revision's tags a new revision of it carries. */ export declare function revisionCarriedTags(tags: readonly Tag[]): Tag[]; export interface RollTaskDefinitionInput { clusterArn: string; serviceArn: string; serviceName: string; /** The resolved live task definition the new revision is copied from. */ taskDefinition: TaskDefinition; /** Container definitions for the new revision (image-rewritten or unchanged). */ containerDefinitions: ContainerDefinition[]; /** The live revision's tags the new revision keeps (`revisionCarriedTags`). */ carriedTags: readonly Tag[]; previousTaskDefArn: string; /** Forwarded to the onTaskDefRegistered event when the roll is digest-pinned. */ imageDigest?: string; /** Epoch ms the per-service operation started — keeps event durations inclusive of resolution time. */ startedAtMs: number; } export interface RollTaskDefinitionOk { newTaskDefArn: string; durationMs: number; } export interface RollServiceInput { clusterArn: string; serviceArn: string; serviceName: string; /** The revision the service is pointed at, as given: nothing is registered. */ taskDefinitionArn: string; /** Epoch ms the per-service operation started — keeps event durations inclusive of resolution time. */ startedAtMs: number; } /** * What became of the ECS deployment a roll's update starts: `update-failed` * when UpdateService failed (ECS refused it, or a cancel cut the call short, * and then ECS may still have accepted it), `ended` when ECS's own verdict * read the deployment as ended, and `unended` when it did not (the verdict * could not be read, a cancel cut its wait short, or the service's primary * deployment decided in its place), so ECS may still be rolling it out. */ export type RollDeployment = "update-failed" | "ended" | "unended"; export interface RollServiceOk { durationMs: number; deployment: Exclude; } /** A roll that failed: why, and what became of the deployment its update starts. */ export interface RollServiceFailure { readonly message: string; readonly deployment: RollDeployment; } /** * Register a new task-definition revision copied from a resolved live one, * then roll the service onto it ({@link rollServiceToTaskDefinition}). * * Shared tail of the code-only/rollback rollout AND the restart operation — * the RegisterTaskDefinition field-copy list below is a coupled value: a * task-definition field omitted here is silently dropped from the new * revision on BOTH paths, so it must have exactly one home. * * Messages are pre-masked at construction: a missing family names the * service alone, a refused registration wraps the message * `EcsService.registerTaskDefinition` masks where it is built, in * `deploy-core/src/services/infrastructure/EcsService.ts`, by * `const maskedMessage = maskSensitiveOutput(getErrorMessage(error));` (its * only other arm is a static literal), and every later failure is * {@link rollServiceToTaskDefinition}'s, pre-masked as it says. */ export declare function registerAndRollTaskDefinition(services: Pick, input: RollTaskDefinitionInput, callbacks: DeployCallbacks, abortSignal?: AbortSignal): Promise>; /** * Point a service at a revision that already exists, wait on the ECS * deployment that update starts, and judge the deployment as ECS does * (`judgeRollout`): the wait alone reads a completed rollback as success. * * A wait that ends in failure (a failed task, a FAILED rollout state, a read * it could not make, or its own time limit) is not a verdict either, since * ECS can still complete that deployment or roll it back. ECS's verdict * decides, read for what is left of the wait's budget and at least * `ROLLOUT_VERDICT_SETTLE_MS`. When it cannot be read the rollout fails: a * deployment that crash-loops without a circuit breaker keeps PRIMARY on the * new revision, so PRIMARY proves nothing there. Its result, failed or not, * says what became of the deployment the update starts (`RollDeployment`). * * Messages are pre-masked at construction: every rollout failure is built in * this file by `rolloutFailed`, which passes the whole reason through * `const maskedReason = maskSensitiveOutput(message);`, and a refused update * wraps the message `EcsService.updateService` masks where it is built, in * `deploy-core/src/services/infrastructure/EcsService.ts`, by * `const errorMessage = maskSensitiveOutput(rawErrorMessage);`, beside which * it adds only the HTTP status and the SDK error's name. */ export declare function rollServiceToTaskDefinition(services: Pick, input: RollServiceInput, callbacks: DeployCallbacks, abortSignal?: AbortSignal): Promise>; export declare function extractRevision(taskDefArn: string): number;