Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

fix(clone-environment): also clones imported managed resources#358

Merged
nxtcoder17 merged 1 commit into
release-v1.0.7from
fix/263-clone-environment-imported-resources
Aug 6, 2024
Merged

fix(clone-environment): also clones imported managed resources#358
nxtcoder17 merged 1 commit into
release-v1.0.7from
fix/263-clone-environment-imported-resources

Conversation

@nxtcoder17
Copy link
Copy Markdown
Member

@nxtcoder17 nxtcoder17 commented Aug 6, 2024

Closes kloudlite/kloudlite#263

Summary by Sourcery

Fix cloning of imported managed resources during environment cloning. Refactor import managed resource logic into a separate function. Enhance DNS resolver to handle case-insensitive domain names and reserve .local domains. Ensure logger forces colored output unless overridden by environment variable.

Bug Fixes:

  • Fix issue where imported managed resources were not cloned during environment cloning.

Enhancements:

  • Refactor the import managed resource logic into a new function createAndApplyImportedManagedResource for better code organization.
  • Ensure DNS resolver handles domain names in a case-insensitive manner and reserves .local domains for local machine use.
  • Force colored output in the logger unless the CLICOLOR_FORCE environment variable is set.

@nxtcoder17 nxtcoder17 self-assigned this Aug 6, 2024
@nxtcoder17 nxtcoder17 requested a review from karthik1729 as a code owner August 6, 2024 07:14
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Aug 6, 2024

Reviewer's Guide by Sourcery

This pull request refactors the handling of imported managed resources by introducing a new function to create and apply these resources. It also updates the environment cloning process to include imported managed resources. Additionally, it improves secret handling, DNS resolution, and logging output formatting.

File-Level Changes

Files Changes
apps/console/internal/domain/imported-managed-resource.go
apps/console/internal/domain/environment.go
Refactored the handling of imported managed resources and updated environment cloning to include these resources.
apps/console/internal/domain/secret.go
apps/console/internal/entities/secret.go
Improved secret handling and formatting for better readability and error handling.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @nxtcoder17 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding brief comments to explain the purpose of complex logic blocks, especially in the new createAndApplyImportedManagedResource function. This would improve code maintainability.
  • While error handling is consistent, consider adding some logging for errors in critical sections to aid in debugging, particularly in the CloneEnvironment function.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

ctx.DBFilters().Add(fields.MetadataName, name),
common.PatchForMarkDeletion(),
)
defer func() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Consider moving defer statement to the beginning of deleteSecret function

Moving the defer statement to the beginning of the function can improve readability and make it clear that the event will be published regardless of the function's execution path.

Suggested change
defer func() {
func (d *Domain) deleteSecret(ctx context.Context, name string) error {
defer func() {
d.resourceEventPublisher.PublishResourceEvent(ctx, entities.ResourceTypeSecret, name, PublishUpdate)
}()
// Rest of the function...

@kloudlite kloudlite deleted a comment from sourcery-ai Bot Aug 6, 2024
@nxtcoder17 nxtcoder17 merged commit 12407be into release-v1.0.7 Aug 6, 2024
@nxtcoder17 nxtcoder17 deleted the fix/263-clone-environment-imported-resources branch August 6, 2024 07:17
abdheshnayak pushed a commit that referenced this pull request Nov 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API] clone environment does not clone imported managed resources

1 participant