import * as plugins from '../plugins.js'; import type { IRuntimeImageEvidence } from './immutableimage.js'; /** * a deployment happens when a service is deployed * tracks the status of a deployment */ export interface IDeployment { id: string; /** Docker Swarm task ID when this deployment represents a live runtime task. */ taskId?: string; /** Human-readable service name, useful for live runtime views. */ serviceName?: string; /** * The service being deployed (single service per deployment) */ serviceId: string; /** * The node this deployment is running on */ nodeId: string; /** Human-readable node hostname when known. */ nodeName?: string; /** * Docker container ID for this deployment */ containerId?: string; /** Docker service ID when known. */ dockerServiceId?: string; /** Docker Swarm task slot when known. */ slot?: number; /** Docker desired state for this task/deployment. */ desiredState?: string; /** Immutable rollout generation represented by this task, when applicable. */ rolloutId?: string; rolloutGeneration?: number; /** Evidence derived from Docker runtime state rather than service intent metadata. */ runtimeImageEvidence?: IRuntimeImageEvidence; /** * Image used for this deployment */ usedImageId: string; /** * Version of the service deployed */ version: string; /** * Timestamp when deployed */ deployedAt: number; /** Last runtime update timestamp, if reported by the orchestrator. */ updatedAt?: number; /** * Deployment log entries */ deploymentLog: string[]; /** * Current status of the deployment */ status: 'scheduled' | 'starting' | 'running' | 'stopping' | 'stopped' | 'failed'; /** * Health status of the deployment */ healthStatus?: 'healthy' | 'unhealthy' | 'unknown'; /** * Resource usage for this deployment */ resourceUsage?: { /** * Percent of the whole node's CPU capacity (0-100), NOT per-core: * a deployment saturating one core of an 8-core node reports 12.5. * Matches the scale of node-level metrics (IClusterNodeMetrics, * INodeMetricsSample), not the docker stats CLI convention. */ cpuUsagePercent: number; memoryUsedMB: number; lastUpdated: number; }; /** * Set when the deployment disappeared from runtime snapshots. Archived * deployments are kept for lookup and log retention (default 90 days) * and are excluded from active runtime views. */ archivedAt?: number; }