Merge pull request #959 from pikasTech/chore/935-p6-after-954
fix: warn on slow sentinel confirm operations
This commit is contained in:
@@ -517,6 +517,7 @@ function probeImageRegistry(state: SentinelCicdState, timeoutSeconds: number): R
|
|||||||
}
|
}
|
||||||
|
|
||||||
function runSentinelImageBuildConfirmed(state: SentinelCicdState, options: Extract<WebProbeSentinelOptions, { kind: "image" }>): RenderedCliResult {
|
function runSentinelImageBuildConfirmed(state: SentinelCicdState, options: Extract<WebProbeSentinelOptions, { kind: "image" }>): RenderedCliResult {
|
||||||
|
const startedAt = Date.now();
|
||||||
const command = "web-probe sentinel image build";
|
const command = "web-probe sentinel image build";
|
||||||
const sourceMirrorSync = runSentinelSourceMirrorSyncJob(state, options.timeoutSeconds);
|
const sourceMirrorSync = runSentinelSourceMirrorSyncJob(state, options.timeoutSeconds);
|
||||||
const publish = sourceMirrorSync.ok === true
|
const publish = sourceMirrorSync.ok === true
|
||||||
@@ -525,6 +526,7 @@ function runSentinelImageBuildConfirmed(state: SentinelCicdState, options: Extra
|
|||||||
const registry = probeImageRegistry(state, options.timeoutSeconds);
|
const registry = probeImageRegistry(state, options.timeoutSeconds);
|
||||||
const registryReady = record(registry.probe).present === true;
|
const registryReady = record(registry.probe).present === true;
|
||||||
const ok = state.configReady && state.sourceHead.ok && sourceMirrorSync.ok === true && publish.ok === true && registryReady;
|
const ok = state.configReady && state.sourceHead.ok && sourceMirrorSync.ok === true && publish.ok === true && registryReady;
|
||||||
|
const elapsedMs = Date.now() - startedAt;
|
||||||
const result = {
|
const result = {
|
||||||
ok,
|
ok,
|
||||||
command,
|
command,
|
||||||
@@ -538,7 +540,9 @@ function runSentinelImageBuildConfirmed(state: SentinelCicdState, options: Extra
|
|||||||
registry,
|
registry,
|
||||||
sourceMirrorSync,
|
sourceMirrorSync,
|
||||||
publish,
|
publish,
|
||||||
|
elapsedMs,
|
||||||
warnings: [
|
warnings: [
|
||||||
|
...sentinelElapsedWarnings(elapsedMs),
|
||||||
...sentinelElapsedWarnings(record(sourceMirrorSync).elapsedMs),
|
...sentinelElapsedWarnings(record(sourceMirrorSync).elapsedMs),
|
||||||
...sentinelElapsedWarnings(record(publish).elapsedMs),
|
...sentinelElapsedWarnings(record(publish).elapsedMs),
|
||||||
],
|
],
|
||||||
@@ -559,6 +563,7 @@ function runSentinelImageBuildConfirmed(state: SentinelCicdState, options: Extra
|
|||||||
}
|
}
|
||||||
|
|
||||||
function runSentinelControlPlaneConfirmed(state: SentinelCicdState, options: Extract<WebProbeSentinelOptions, { kind: "control-plane" }>): RenderedCliResult {
|
function runSentinelControlPlaneConfirmed(state: SentinelCicdState, options: Extract<WebProbeSentinelOptions, { kind: "control-plane" }>): RenderedCliResult {
|
||||||
|
const startedAt = Date.now();
|
||||||
const command = `web-probe sentinel control-plane ${options.action}`;
|
const command = `web-probe sentinel control-plane ${options.action}`;
|
||||||
const applyOnly = options.action === "apply";
|
const applyOnly = options.action === "apply";
|
||||||
const sourceMirrorSync = applyOnly ? null : runSentinelSourceMirrorSyncJob(state, options.timeoutSeconds);
|
const sourceMirrorSync = applyOnly ? null : runSentinelSourceMirrorSyncJob(state, options.timeoutSeconds);
|
||||||
@@ -595,6 +600,7 @@ function runSentinelControlPlaneConfirmed(state: SentinelCicdState, options: Ext
|
|||||||
&& record(argoApply).ok === true
|
&& record(argoApply).ok === true
|
||||||
&& observedReady
|
&& observedReady
|
||||||
&& targetValidationOk;
|
&& targetValidationOk;
|
||||||
|
const elapsedMs = Date.now() - startedAt;
|
||||||
const blocker = ok ? null : {
|
const blocker = ok ? null : {
|
||||||
code: targetValidationOk
|
code: targetValidationOk
|
||||||
? record(sourceMirrorSync).ok === false ? "sentinel-source-mirror-sync-failed" : "sentinel-control-plane-not-ready"
|
? record(sourceMirrorSync).ok === false ? "sentinel-source-mirror-sync-failed" : "sentinel-control-plane-not-ready"
|
||||||
@@ -643,7 +649,9 @@ function runSentinelControlPlaneConfirmed(state: SentinelCicdState, options: Ext
|
|||||||
argoApply,
|
argoApply,
|
||||||
observed,
|
observed,
|
||||||
targetValidation,
|
targetValidation,
|
||||||
|
elapsedMs,
|
||||||
warnings: Array.from(new Set([
|
warnings: Array.from(new Set([
|
||||||
|
...sentinelElapsedWarnings(elapsedMs),
|
||||||
...sentinelElapsedWarnings(record(sourceMirrorSync).elapsedMs),
|
...sentinelElapsedWarnings(record(sourceMirrorSync).elapsedMs),
|
||||||
...sentinelElapsedWarnings(record(publish).elapsedMs),
|
...sentinelElapsedWarnings(record(publish).elapsedMs),
|
||||||
...sentinelElapsedWarnings(record(flush).result === undefined ? null : record(record(flush).result).durationMs),
|
...sentinelElapsedWarnings(record(flush).result === undefined ? null : record(record(flush).result).durationMs),
|
||||||
|
|||||||
Reference in New Issue
Block a user