onveloz 0.0.0-beta.25 → 0.0.0-beta.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,6 +27,25 @@ function buildStageOrder(steps) {
27
27
  }
28
28
  return order;
29
29
  }
30
+ /** Matches the pre-start log section header written by the reconciler. */
31
+ const PRE_START_HEADER_RE = /^──\s*Logs do comando pre-start/;
32
+ /** Matches the pre-start unavailable message. */
33
+ const PRE_START_UNAVAILABLE_RE = /^──\s*Logs do comando pre-start indisponíveis/;
34
+ /** Matches the crash log section header written by the reconciler. */
35
+ const CRASH_LOG_HEADER_RE = /^──\s*Logs do container \(crash\)/;
36
+ /** Matches the crash logs unavailable message. */
37
+ const CRASH_LOG_UNAVAILABLE_RE = /^──\s*Logs do container indisponíveis/;
38
+ /** Lines that mark the beginning of the deploy/rollout phase. */
39
+ const DEPLOY_PHASE_MARKERS = [
40
+ /^Realizando deploy/,
41
+ /^Atualizando serviço/,
42
+ /^Criando serviço/,
43
+ /^Waiting for rollout/,
44
+ /^Updating deployment/,
45
+ /^Creating K8s deployment/
46
+ ];
47
+ /** Lines that indicate the pre-start command is starting. */
48
+ const PRE_START_MARKER_RE = /^Executando comando pre-start:/;
30
49
  const RUNTIME_LINE_PATTERNS = [
31
50
  /^[\u26A0\u{1F680}]/u,
32
51
  /^\{.*"(?:level|msg|pid)"/,
@@ -40,6 +59,14 @@ const RUNTIME_LINE_PATTERNS = [
40
59
  function isRuntimeLine(content) {
41
60
  return RUNTIME_LINE_PATTERNS.some((p) => p.test(content.trim()));
42
61
  }
62
+ function isPreStartLine(content) {
63
+ const trimmed = content.trim();
64
+ return PRE_START_MARKER_RE.test(trimmed) || PRE_START_HEADER_RE.test(trimmed) || PRE_START_UNAVAILABLE_RE.test(trimmed);
65
+ }
66
+ function isDeployPhaseLine(content) {
67
+ const trimmed = content.trim();
68
+ return DEPLOY_PHASE_MARKERS.some((p) => p.test(trimmed)) || CRASH_LOG_HEADER_RE.test(trimmed) || CRASH_LOG_UNAVAILABLE_RE.test(trimmed);
69
+ }
43
70
  function parseBuildSteps(rawText) {
44
71
  const rawLines = rawText.split("\n");
45
72
  let currentPhase = 0;
@@ -172,22 +199,61 @@ function parseBuildSteps(rawText) {
172
199
  generalCount++;
173
200
  const generalStep = allSteps[entry.origIdx];
174
201
  if (generalCount === totalGenerals && totalGenerals > 1) {
202
+ const finalizationLines = [];
203
+ const preStartLines = [];
175
204
  const deployLines = [];
176
205
  const healthLines = [];
177
- let hitRuntime = false;
206
+ let phase = "finalization";
207
+ let inCrashLogBlock = false;
178
208
  for (const line of generalStep.lines) {
179
- if (!hitRuntime && isRuntimeLine(line.content)) hitRuntime = true;
180
- if (hitRuntime) healthLines.push(line);
181
- else deployLines.push(line);
209
+ const content = line.content.trim();
210
+ if (CRASH_LOG_HEADER_RE.test(content) || PRE_START_HEADER_RE.test(content)) inCrashLogBlock = true;
211
+ if (phase === "finalization" && isPreStartLine(content)) phase = "prestart";
212
+ else if ((phase === "finalization" || phase === "prestart") && isDeployPhaseLine(content)) phase = "deploy";
213
+ else if ((phase === "finalization" || phase === "deploy") && !inCrashLogBlock && isRuntimeLine(content)) phase = "health";
214
+ switch (phase) {
215
+ case "finalization":
216
+ finalizationLines.push(line);
217
+ break;
218
+ case "prestart":
219
+ preStartLines.push(line);
220
+ break;
221
+ case "deploy":
222
+ deployLines.push(line);
223
+ break;
224
+ case "health":
225
+ healthLines.push(line);
226
+ break;
227
+ }
182
228
  }
183
- if (deployLines.length > 0) result.push({
229
+ const hasPreStartError = preStartLines.some((l) => /pre-start falhou|FAILED/i.test(l.content));
230
+ const hasDeployError = deployLines.some((l) => /DEPLOY FAILED/i.test(l.content));
231
+ if (finalizationLines.length > 0) result.push({
184
232
  stepNumber: null,
185
233
  title: "Finalização",
186
234
  duration: null,
187
235
  status: "done",
236
+ lines: finalizationLines,
237
+ phase: generalStep.phase,
238
+ startedAt: finalizationLines[0]?.timestamp ?? generalStep.startedAt
239
+ });
240
+ if (preStartLines.length > 0) result.push({
241
+ stepNumber: null,
242
+ title: "Pre-start",
243
+ duration: null,
244
+ status: hasPreStartError ? "error" : "done",
245
+ lines: preStartLines,
246
+ phase: generalStep.phase,
247
+ startedAt: preStartLines[0]?.timestamp ?? null
248
+ });
249
+ if (deployLines.length > 0) result.push({
250
+ stepNumber: null,
251
+ title: "Deploy",
252
+ duration: null,
253
+ status: hasDeployError ? "error" : "done",
188
254
  lines: deployLines,
189
255
  phase: generalStep.phase,
190
- startedAt: deployLines[0]?.timestamp ?? generalStep.startedAt
256
+ startedAt: deployLines[0]?.timestamp ?? null
191
257
  });
192
258
  if (healthLines.length > 0) result.push({
193
259
  stepNumber: null,