-
Notifications
You must be signed in to change notification settings - Fork 258
Feature/azureblob-output #451
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
Conversation
WalkthroughThe changes introduce Azure Blob Storage export and Microsoft Teams notification integration for KRR reports. New configuration fields and CLI options are added to support Azure SAS URLs and Teams webhooks. The runner logic is extended to upload reports to Azure Blob Storage and notify Teams with adaptive cards containing report details and Azure Portal links. Documentation is updated accordingly. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI (main.py)
participant Runner
participant Azure Blob Storage
participant Microsoft Teams
User->>CLI (main.py): Run KRR with Azure/Teams options
CLI (main.py)->>Runner: Pass config with Azure SAS URL and Teams webhook
Runner->>Runner: Generate report
alt Azure Blob output enabled
Runner->>Azure Blob Storage: Upload report file (HTTP PUT with SAS URL)
alt Teams webhook configured
Runner->>Microsoft Teams: Send adaptive card notification (webhook)
end
end
Runner->>User: Complete execution
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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: 1
🧹 Nitpick comments (2)
README.md (1)
685-761: Excellent comprehensive documentation for the new Azure Blob Storage and Teams integration.The documentation is well-structured with clear prerequisites, setup instructions, usage examples, and feature descriptions. This will help users effectively utilize the new integration.
Note: Static analysis detected duplicate heading names ("Prerequisites" and "Setup") that appear in multiple sections. Consider making them more specific (e.g., "Azure Prerequisites", "Azure Setup") to improve navigation and avoid potential confusion.
robusta_krr/core/runner.py (1)
292-300: Consider improving the fallback behavior for missing Azure credentials.The portal URL construction works correctly, but the fallback behavior when Azure subscription ID or resource group is missing still returns a URL that may not work properly.
Consider returning a more user-friendly fallback or logging a more specific warning:
- if not settings.azure_subscription_id or not settings.azure_resource_group: - # Return a generic Azure portal link if specific info is missing - logger.warning("Azure subscription ID or resource group not provided. Azure portal link will not be specific.") + if not settings.azure_subscription_id or not settings.azure_resource_group: + logger.warning("Azure subscription ID or resource group not provided. Teams notification will include a generic Azure portal link.") + return "https://portal.azure.com/#blade/Microsoft_Azure_Storage/BrowseStorageBlade"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
images/krr_teams_example.pngis excluded by!**/*.png
📒 Files selected for processing (4)
README.md(3 hunks)robusta_krr/core/models/config.py(1 hunks)robusta_krr/core/runner.py(5 hunks)robusta_krr/main.py(2 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md
692-692: Multiple headings with the same content
(MD024, no-duplicate-heading)
698-698: Multiple headings with the same content
(MD024, no-duplicate-heading)
🪛 Ruff (0.12.2)
robusta_krr/core/runner.py
290-290: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling
(B904)
🔇 Additional comments (8)
robusta_krr/core/models/config.py (1)
72-75: LGTM! Clean integration of Azure Blob Storage and Teams notification configuration.The new configuration fields follow the established patterns in the codebase and are properly typed with appropriate defaults.
README.md (1)
84-84: Good integration with existing documentation structure.The addition to the integrations overview properly references the new Azure Blob and Teams integration, maintaining consistency with the existing documentation.
robusta_krr/core/runner.py (4)
15-15: Appropriate import addition for URL parsing functionality.The
urlparseimport is correctly added to support the new SAS URL parsing functionality in the Azure integration methods.
119-146: Well-integrated Azure Blob Storage functionality in the output processing flow.The integration of Azure blob upload follows the existing pattern used for other output methods. The logic correctly handles file creation, upload, Teams notification, and cleanup.
168-201: Solid implementation of Azure Blob Storage upload with proper error handling.The method correctly handles:
- File reading and HTTP PUT request to Azure
- Content-Type mapping based on file extensions
- SAS URL construction
- Comprehensive error handling and logging
203-276: Comprehensive Teams notification implementation with rich adaptive cards.The method creates a well-structured adaptive card with relevant metadata and includes proper error handling. The card format follows Microsoft Teams best practices.
robusta_krr/main.py (2)
269-292: Excellent CLI integration following established patterns.The new command-line options are well-documented with clear help text and follow the existing naming conventions and categorization. The integration with the Config constructor is clean and consistent.
352-355: Proper integration of new parameters into Config constructor.The new Azure-related parameters are correctly passed to the Config constructor, maintaining consistency with the existing parameter passing pattern.
aantn
left a comment
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.
Thank you!
arikalon1
left a comment
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.
nice work
Thanks for this great PR @mlhv
Added option to send report to Azure Blob Storage, as well as optionally notify a Teams Channel provided a webhook URL. If using the teams webhook alert, then an
azure-subscription-idandazure-resource-groupis required.Users can use the following new flags when running the program:
--azurebloboutput "Blob Service SAS URL Here"--teams-webhook "Teams Webhook URL Here"--azure-subscription-id "Azure Subscription ID Here"--azure-resource-group "Azure Resource Group Name Here"Documentation is added to README.