Skip to content

fix: show containerapp endpoints in deployment summary#2130

Closed
jordanstephens wants to merge 2 commits into
mainfrom
jordan/azure-endpoints
Closed

fix: show containerapp endpoints in deployment summary#2130
jordanstephens wants to merge 2 commits into
mainfrom
jordan/azure-endpoints

Conversation

@jordanstephens
Copy link
Copy Markdown
Member

@jordanstephens jordanstephens commented May 25, 2026

Description

After the CD task finishes, re-fetch service infos from the provider so the deployment summary displays the actual azurecontainerapps.io URLs written by the CD task rather than the pre-deploy defang.app placeholders. Azure delegate domain support is not yet implemented, so this is a stopgap until it is.

Linked Issues

Checklist

  • I have performed a self-review of my code
  • I have added appropriate tests
  • I have updated the Defang CLI docs and/or README to reflect my changes, if necessary

Summary by CodeRabbit

  • Bug Fixes
    • After compose up finishes, service info is now refreshed from the deployment target so printed service states and endpoint URLs reflect actual deployed values (Azure endpoints now show real URLs instead of placeholders).
    • If the refresh fails or returns no data, the command gracefully keeps and displays the original service information.

Review Change Stack

After the CD task finishes, re-fetch service infos from the provider so
the deployment summary displays the actual azurecontainerapps.io URLs
written by the CD task rather than the pre-deploy defang.app placeholders.
Azure delegate domain support is not yet implemented, so this is a
stopgap until it is.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jordanstephens jordanstephens requested a review from lionello as a code owner May 25, 2026 22:28
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

📝 Walkthrough

Walkthrough

After log tailing completes, compose up does a best-effort session.Provider.GetServices(project.Name) to refresh deployed service info, falls back to deploy.Services on failure/empty response, then uses the resulting services to assign states and build endpoint output.

Changes

Compose Service Refresh

Layer / File(s) Summary
Provider service refresh and state printing
src/cmd/cli/command/compose.go
After deployment log tailing, updatedServices is initialized from deploy.Services and updated from session.Provider.GetServices() when available (best-effort). The resulting services are then used to assign state and build the output for service endpoints and status display.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 After logs settle and dust finds rest,
The provider whispers what works the best—
Real endpoints bloom where placeholders stood,
A refresh so gentle, so understood.
True URLs dance through Azure's light! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the specific fix being made: showing actual containerapp endpoints in the deployment summary instead of placeholders.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jordan/azure-endpoints

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=warning msg="The linter 'gomodguard' is deprecated (since v2.12.0) due to: new major version. Replaced by gomodguard_v2."
level=warning msg="Suggested new configuration:\nlinters:\n enable:\n - gomodguard_v2\n"
level=warning msg="[linters_context] running gomodguard failed: unable to read module file go.mod: current working directory must have a go.mod file: if you are not using go modules it is suggested to disable this linter"
level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/cmd/cli/command/compose.go`:
- Around line 192-194: The code currently assumes resp from
session.Provider.GetServices(ctx, &defangv1.GetServicesRequest{Project:
project.Name}) is non-nil and reads resp.Services, which can panic if
GetServices returns (nil, nil); modify the block around
session.Provider.GetServices so you first check that err == nil AND resp != nil
before accessing resp.Services, only assign updatedServices = resp.Services when
resp != nil and len(resp.Services) > 0, and otherwise leave
deploy.Services/updatedServices unchanged (optionally log a debug message);
reference the call site session.Provider.GetServices and the variables resp,
updatedServices and deploy.Services when making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 238995fc-12be-4369-9876-331704b4a520

📥 Commits

Reviewing files that changed from the base of the PR and between 09c0ed3 and 0a10c4c.

📒 Files selected for processing (1)
  • src/cmd/cli/command/compose.go

Comment thread src/cmd/cli/command/compose.go Outdated
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/cmd/cli/command/compose.go`:
- Around line 192-195: The log currently uses term.Debugf when calling
session.Provider.GetServices and incorrectly says "failed" even when err==nil
but resp is nil or resp.Services is empty; change this to two distinct slog
debug calls using structured fields: on error (err != nil) call
slog.DebugContext(ctx, "GetServices error after deployment",
slog.String("project", project.Name), slog.Any("err", err")), and when resp==nil
|| len(resp.Services)==0 call slog.DebugContext(ctx, "no services returned after
deployment", slog.String("project", project.Name), slog.Any("resp", resp));
remove the term.Debugf invocation and update any imports to use log/slog.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ecff8c85-18b5-4d4d-9e28-cc3805fd7fc9

📥 Commits

Reviewing files that changed from the base of the PR and between 0a10c4c and 7e2d60c.

📒 Files selected for processing (1)
  • src/cmd/cli/command/compose.go

Comment thread src/cmd/cli/command/compose.go
resp, err := session.Provider.GetServices(ctx, &defangv1.GetServicesRequest{Project: project.Name})
if err != nil || resp == nil || len(resp.Services) == 0 {
term.Debugf("GetServices failed after deployment: %v", err)
} else {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder if we should check the etag in the fetched response to ensure we're not printing old state

@lionello
Copy link
Copy Markdown
Member

See also DefangLabs/pulumi-defang#181 and #2133

@jordanstephens
Copy link
Copy Markdown
Member Author

Closing in favour of #2136

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.

2 participants