Skip to content
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

Refactor and Simplify Codebase for Harbor Satellite #30

Merged
merged 8 commits into from
Jul 26, 2024

Conversation

bupd
Copy link
Collaborator

@bupd bupd commented Jul 1, 2024

Overview:

The current Harbor Satellite codebase is characterized by complex logic and a lack of clear flow, making it challenging for future contributors to understand its functionality and make necessary modifications. The intricacies of the existing code structure hinder productivity and increase the likelihood of introducing errors during updates or enhancements.

Changes Made:

  • Modularization:
    Refactored large, monolithic functions into smaller, well-defined functions to improve clarity and reusability.

  • Improved Naming Conventions:
    Updated variable and function names to be more descriptive and reflective of their roles in the code.

  • Simplified Logic:
    Rewrote complex conditional statements and loops to streamline the control flow.

  • Enhanced Documentation:
    Added detailed inline comments and created a separate document outlining the new code flow and logic.

Expected Outcome:

  • A codebase that is significantly more readable and maintainable.
  • Enhanced developer productivity and confidence in making future enhancements and modifications.
  • Reduced complexity and ambiguity, resulting in fewer errors and easier onboarding for new contributors.

Fixes: #29

Summary by CodeRabbit

  • New Features

    • Updated registry configuration to use remote URLs for better connectivity and reliability.
    • Enhanced error handling and logging for more robust application performance.
  • Bug Fixes

    • Improved error handling in the Satellite component to prevent failures during replication.
  • Refactor

    • Renamed methods for clarity and consistency across the application.
    • Modularized input processing functions for better code maintainability.
  • Tests

    • Adjusted test cases to reflect updated image operations and handling of standard output.

- This commit adds simplified functions to handle file processing of url
- Also handles both processing in separate functions

Signed-off-by: bupd <[email protected]>
@github-actions github-actions bot added the golang label Jul 1, 2024
Copy link

coderabbitai bot commented Jul 1, 2024

Walkthrough

This update focuses on enhancing the codebase of the Harbor Satellite by refactoring complex logic, improving error handling, and streamlining the flow for better clarity and maintainability. Key changes include modifying configuration flags, creating new modular functions in main.go, renaming methods, and adding new functionalities to manage images and registries more efficiently. The refactor aims to improve readability, error handling, and developer productivity.

Changes

Files Change Summary
config.toml Switched bring_own_registry flag from true to false, updated url_or_file to a remote URL.
main.go Refactored error handling, updated logging, added processFilePath and processURL functions for modular input processing.
internal/store/file-fetch.go Renamed Type() method to SourceType() in FileImageList.
internal/store/http-fetch.go Renamed RemoteImageList to RemoteImageSource, updated related methods, added new methods for fetching images and digests, improved error handling and logging.
internal/store/in-memory-store.go Renamed Type() method to SourceType() in ImageFetcher interface, updated method calls within inMemoryStore.
internal/replicate/replicate.go Added Replicator interface, implemented BasicReplicator, added new functions for image handling and registry info processing, improved error handling, updated Replicate and DeleteExtraImages functions.
internal/satellite/satellite.go Enhanced error handling in Run method for DeleteExtraImages function.
test/e2e/satellite_test.go Removed operations for busybox:stable, adjusted operations for busybox:1.36, modified standard output handling in buildSatellite function.

Assessment against linked issues

Objective Addressed Explanation
Simplify and refactor codebase (#29)
Improve variable naming and code documentation (#29) Documentation improved but variable naming consistency unclear.
Simplify conditional statements and control flow (#29)

Poem

In lines of code both old and new,
The logic clearer, simpler grew.
Through modular paths we now embark,
With errors handled, debug dark.
Image flows are deftly led,
Repos cleaned, and bugs unfed.
Cheers to change—a coder's hue!
Harbor Satellite, made anew. 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 5

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2978bc7 and 6d1ebc1.

Files selected for processing (2)
  • config.toml (1 hunks)
  • main.go (4 hunks)
Additional context used
golangci-lint
main.go

157-157: ineffectual assignment to fetcher

(ineffassign)


140-140: SA4009: argument fetcher is overwritten before first use

(staticcheck)

Additional comments not posted (4)
config.toml (2)

2-2: Correctness: Ensure the registry configuration change is intentional.

The bring_own_registry flag has been changed to false. Ensure this change aligns with the intended configuration.


8-9: Correctness: Verify the URL change from local to remote registry.

The url_or_file value has been updated to a remote URL. Ensure this change aligns with the intended configuration and update any dependent documentation or code accordingly.

main.go (2)

34-34: Error Handling: Improve log message clarity.

Consider providing more context in the log message to aid debugging.

- log.Fatalf("Error running satellite: %v", err)
+ log.Fatalf("Error running satellite in main function: %v", err)

164-164: Logging: Enhance log message clarity.

Consider providing more context in the log message to aid debugging.

- fmt.Println("Input is a valid URL.")
+ fmt.Println("Successfully parsed input as a valid URL.")

main.go Outdated Show resolved Hide resolved
main.go Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Show resolved Hide resolved
Copy link

@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: 5

Outside diff range and nitpick comments (3)
internal/store/file-fetch.go (2)

Line range hint 31-41: Improve error handling in FileImageListFetcher.

Instead of returning nil on error, return an error to provide better error handling.

func FileImageListFetcher(relativePath string) (*FileImageList, error) {
	// Get the current working directory
	dir, err := os.Getwd()
	if err != nil {
		return nil, fmt.Errorf("error getting current directory: %w", err)
	}

	// Construct the absolute path from the relative path
	absPath := filepath.Join(dir, relativePath)

	return &FileImageList{
		Path: absPath,
	}, nil
}

Line range hint 43-62: Add more error context and logging in List.

Adding more error context and logging can help with better debugging.

func (client *FileImageList) List(ctx context.Context) ([]Image, error) {
	var images []Image

	// Read the file
	data, err := os.ReadFile(client.Path)
	if err != nil {
		return nil, fmt.Errorf("error reading file %s: %w", client.Path, err)
	}

	var imageData ImageData
	// Parse the JSON data
	err = json.Unmarshal(data, &imageData)
	if err != nil {
		return nil, fmt.Errorf("error unmarshaling JSON data from file %s: %w", client.Path, err)
	}

	// Iterate over the repositories
	for _, repo := range imageData.Repositories {
		// Iterate over the images in each repository
		for _, image := range repo.Images {
			// Add each "name" value to the images slice
			images = append(images, Image{Name: image.Name})
		}
	}

	return images, nil
}
internal/store/http-fetch.go (1)

74-82: Consider using a more secure method for handling credentials.

Using environment variables for credentials is not secure. Consider using a more secure method, such as a secrets management service.

func createAuthHeader() (string, error) {
	// Use a secrets management service to retrieve credentials securely
	username := retrieveSecret("HARBOR_USERNAME")
	password := retrieveSecret("HARBOR_PASSWORD")
	if username == "" || password == "" {
		return "", fmt.Errorf("failed to retrieve credentials from secrets management service")
	}
	auth := base64.StdEncoding.EncodeToString([]byte(username + ":" + password))
	return "Basic " + auth, nil
}
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6d1ebc1 and f58e1e1.

Files selected for processing (4)
  • internal/store/file-fetch.go (1 hunks)
  • internal/store/http-fetch.go (1 hunks)
  • internal/store/in-memory-store.go (2 hunks)
  • main.go (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • main.go
Additional comments not posted (6)
internal/store/file-fetch.go (2)

27-29: LGTM!

The SourceType function is correct and straightforward.


Line range hint 64-66: Add a TODO comment for future implementation.

Consider adding a TODO comment to indicate that this function needs to be implemented in the future.

func (client *FileImageList) GetDigest(ctx context.Context, tag string) (string, error) {
	// TODO: Implement GetDigest for FileImageList
	return "Not implemented yet", nil
}
internal/store/http-fetch.go (3)

29-31: LGTM!

The NewRemoteImageSource function is correct and straightforward.


34-36: LGTM!

The SourceType function is correct and straightforward.


123-126: LGTM!

The cleanImageReference function is correct and straightforward.

internal/store/in-memory-store.go (1)

31-33: LGTM!

The SourceType function is correct and straightforward.

internal/store/http-fetch.go Outdated Show resolved Hide resolved
internal/store/http-fetch.go Show resolved Hide resolved
internal/store/http-fetch.go Outdated Show resolved Hide resolved
internal/store/http-fetch.go Show resolved Hide resolved
internal/store/http-fetch.go Outdated Show resolved Hide resolved
Copy link

@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: 5

Outside diff range and nitpick comments (2)
internal/store/in-memory-store.go (2)

Line range hint 244-244: Refactor complex logic for clarity and simplicity.

The checkImageAndDigest function contains complex logic that may benefit from refactoring.

Consider breaking down the function into smaller, more manageable functions to enhance readability and maintainability.

Tools
golangci-lint

81-81: Error return value of s.AddImage is not checked

(errcheck)


98-98: Error return value of s.RemoveImage is not checked

(errcheck)


161-161: Error return value of s.Remove is not checked

(errcheck)


58-58: ineffectual assignment to err

(ineffassign)


60-60: ineffectual assignment to err

(ineffassign)


Line range hint 244-244: Enhance error handling and logging.

The GetLocalDigest function can benefit from additional error handling and logging for better debugging and maintainability.

Consider adding more detailed error messages and logging the URL being fetched.

- return "", fmt.Errorf("failed to get digest using crane: %w", err)
+ return "", fmt.Errorf("failed to get digest using crane for URL %s: %w", url, err)
Tools
golangci-lint

81-81: Error return value of s.AddImage is not checked

(errcheck)


98-98: Error return value of s.RemoveImage is not checked

(errcheck)


161-161: Error return value of s.Remove is not checked

(errcheck)


58-58: ineffectual assignment to err

(ineffassign)


60-60: ineffectual assignment to err

(ineffassign)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f58e1e1 and 0e23b53.

Files selected for processing (3)
  • internal/store/file-fetch.go (2 hunks)
  • internal/store/http-fetch.go (1 hunks)
  • internal/store/in-memory-store.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • internal/store/file-fetch.go
  • internal/store/http-fetch.go
Additional context used
golangci-lint
internal/store/in-memory-store.go

81-81: Error return value of s.AddImage is not checked

(errcheck)


98-98: Error return value of s.RemoveImage is not checked

(errcheck)


161-161: Error return value of s.Remove is not checked

(errcheck)


58-58: ineffectual assignment to err

(ineffassign)


60-60: ineffectual assignment to err

(ineffassign)

Additional comments not posted (1)
internal/store/in-memory-store.go (1)

Line range hint 244-244: LGTM!

The removeHostName function is correct and efficient.

Tools
golangci-lint

81-81: Error return value of s.AddImage is not checked

(errcheck)


98-98: Error return value of s.RemoveImage is not checked

(errcheck)


161-161: Error return value of s.Remove is not checked

(errcheck)


58-58: ineffectual assignment to err

(ineffassign)


60-60: ineffectual assignment to err

(ineffassign)

internal/store/in-memory-store.go Outdated Show resolved Hide resolved
internal/store/in-memory-store.go Show resolved Hide resolved
internal/store/in-memory-store.go Show resolved Hide resolved
internal/store/in-memory-store.go Show resolved Hide resolved
Copy link

@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: 5

Outside diff range and nitpick comments (1)
internal/store/in-memory-store.go (1)

Line range hint 231-264: Check error return values and improve efficiency.

  1. The error return value of s.Remove and s.Add is not checked.
  2. The error return value of fmt.Errorf is not checked.
-  if err := s.Remove(context.Background(), storeDigest, storeImage); err != nil {
-      fmt.Errorf("Error: %w", err)
-      return false
-  }
-  s.Add(context.Background(), digest, image)
+  if err := s.Remove(context.Background(), storeDigest, storeImage); err != nil {
+      return false, fmt.Errorf("Error: %w", err)
+  }
+  if err := s.Add(context.Background(), digest, image); err != nil {
+      return false, err
+  }
Tools
golangci-lint

258-258: Error return value of fmt.Errorf is not checked

(errcheck)


262-262: Error return value of s.Add is not checked

(errcheck)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0e23b53 and 530cd8f.

Files selected for processing (1)
  • internal/store/in-memory-store.go (4 hunks)
Additional context used
golangci-lint
internal/store/in-memory-store.go

164-164: Error return value of s.Remove is not checked

(errcheck)


258-258: Error return value of fmt.Errorf is not checked

(errcheck)


262-262: Error return value of s.Add is not checked

(errcheck)

Additional comments not posted (5)
internal/store/in-memory-store.go (5)

38-44: LGTM!

The NewInMemoryStore function correctly initializes an in-memory store with an ImageFetcher.


183-190: LGTM!

The getImageList function correctly converts the in-memory store to a list of Image structs.


Line range hint 192-205: LGTM!

The Add function correctly adds an image and its digest to the store.


Line range hint 212-225: LGTM!

The Remove function correctly removes an image and its digest from the store.


Line range hint 266-280: LGTM!

The GetLocalDigest function correctly retrieves the digest of an image from a local registry using the crane library.

Tools
golangci-lint

164-164: Error return value of s.Remove is not checked

(errcheck)

internal/store/in-memory-store.go Outdated Show resolved Hide resolved
internal/store/in-memory-store.go Outdated Show resolved Hide resolved
internal/store/in-memory-store.go Outdated Show resolved Hide resolved
internal/store/in-memory-store.go Outdated Show resolved Hide resolved
internal/store/in-memory-store.go Outdated Show resolved Hide resolved
Copy link

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 530cd8f and 20bef9c.

Files selected for processing (2)
  • internal/replicate/replicate.go (2 hunks)
  • internal/store/in-memory-store.go (4 hunks)
Additional context used
Learnings (1)
internal/store/in-memory-store.go (1)
Learnt from: bupd
PR: container-registry/harbor-satellite#30
File: internal/store/in-memory-store.go:226-229
Timestamp: 2024-07-03T00:26:50.260Z
Learning: The `RemoveImage` function in `internal/store/in-memory-store.go` should return an error to maintain consistency with other functions.
golangci-lint
internal/store/in-memory-store.go

101-101: Error return value of s.RemoveImage is not checked

(errcheck)


265-265: Error return value of fmt.Errorf is not checked

(errcheck)


269-269: Error return value of s.Add is not checked

(errcheck)

Additional comments not posted (26)
internal/replicate/replicate.go (15)

16-21: LGTM! The Replicator interface is well-defined.

The interface methods Replicate and DeleteExtraImages are clear and concise.


22-23: LGTM! The BasicReplicator struct is well-implemented.

The struct correctly implements the Replicator interface.


25-28: LGTM! The ImageInfo struct is well-defined.

The struct correctly holds the name of an image.


30-35: LGTM! The Repository struct is well-defined.

The struct correctly holds the repository name and associated images.


36-41: LGTM! The RegistryInfo struct is well-defined.

The struct correctly holds the registry URL and repositories information.


42-45: LGTM! The NewReplicator function is well-implemented.

The function correctly returns a new BasicReplicator instance.


47-53: Verify the error handling in the Replicate function.

The error handling for the getPullSource function should be verified to ensure all error cases are handled correctly.


56-63: LGTM! The stripPrefix function is well-implemented.

The function correctly removes the prefix from the image name.


Line range hint 64-91: Verify the error handling in the DeleteExtraImages function.

The error handling for the crane.ListTags and crane.Delete functions should be verified to ensure all error cases are handled correctly.


93-110: Verify the error handling in the getPullSource function.

The error handling for the getFileInfo function should be verified to ensure all error cases are handled correctly.


112-126: Verify the error handling in the getFileInfo function.

The error handling for the os.ReadFile and json.Unmarshal functions should be verified to ensure all error cases are handled correctly.


128-150: Verify the error handling in the CopyImage function.

The error handling for the crane.Pull and crane.Push functions should be verified to ensure all error cases are handled correctly.


156-163: LGTM! The removeHostName function is well-implemented.

The function correctly removes the hostname from the image name.


165-172: LGTM! The getEnvRegistryPath function is well-implemented.

The function correctly constructs the local registry URL from environment variables.


174-181: Verify the error handling in the getWorkingDir function.

The error handling for the os.Getwd function should be verified to ensure all error cases are handled correctly.

internal/store/in-memory-store.go (11)

12-15: LGTM! The Image struct is well-defined.

The struct correctly represents a container image with its digest and name.


18-23: LGTM! The inMemoryStore struct is well-defined.

The struct correctly stores images in memory and uses an ImageFetcher to manage images.


24-30: LGTM! The Storer interface is well-defined.

The interface methods for listing, adding, and removing images are clear and concise.


31-37: LGTM! The ImageFetcher interface is well-defined.

The interface methods for listing images, getting digests, and retrieving the source type are clear and concise.


38-45: LGTM! The NewInMemoryStore function is well-implemented.

The function correctly returns a new in-memory store instance with the given ImageFetcher.


46-75: Verify the error handling in the List function.

The error handling for the fetcher.List, handleFileSource, and handleRemoteSource functions should be verified to ensure all error cases are handled correctly.


77-119: Verify the error handling in the handleFileSource function.

The error handling for the AddImage and RemoveImage functions should be verified to ensure all error cases are handled correctly.

Tools
golangci-lint

101-101: Error return value of s.RemoveImage is not checked

(errcheck)


121-184: Verify the error handling in the handleRemoteSource function.

The error handling for the fetcher.GetDigest, Remove, and Add functions should be verified to ensure all error cases are handled correctly.


186-193: LGTM! The getImageList function is well-implemented.

The function correctly converts the in-memory store to a list of Image structs.


Line range hint 194-208: Verify the error handling in the Add function.

The error handling for the Add function should be verified to ensure all error cases are handled correctly.

Tools
golangci-lint

101-101: Error return value of s.RemoveImage is not checked

(errcheck)


Line range hint 215-228: Verify the error handling in the Remove function.

The error handling for the Remove function should be verified to ensure all error cases are handled correctly.

internal/store/in-memory-store.go Outdated Show resolved Hide resolved
@bupd bupd marked this pull request as ready for review July 3, 2024 00:54
Copy link

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 20bef9c and 1e60c1c.

Files selected for processing (1)
  • internal/store/in-memory-store.go (4 hunks)
Additional context used
Learnings (1)
internal/store/in-memory-store.go (1)
Learnt from: bupd
PR: container-registry/harbor-satellite#30
File: internal/store/in-memory-store.go:226-229
Timestamp: 2024-07-03T00:26:50.260Z
Learning: The `RemoveImage` function in `internal/store/in-memory-store.go` should return an error to maintain consistency with other functions.
golangci-lint
internal/store/in-memory-store.go

101-101: Error return value of s.RemoveImage is not checked

(errcheck)


272-272: Error return value of fmt.Errorf is not checked

(errcheck)


276-276: Error return value of s.Add is not checked

(errcheck)

Additional comments not posted (2)
internal/store/in-memory-store.go (2)

35-35: LGTM! The renaming of Type() to SourceType() improves clarity.

The change aligns with naming conventions and improves readability.


54-66: LGTM! Improved error handling and use of SourceType.

The changes enhance the function's robustness and clarity.

internal/store/in-memory-store.go Outdated Show resolved Hide resolved
@bupd
Copy link
Collaborator Author

bupd commented Jul 3, 2024

@Vad1mo ready for review!

Signed-off-by: bupd <[email protected]>
internal/replicate/replicate.go Outdated Show resolved Hide resolved
@bupd bupd requested a review from Vad1mo July 9, 2024 17:56
Copy link

@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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1e60c1c and 4d67c14.

Files selected for processing (5)
  • config.toml (1 hunks)
  • internal/replicate/replicate.go (4 hunks)
  • internal/satellite/satellite.go (3 hunks)
  • internal/store/http-fetch.go (2 hunks)
  • internal/store/in-memory-store.go (5 hunks)
Files skipped from review as they are similar to previous changes (4)
  • config.toml
  • internal/replicate/replicate.go
  • internal/store/http-fetch.go
  • internal/store/in-memory-store.go
Additional comments not posted (3)
internal/satellite/satellite.go (3)

28-28: Ensure consistent error handling.

The added error handling is consistent with the rest of the method. Good practice to return the error immediately.


40-43: LGTM! Error handling added for DeleteExtraImages.

The added error handling for s.replicator.DeleteExtraImages follows the same pattern as other error checks in the method.


69-72: LGTM! Error handling added for DeleteExtraImages.

The added error handling for s.replicator.DeleteExtraImages follows the same pattern as other error checks in the method.

Copy link

@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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4d67c14 and abd4b3d.

Files selected for processing (6)
  • config.toml (1 hunks)
  • internal/replicate/replicate.go (4 hunks)
  • internal/satellite/satellite.go (3 hunks)
  • internal/store/file-fetch.go (2 hunks)
  • internal/store/http-fetch.go (2 hunks)
  • internal/store/in-memory-store.go (6 hunks)
Files skipped from review as they are similar to previous changes (6)
  • config.toml
  • internal/replicate/replicate.go
  • internal/satellite/satellite.go
  • internal/store/file-fetch.go
  • internal/store/http-fetch.go
  • internal/store/in-memory-store.go

@bupd
Copy link
Collaborator Author

bupd commented Jul 9, 2024

Ready to merge!

Signed-off-by: bupd <[email protected]>
Copy link

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between abd4b3d and bda73b5.

Files selected for processing (1)
  • test/e2e/satellite_test.go (2 hunks)
Additional comments not posted (2)
test/e2e/satellite_test.go (2)

110-110: Verify the availability of the new image tag.

Ensure that busybox:1.36 is a valid and available image tag.


154-154: Verify the availability of the new image tag.

Ensure that busybox:1.36 is a valid and available image tag.

test/e2e/satellite_test.go Show resolved Hide resolved
@Vad1mo Vad1mo merged commit bda73b5 into container-registry:main Jul 26, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor and Simplify Harbor Satellite Code
2 participants