-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat : create native image #800
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe recent updates modify the Changes
Possibly related PRs
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- .github/workflows/api-gateway.yml (1 hunks)
- api-gateway/src/test/java/com/example/api/gateway/TestAPIGatewayApplication.java (1 hunks)
Files skipped from review due to trivial changes (1)
- .github/workflows/api-gateway.yml
Additional comments not posted (1)
api-gateway/src/test/java/com/example/api/gateway/TestAPIGatewayApplication.java (1)
30-31
: LGTM! Verify the Redis image version update.The Redis image version has been updated from
7.2.3-alpine
to7.2.5-alpine
. Ensure that this new version is compatible and does not introduce any breaking changes.Verification successful
Redis image version update verified.
The Redis image version has been correctly updated to
7.2.5-alpine
in the test configuration file.
api-gateway/src/test/java/com/example/api/gateway/TestAPIGatewayApplication.java
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the Redis image version update. # Test: Pull the new Redis image version and check for compatibility issues. docker pull redis:7.2.5-alpineLength of output: 106
Script:
#!/bin/bash # Search for the usage of the Redis container in the test configuration files rg 'GenericContainer.*DockerImageName\.parse\("redis"\)' -A 3Length of output: 561
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- api-gateway/src/main/java/com/example/api/gateway/bootstrap/DataInitializer.java (1 hunks)
- api-gateway/src/main/java/com/example/api/gateway/config/ApiGatewayConfiguration.java (1 hunks)
- api-gateway/src/main/java/com/example/api/gateway/config/CircuitBreakerConfiguration.java (1 hunks)
- api-gateway/src/main/java/com/example/api/gateway/config/LoggingFilter.java (1 hunks)
- api-gateway/src/main/java/com/example/api/gateway/config/RateLimiterConfiguration.java (1 hunks)
- api-gateway/src/main/java/com/example/api/gateway/config/SwaggerConfig.java (1 hunks)
- api-gateway/src/main/java/com/example/api/gateway/config/WebClientConfiguration.java (1 hunks)
- api-gateway/src/main/java/com/example/api/gateway/config/WebFluxConfig.java (1 hunks)
Files skipped from review due to trivial changes (4)
- api-gateway/src/main/java/com/example/api/gateway/bootstrap/DataInitializer.java
- api-gateway/src/main/java/com/example/api/gateway/config/LoggingFilter.java
- api-gateway/src/main/java/com/example/api/gateway/config/SwaggerConfig.java
- api-gateway/src/main/java/com/example/api/gateway/config/WebClientConfiguration.java
Additional comments not posted (4)
api-gateway/src/main/java/com/example/api/gateway/config/RateLimiterConfiguration.java (1)
15-15
: Visibility change to package-private is appropriate.Changing the visibility of
RateLimiterConfiguration
to package-private is a good practice to encapsulate the configuration within the package.api-gateway/src/main/java/com/example/api/gateway/config/WebFluxConfig.java (1)
14-14
: Visibility change to package-private is appropriate.Changing the visibility of
WebFluxConfig
to package-private is a good practice to encapsulate the configuration within the package.api-gateway/src/main/java/com/example/api/gateway/config/CircuitBreakerConfiguration.java (1)
21-21
: Visibility change to package-private is appropriate.Changing the visibility of
CircuitBreakerConfiguration
to package-private is a good practice to encapsulate the configuration within the package.api-gateway/src/main/java/com/example/api/gateway/config/ApiGatewayConfiguration.java (1)
14-15
: Visibility change to package-private and disabling proxyBeanMethods are appropriate.Changing the visibility of
ApiGatewayConfiguration
to package-private is a good practice to encapsulate the configuration within the package. AddingproxyBeanMethods = false
improves performance by disabling proxying of bean methods.
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- api-gateway/src/test/resources/application-test.properties (1 hunks)
Files skipped from review due to trivial changes (1)
- api-gateway/src/test/resources/application-test.properties
While building a project that contains Spring Cloud Config Client, you must make sure that the configuration data source that it connects to (such as, Spring Cloud Config Server, Consul, Zookeeper, Vault, and others) is available. For example, if you retrieve configuration data from Spring Cloud Config Server, make sure you have its instance running and available at the port indicated in the Config Client setup. This is necessary because the application context is being optimized at build time and requires the target environment to be resolved.
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
api-gateway/src/main/resources/application.yml
is excluded by!**/*.yml
Files selected for processing (1)
- .github/workflows/api-gateway.yml (1 hunks)
Additional comments not posted (2)
.github/workflows/api-gateway.yml (2)
47-52
: LGTM! The Docker Compose step ensures necessary services are running.Starting up
config-server
andnaming-server
services via Docker Compose before building the Docker image is a good practice to ensure all dependencies are available.
54-58
: LGTM! The Maven command update for native image build is appropriate.Including the
-Pnative
profile and Docker credentials ensures that the native image is built and published correctly.
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- .github/workflows/api-gateway.yml (1 hunks)
Files skipped from review due to trivial changes (1)
- .github/workflows/api-gateway.yml
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
11019682 | Triggered | Generic High Entropy Secret | 5a7c0c5 | retail-store-webapp/src/main/resources/application.properties | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
api-gateway/src/test/java/com/example/api/gateway/TestAPIGatewayApplication.java (1)
31-33
: Consider adding Redis-specific configurations.While the basic container setup works, you might want to consider adding:
- Memory limits using
.withCommand("redis-server --save "" --appendonly no")
- Health check using
.withHealthCheck()
Example enhancement:
return new GenericContainer<>(DockerImageName.parse("redis").withTag("7.4.0-alpine")) .withExposedPorts(6379) + .withCommand("redis-server --save \"\" --appendonly no") + .withHealthCheck(Wait.forLogMessage(".*Ready to accept connections.*\\n", 1)) .withReuse(true);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
api-gateway/src/main/resources/application.yml
is excluded by!**/*.yml
📒 Files selected for processing (1)
api-gateway/src/test/java/com/example/api/gateway/TestAPIGatewayApplication.java
(1 hunks)
🔇 Additional comments (1)
api-gateway/src/test/java/com/example/api/gateway/TestAPIGatewayApplication.java (1)
30-33
: LGTM! Change aligns with native image creation.
The switch to GenericContainer is appropriate for native image support while maintaining core Redis container functionality.
Let's verify if there are any Redis-specific configurations needed for native image:
✅ Verification successful
Switch to GenericContainer is appropriate and safe
The verification confirms this change is correct because:
- The project uses Redis only for rate limiting in the Gateway configuration
- The native image support is properly configured with GraalVM native-maven-plugin
- The GenericContainer configuration maintains all necessary Redis functionality for rate limiting:
- Correct image and version
- Standard Redis port 6379
- Container reuse enabled for test efficiency
No additional Redis-specific configurations are needed for native image support as the usage is limited to Spring Cloud Gateway's rate limiter feature, which is already handled by Spring's native configuration.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if there are any Redis-specific native configurations in the project
rg -l "native-image|@NativeHint|@TypeHint" | grep -i "redis"
# Look for similar patterns in other Spring Boot native image projects
fd -e java -e properties -e yaml | xargs rg "redis.*native" -l
Length of output: 125
Script:
#!/bin/bash
# Let's check for any Redis configuration in the project
rg -l "redis" --type-add 'config:*.{properties,yml,yaml,xml}' -t config
# Check for Redis-related Spring configuration classes
rg -l "Redis.*Configuration" --type java
# Look for any native image configuration files
fd "native-image.properties|GraalConfig"
# Check for any Spring AOT configuration
rg "@Aot|@NativeHint|@ImportRuntimeHints" --type java
Length of output: 429
Script:
#!/bin/bash
# Let's check Redis configuration in application.yml
cat api-gateway/src/main/resources/application.yml
# Check if there are any Redis-related test configurations
rg -g "test/**/*.{java,yml,yaml}" "redis" -B2 -A2
# Check for Spring Boot native configuration in pom.xml
cat api-gateway/pom.xml | grep -A10 -B10 "native"
Length of output: 3836
No description provided.