-
Notifications
You must be signed in to change notification settings - Fork 23
Fix misleading error message in cert generation and add deployment status feedback #1494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: lionello <[email protected]>
defang cert gen
src/pkg/cli/cert.go
Outdated
| } | ||
| if cnt == 0 { | ||
| // Only show the "no domainname found" message if there truly are no domains in the compose file | ||
| if cnt == 0 && !hasDomains { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to handle both cases: if cnt == 0 && hasDomains then the deployment is probably not finished.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot see above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in commit d7405be. The code now handles both cases when cnt == 0:
- No domains: Shows "No domainname found" message
- Domains exist: Shows "Deployment may not be finished yet; please wait and try again"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Added handling for the case when cnt == 0 && hasDomains to inform the user that the deployment may not be finished yet. Changes in commit d7405be.
src/pkg/cli/cert.go
Outdated
| } | ||
| if cnt == 0 { | ||
| // Only show the "no domainname found" message if there truly are no domains in the compose file | ||
| if cnt == 0 && !hasDomains { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot see above
When domains exist but no cert generation was processed (cnt == 0 && hasDomains), inform the user that the deployment may not be finished yet instead of staying silent. Co-authored-by: raphaeltm <[email protected]>
Description
Fixes the misleading error message in
defang cert genthat would display "Nodomainnamefound in compose file; no HTTPS cert generation needed" even when domain names were present in the compose file but certificate generation failed for other reasons. Additionally, provides informative feedback when the deployment is not yet complete.Problem
The original logic only checked if any certificates were processed (
cnt == 0) to determine whether to show the "no domainname found" message. However, the countercntis only incremented for services that require ACME certificate generation (whereserviceInfo.ZoneId == ""). This caused the misleading message to appear in scenarios where:Solution
Added a
hasDomainscheck that scans the compose project to determine if any domain names actually exist. The function now handles two distinct scenarios whencnt == 0:!hasDomains): Shows "Nodomainnamefound in compose file; no HTTPS cert generation needed"hasDomains): Shows "Deployment may not be finished yet; please wait and try again"This ensures users receive accurate feedback about why certificate generation isn't proceeding, whether it's due to truly missing domain names or an incomplete deployment.
Changes
GenerateLetsEncryptCert()insrc/pkg/cli/cert.goto add domain detection logic and differentiate between missing domains vs incomplete deploymentsTestHasDomains()test to validate the domain detection functionalityLinked Issues
Fixes #1476
Checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.