mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-13 12:17:34 +00:00
feat: add node-scoped opt-out for image update detection (#1715)
* feat: add node-scoped opt-out for image update detection Operators who use an external update authority can disable Sencho registry polling per node without losing explicit stack Update, pull, or redeploy. * test: fix mocks and lint for image-update checks opt-out Scheduler tests need isChecksEnabled on the ImageUpdateService mock, and the UpdatesSection older-node fixture must not leave an unused binding. * fix: gate update-preview and recheck when detection is off Anatomy was still calling stack update-preview (and contacting registries) while checks were disabled. Short-circuit those routes and skip recheckStack writes so disabled nodes stay quiet until detection is re-enabled.
This commit is contained in:
@@ -3,7 +3,8 @@ import DockerController from './DockerController';
|
||||
import { DatabaseService } from './DatabaseService';
|
||||
import { FileSystemService } from './FileSystemService';
|
||||
import { ComposeDoctorService } from './ComposeDoctorService';
|
||||
import { UpdatePreviewService, isMovingTag, filterPreviewForService } from './UpdatePreviewService';
|
||||
import { UpdatePreviewService, isMovingTag, filterPreviewForService, buildDetectionDisabledPreview } from './UpdatePreviewService';
|
||||
import { ImageUpdateService } from './ImageUpdateService';
|
||||
import { buildEffectiveServiceModel, type EffectiveServiceModelResult } from './effectiveServiceModel';
|
||||
import { filterContainersByComposeService } from '../helpers/composeServiceMatch';
|
||||
import { withTimeout } from '../utils/withTimeout';
|
||||
@@ -137,6 +138,12 @@ export class UpdateGuardService {
|
||||
withTimeout(this.probeContainers(nodeId, stackName), INPUT_TIMEOUT_MS, 'readiness sibling probe'))
|
||||
: Promise.resolve<ContainerProbe[] | Errored>([]),
|
||||
this.collect('update preview', stackName, async () => {
|
||||
// Check inside the thunk so the read stays with the getPreview call.
|
||||
// Stack GET/POST update-preview use the same isChecksEnabled gate.
|
||||
if (!ImageUpdateService.isChecksEnabled()) {
|
||||
const disabled = buildDetectionDisabledPreview(stackName);
|
||||
return serviceName ? filterPreviewForService(disabled, serviceName) : disabled;
|
||||
}
|
||||
const full = await withTimeout(UpdatePreviewService.getInstance().getPreview(nodeId, stackName), INPUT_TIMEOUT_MS, 'readiness update preview');
|
||||
return serviceName ? filterPreviewForService(full, serviceName) : full;
|
||||
}),
|
||||
@@ -218,8 +225,12 @@ export class UpdateGuardService {
|
||||
this.collect('backup info', stackName, () => fsSvc.getBackupInfo(stackName)),
|
||||
this.collect('backup env summary', stackName, () => fsSvc.getBackupEnvSummary(stackName)),
|
||||
this.collect('stack env presence', stackName, () => fsSvc.envExists(stackName)),
|
||||
this.collect('update preview', stackName, () =>
|
||||
withTimeout(UpdatePreviewService.getInstance().getPreview(nodeId, stackName), INPUT_TIMEOUT_MS, 'rollback readiness update preview')),
|
||||
this.collect('update preview', stackName, async () => {
|
||||
if (!ImageUpdateService.isChecksEnabled()) {
|
||||
return buildDetectionDisabledPreview(stackName);
|
||||
}
|
||||
return withTimeout(UpdatePreviewService.getInstance().getPreview(nodeId, stackName), INPUT_TIMEOUT_MS, 'rollback readiness update preview');
|
||||
}),
|
||||
this.collect('activity history', stackName, async () => {
|
||||
const events = db.getStackActivity(nodeId, stackName, { limit: 50 });
|
||||
// A successful update is as good a known-good marker as a deploy.
|
||||
|
||||
Reference in New Issue
Block a user