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 configfile interface cannot correctly obtain configuration t… #5198

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

qdsordinarydream
Copy link

@qdsordinarydream qdsordinarydream commented Aug 14, 2024

…hrough grayscale labels

What's the purpose of this PR

fix configfile interface cannot recognize grayscale labels

XXXXX

Which issue(s) this PR fixes:

fix configservice

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

write rule, the cache of reversedGrayReleaseRuleCache hadn't concept of allIp
image

read rule, There is no solution identified by gray label
image

Summary by CodeRabbit

  • New Features

    • Enhanced gray release rule functionality by adding support for new parameters: clusterName and clientLabel.
  • Bug Fixes

    • Improved validation of gray release rules, ensuring more comprehensive checks based on the updated parameters.
  • Tests

    • Updated test cases to reflect changes in the method signatures for better validation of gray release rules functionality.
  • Documentation

    • Added logging for debugging purposes within the query methods for better traceability.

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

coderabbitai bot commented Aug 14, 2024

Walkthrough

The recent changes enhance the gray release rule system's functionality by modifying key methods to accept additional parameters, specifically clusterName and clientLabel. This expansion allows for a more granular evaluation of gray release rules, improving the Apollo configuration management system. Corresponding test cases have also been updated to reflect these adjustments, ensuring comprehensive coverage of the new functionality.

Changes

Files Change Summary
apollo-biz/src/main/java/.../GrayReleaseRulesHolder.java Updated hasGrayReleaseRule to accept clusterName and clientLabel, enhancing rule evaluation criteria.
apollo-biz/src/test/java/.../GrayReleaseRulesHolderTest.java Adjusted test cases to reflect the new signature of hasGrayReleaseRule, ensuring consistency in parameter usage.
apollo-configservice/src/main/java/.../ConfigFileController.java Enhanced logging in queryConfigAsJson; updated hasGrayReleaseRule call to include new parameters.
apollo-configservice/src/test/java/.../ConfigFileControllerTest.java Updated mock methods in tests to accommodate the new signature for hasGrayReleaseRule, enhancing test scope.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ConfigFileController
    participant GrayReleaseRulesHolder

    Client->>ConfigFileController: Request configuration
    ConfigFileController->>GrayReleaseRulesHolder: check hasGrayReleaseRule(appId, clusterName, clientIp, clientLabel, namespace)
    GrayReleaseRulesHolder-->>ConfigFileController: Returns gray release rule status
    ConfigFileController-->>Client: Respond with configuration
Loading

🐰 In the meadow, changes bloom,
New rules and tests, dispelling gloom.
With cluster tales and labels bright,
Gray releases dance in new delight!
Hooray for updates, let them play,
In Apollo's garden, hip-hip-hooray! 🌼✨


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 Configuration 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

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


dongsheng.qi seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request

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.

Actionable comments posted: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c28eb49 and 0ee0e88.

Files selected for processing (4)
  • apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/grayReleaseRule/GrayReleaseRulesHolder.java (1 hunks)
  • apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/grayReleaseRule/GrayReleaseRulesHolderTest.java (2 hunks)
  • apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/ConfigFileController.java (4 hunks)
  • apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/controller/ConfigFileControllerTest.java (2 hunks)
Additional comments not posted (6)
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/grayReleaseRule/GrayReleaseRulesHolderTest.java (2)

112-123: Test case updates are appropriate.

The changes to the test cases correctly reflect the updated method signature of hasGrayReleaseRule, ensuring that the additional parameters someClusterName and someClientLabel are tested. This enhances the specificity and robustness of the tests.


147-156: Additional test case updates are appropriate.

These changes further ensure that the hasGrayReleaseRule method is tested with the new parameters, maintaining consistency across the test suite.

apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/controller/ConfigFileControllerTest.java (2)

98-98: Mock setup updates are appropriate.

The mock setup for hasGrayReleaseRule has been updated to include the new parameters, ensuring that the mock behavior aligns with the updated method signature.


202-202: Test case updates are appropriate.

The changes to the test case correctly reflect the updated method signature of hasGrayReleaseRule, ensuring that the additional parameters are tested.

apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/grayReleaseRule/GrayReleaseRulesHolder.java (1)

159-184: Method enhancements are well-implemented.

The hasGrayReleaseRule method has been expanded to include additional parameters and logic for checking both IP-based and label-based rules. These changes enhance the method's capability to manage gray release rules comprehensively.

apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/ConfigFileController.java (1)

178-178: Update method signature for hasGrayReleaseRule.

The method signature has been updated to include clusterName and clientLabel, which allows for more granular control over gray release rules. Ensure that all calls to this method are updated accordingly in the codebase.

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.

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 0ee0e88 and 18a98e2.

Files selected for processing (1)
  • apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/ConfigFileController.java (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/ConfigFileController.java

@nobodyiam
Copy link
Member

nobodyiam commented Aug 17, 2024

Please link the email [email protected] to your GitHub account and complete the CLA by following the instructions provided by the CLA bot.
Once done, you may proceed to update the codebase and add this to the CHANGES.md file.

@nobodyiam nobodyiam added this to the 2.4.0 milestone Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.

2 participants