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

fix the apollo version logic by reading the server version instead of the apollo-core version #5105

Merged
merged 1 commit into from
Mar 17, 2024

Conversation

nobodyiam
Copy link
Member

@nobodyiam nobodyiam commented Mar 16, 2024

What's the purpose of this PR

fix the apollo version logic by reading the server version instead of the apollo-core version

Brief changelog

  • Add an ApolloServer.VERSION constant
  • Use ApolloServer.VERSION as the server version

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.
  • Update the CHANGES log.

Summary by CodeRabbit

  • New Features
    • Introduced a new constant to represent the Java version of the Apollo server.
  • Refactor
    • Updated version information source across various controllers for consistency.
    • Improved SystemInfoController initialization process.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 16, 2024
Copy link
Contributor

coderabbitai bot commented Mar 16, 2024

Walkthrough

These updates centralize the versioning information of the Apollo server by introducing a new ApolloServer class that holds a VERSION constant. The changes across various components adjust references from a previous Apollo class to the new ApolloServer, ensuring consistency in version information used throughout the system. This reorganization aims to streamline version management and improve code maintainability.

Changes

File Path Change Summary
.../constants/ApolloServer.java New file defining VERSION constant for Apollo server version.
.../common/controller/ApolloInfoController.java
.../portal/controller/SystemInfoController.java
Updated to use ApolloServer.VERSION instead of Apollo.VERSION; adjustments in imports and method refactoring.

🐰✨
In the land of code and byte,
Where versions shift from day to night,
A rabbit hopped with keen foresight,
"Align the versions, make them right!"
Now ApolloServer shines so bright,
A beacon in the devs' plight.
🌟📚

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-tests 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 tests 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 tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

codecov bot commented Mar 16, 2024

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 50.25%. Comparing base (a73d032) to head (23b03cb).

Files Patch % Lines
...ramework/apollo/common/constants/ApolloServer.java 0.00% 3 Missing ⚠️
...apollo/common/controller/ApolloInfoController.java 0.00% 1 Missing ⚠️
...apollo/portal/controller/SystemInfoController.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5105      +/-   ##
============================================
- Coverage     50.38%   50.25%   -0.14%     
+ Complexity     2013     2010       -3     
============================================
  Files           387      388       +1     
  Lines         12213    12216       +3     
  Branches       1207     1207              
============================================
- Hits           6154     6139      -15     
- Misses         5696     5712      +16     
- Partials        363      365       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between a73d032 and 23b03cb.
Files selected for processing (3)
  • apollo-common/src/main/java/com/ctrip/framework/apollo/common/constants/ApolloServer.java (1 hunks)
  • apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/ApolloInfoController.java (2 hunks)
  • apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/SystemInfoController.java (3 hunks)
Check Runs (1)
codecov/patch failure (3)
  • apollo-common/src/main/java/com/ctrip/framework/apollo/common/constants/ApolloServer.java: 22-24: Added lines #L22 - L24 were not covered by tests
  • apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/ApolloInfoController.java: 40-40: Added line #L40 was not covered by tests
  • apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/SystemInfoController.java: 72-72: Added line #L72 was not covered by tests
Additional comments: 2
apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/ApolloInfoController.java (1)
  • 40-40: Switching to ApolloServer.VERSION for version information in ApolloInfoController aligns with the PR's objectives. Ensure this change is reflected in all relevant parts of the application and consider adding test coverage for this new reference.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/SystemInfoController.java (1)
  • 72-72: The use of ApolloServer.VERSION in SystemInfoController is consistent with the PR's goal of accurately representing the server version. Ensure the change is thoroughly tested, especially since this modification impacts how the system version is determined and displayed.

Comment on lines +22 to +24
public class ApolloServer {
public final static String VERSION =
"java-" + ApolloServer.class.getPackage().getImplementationVersion();
Copy link
Contributor

Choose a reason for hiding this comment

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

The introduction of ApolloServer.VERSION is a positive change for accurately representing the server version. However, consider adding a fallback mechanism or ensuring through documentation that the ImplementationVersion in the package metadata is always set to avoid the java-null scenario.

@nobodyiam nobodyiam merged commit e3cd67d into apolloconfig:master Mar 17, 2024
10 of 12 checks passed
@nobodyiam nobodyiam deleted the fix-apollo-version branch March 17, 2024 08:01
@github-actions github-actions bot locked and limited conversation to collaborators Mar 17, 2024
@nobodyiam nobodyiam added this to the 2.3.0 milestone Apr 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant