Skip to content

fix(azure): recognize zone-less timestamps in CD log lines - #2287

Merged
lionello merged 1 commit into
mainfrom
fix/azure-cd-log-connecting-banner-timestamp
Oct 3, 2026
Merged

lionello merged 1 commit into
mainfrom
fix/azure-cd-log-connecting-banner-timestamp

Conversation

@defangdevs

Copy link
Copy Markdown
Contributor

Summary

Fixes #2275. Follow-up to #2244 (which fixed #2079).

parseCDLogLine strips the CD job's embedded engine timestamp out of each log line so it isn't shown twice (once as the CLI's own read-time column, once baked into the message). It only recognized full RFC3339Nano timestamps (2026-04-28T23:43:03.965786510Z - worker deleting (0s)), which is what the pulumi wrapper's own stdout lines use.

Azure's logStreamEndpoint (used for live-follow CD logs, job.go's streamJobExecutionLogs) also injects its own informational banner line when it connects, e.g.:

2026-09-16T11:25:39.17810 Connecting to the container 'defang-cd'...

That timestamp uses the same layout but without a trailing zone designator (no Z/offset), which time.Parse(time.RFC3339Nano, ...) rejects outright. So this one line fell through to the pre-#2244 fallback (raw line as Message, time.Now() as Timestamp), reproducing the exact double-timestamp symptom #2079/#2244 were meant to fix.

Fix

Add a second candidate layout ("2006-01-02T15:04:05.999999999", no zone) to parseCDLogLine's existing parse loop, parsed as UTC. RFC3339Nano is still tried first, so CD-job stdout lines are unaffected.

Test plan

  • Added test cases to TestParseCDLogLine covering a zone-less timestamp with fractional seconds (matching the reported line) and one with seconds-only precision (matching Azure's documented connect-banner format)
  • go test -short ./pkg/cli/client/byoc/azure/... passes
  • golangci-lint run ./pkg/cli/client/byoc/azure/... reports 0 issues
  • go build ./... succeeds

🤖 Generated with Claude Code

parseCDLogLine (added by #2244 to fix #2079) only recognized the
pulumi wrapper's full RFC3339Nano timestamps. Azure's logStreamEndpoint
also injects its own "Connecting to container" banner line, timestamped
with the same layout but no trailing zone designator (e.g.
"2026-09-16T11:25:39.178105928" instead of "...928Z"). RFC3339Nano
parsing rejects that outright, so the line fell back to the raw-line +
time.Now() path, reproducing the double-timestamp bug for that one line
(#2275).

Add a second timestamp layout without a zone designator, parsed as UTC,
to parseCDLogLine's existing fallback loop.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDEqMD6nq4tfs9yDe23iWM
@defangdevs
defangdevs requested a review from lionello as a code owner October 3, 2026 10:57
@coderabbitai

coderabbitai Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 3 included reviews currently available. Your 45 included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 6dab1281-680e-4631-b383-3f066f1f98bd
📥 Commits

Reviewing files that changed from the base of the PR and between 697d40e and 428c705.

📒 Files selected for processing (2)
  • src/pkg/cli/client/byoc/azure/byoc.go
  • src/pkg/cli/client/byoc/azure/byoc_test.go
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@lionello
lionello merged commit 6d07a85 into main Oct 3, 2026
16 checks passed
@lionello
lionello deleted the fix/azure-cd-log-connecting-banner-timestamp branch October 3, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure: some logs still have double timestamps Redundant timestamps on Azure deployments

2 participants