fix: gate sentinel publish on health endpoint
This commit is contained in:
@@ -198,6 +198,28 @@ export function runSentinelValidate(state: SentinelCicdState, options: Extract<W
|
||||
return rendered(ok, command, renderValidateResult(result));
|
||||
}
|
||||
|
||||
export function probeSentinelRuntimeHealthEndpoint(state: SentinelCicdState, timeoutSeconds: number): Record<string, unknown> {
|
||||
const endpoint = stringAt(state.runtime, "healthPath");
|
||||
const serviceProbeTimeoutSeconds = Math.min(timeoutSeconds, 20);
|
||||
const health = callSentinelService(state, "GET", endpoint, null, serviceProbeTimeoutSeconds);
|
||||
const publicHealth = health.ok ? null : probePublicSentinelService(state, endpoint, serviceProbeTimeoutSeconds);
|
||||
const effectiveHealth = health.ok ? health : record(publicHealth).ok === true ? record(publicHealth) : health;
|
||||
const bodyJson = record(effectiveHealth.bodyJson);
|
||||
const ok = effectiveHealth.ok === true && bodyJson.ok === true;
|
||||
return {
|
||||
ok,
|
||||
endpoint,
|
||||
health: effectiveHealth,
|
||||
internalHealth: health,
|
||||
publicHealth,
|
||||
httpStatus: effectiveHealth.httpStatus ?? null,
|
||||
publicUrl: effectiveHealth.publicUrl ?? null,
|
||||
internalUrl: effectiveHealth.internalUrl ?? null,
|
||||
degradedReason: ok ? null : "sentinel-runtime-health-endpoint-failed",
|
||||
valuesRedacted: true,
|
||||
};
|
||||
}
|
||||
|
||||
export function runSentinelReport(state: SentinelCicdState, options: Extract<WebProbeSentinelOptions, { kind: "report" }>): RenderedCliResult {
|
||||
const command = `web-probe sentinel report ${options.latest ? "--latest " : ""}--view ${options.view}`;
|
||||
const query = new URLSearchParams({ view: options.view });
|
||||
|
||||
Reference in New Issue
Block a user