mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-25 09:46:47 +00:00
feat: add build-aware compose stack updates (#1561)
Detect services with build: in the update preview and run compose build --pull plus pull --ignore-buildable when Update is triggered on those stacks, while keeping the existing pull-only path for image-only stacks.
This commit is contained in:
@@ -128,11 +128,40 @@ export function updatePreviewSignal(input: UpdatePreviewSummary | Errored): Read
|
||||
}
|
||||
if (input.has_update) {
|
||||
const kind = input.update_kind === 'digest' ? 'a same-tag image refresh' : `a ${input.semver_bump} update`;
|
||||
return { ...base, status: 'ok', affectsVerdict: true, detail: `Pending: ${kind}.` };
|
||||
const buildNote = input.has_build_services
|
||||
? ' Local build services will also be rebuilt from source.'
|
||||
: '';
|
||||
return { ...base, status: 'ok', affectsVerdict: true, detail: `Pending: ${kind}.${buildNote}` };
|
||||
}
|
||||
if (input.rebuild_available) {
|
||||
const n = input.has_build_services ? 'Local build service(s)' : 'Build';
|
||||
return {
|
||||
...base,
|
||||
status: 'warning',
|
||||
affectsVerdict: true,
|
||||
detail: `${n} require a rebuild from source; the update rebuilds images and recreates containers.`,
|
||||
};
|
||||
}
|
||||
return { ...base, status: 'ok', affectsVerdict: true, detail: 'No pending image update detected; the update re-pulls and recreates with current tags.' };
|
||||
}
|
||||
|
||||
export function buildServicesSignal(buildServices: string[] | Errored): ReadinessSignal {
|
||||
const base = { id: 'build_services' as const, title: 'Local build services', affectsVerdict: false };
|
||||
if (buildServices === 'error') {
|
||||
return { ...base, status: 'unknown', detail: 'Build services could not be detected from the compose model.' };
|
||||
}
|
||||
if (buildServices.length === 0) {
|
||||
return { ...base, status: 'ok', detail: 'No services declare a local build; the update pulls registry images only.' };
|
||||
}
|
||||
const plural = buildServices.length === 1 ? 'service' : 'services';
|
||||
const names = buildServices.join(', ');
|
||||
return {
|
||||
...base,
|
||||
status: 'warning',
|
||||
detail: `${buildServices.length} ${plural} (${names}) rebuild from source. This may take longer and depends on the local Dockerfile context, network access, and base-image availability.`,
|
||||
};
|
||||
}
|
||||
|
||||
export function backupSlotSignal(
|
||||
input: { exists: boolean; timestamp: number | null } | Errored,
|
||||
now: number,
|
||||
|
||||
@@ -6,7 +6,7 @@ export type SignalStatus = 'ok' | 'warning' | 'attention' | 'blocked' | 'unknown
|
||||
|
||||
/** One input to the readiness verdict (preflight, drift, containers, ...). */
|
||||
export interface ReadinessSignal {
|
||||
id: 'preflight' | 'drift' | 'containers' | 'healthchecks' | 'update_preview' | 'backup_slot' | 'disk';
|
||||
id: 'preflight' | 'drift' | 'containers' | 'healthchecks' | 'update_preview' | 'build_services' | 'backup_slot' | 'disk';
|
||||
status: SignalStatus;
|
||||
/** Short headline ("Compose Doctor", "Running containers"). */
|
||||
title: string;
|
||||
|
||||
Reference in New Issue
Block a user