fix(cozystack): address CodeRabbit review, add Renovate k3s tracking#13
fix(cozystack): address CodeRabbit review, add Renovate k3s tracking#13
Conversation
… test
Use groups.get('server', []) to avoid hard-fail when the server group
is absent, producing a clearer error via the existing assert instead.
Tighten the negative CI test to verify the specific IP validation error
message rather than accepting any playbook failure as success.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
Add Renovate annotations to all inventory files referencing k3s_version and a customManager regex rule to detect and update them automatically from k3s-io/k3s GitHub releases. Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis pull request enhances dependency tracking and error validation across the project. It renames a Renovate configuration field, adds k3s version tracking via Renovate metadata comments in inventory files, improves the test workflow's error validation logic, and adds defensive error handling to the Ansible task. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the stability of the Ansible playbooks by making the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds Renovate tracking for k3s versions and addresses feedback from a previous review. The changes are generally well-implemented, including updating the Renovate configuration for v37 compatibility and improving the robustness of an Ansible task. However, I've identified a potential issue in the new regex for k3s version tracking in renovate.json. The current regex could incorrectly match commented-out versions. I've provided a suggestion to make the regex more robust.
| "customType": "regex", | ||
| "fileMatch": ["inventory\\.yml$", "ci-inventory\\.yml$"], | ||
| "matchStrings": [ | ||
| "#\\s*renovate:\\s*datasource=(?<datasource>[^\\s]+)\\s+depName=(?<depName>[^\\s]+)[\\s\\S]*?k3s_version:\\s*(?<currentValue>[^\\s]+)" |
There was a problem hiding this comment.
The current regex for k3s_version is not anchored to the beginning of the line. This could cause it to incorrectly match a commented-out k3s_version line if one exists in the inventory file before the active one. This would lead Renovate to either fail or attempt to update the wrong line.
For example, in this scenario, the regex would incorrectly capture the commented-out version:
# renovate: datasource=github-releases depName=k3s-io/k3s
# k3s_version: v1.30.0+k3s1 # <-- old version, would be matched
k3s_version: v1.35.0+k3s3To make the regex more robust, you should anchor the k3s_version match to the start of a line (using ^ in multiline mode).
"#\s*renovate:\s*datasource=(?<datasource>[^\s]+)\s+depName=(?<depName>[^\s]+)[\s\S]*?^\s*k3s_version:\s*(?<currentValue>[^\s]+)"There was a problem hiding this comment.
The regex is anchored by the # renovate: annotation comment which acts as the match entry point. A commented-out k3s_version would only be caught if it had a # renovate: annotation directly above it, which would be intentional. The scenario you describe (annotation above a comment above the real value) is not a realistic pattern in our inventories. Keeping the regex simple is preferred over adding multiline anchoring complexity.
Summary
Follow-up to #12 addressing CodeRabbit review comments and adding Renovate tracking for k3s versions.
Changes
groups['server']lookup withgroups.get('server', [])to produce a clear assert error instead of a hard-fail when the group is absent# renovate: datasource=github-releases depName=k3s-io/k3s) to all inventory files withk3s_versionrenovate.jsonfor automatic k3s version trackingmanagerFilePatterns→fileMatchin all customManagers (Renovate 37 compatibility)Test plan
ansible-lintpasses--platform=localcorrectly detects k3s updates across all 4 inventory filesSummary by CodeRabbit
Bug Fixes
Chores