Skip to content

Conversation

@kvaps
Copy link
Member

@kvaps kvaps commented Dec 1, 2025

Signed-off-by: Andrei Kvapil kvapss@gmail.com

What this PR does

Release note

[redis] Add version management system with automated version updates

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 1, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 2025

Warning

Rate limit exceeded

@kvaps has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 18 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 13e0501 and 7e1cad2.

📒 Files selected for processing (11)
  • .github/workflows/pre-commit.yml (1 hunks)
  • packages/apps/redis/.helmignore (1 hunks)
  • packages/apps/redis/Makefile (1 hunks)
  • packages/apps/redis/README.md (1 hunks)
  • packages/apps/redis/files/versions.yaml (1 hunks)
  • packages/apps/redis/hack/update-versions.sh (1 hunks)
  • packages/apps/redis/templates/_versions.tpl (1 hunks)
  • packages/apps/redis/templates/redisfailover.yaml (1 hunks)
  • packages/apps/redis/values.schema.json (1 hunks)
  • packages/apps/redis/values.yaml (1 hunks)
  • packages/system/cozystack-resource-definitions/cozyrds/redis.yaml (2 hunks)

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch redis-versions

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kvaps, 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 introduces a comprehensive version management system for Redis deployments, enabling automated discovery and application of the latest Redis major and patch versions. It provides users with the flexibility to select a desired major Redis version, while the system dynamically ensures the deployment uses the most current stable patch release. This enhancement significantly improves the maintainability and currency of Redis instances within the application.

Highlights

  • Automated Redis Version Updates: A new script, hack/update-versions.sh, has been introduced to automatically fetch the latest patch versions for supported Redis major versions (currently v7 and v8) directly from Docker Hub. This ensures the application can easily stay up-to-date with the latest stable Redis releases.
  • Dynamic Redis Image Tagging: The Redis image tag in redisfailover.yaml now dynamically resolves to the latest patch version based on the user-specified version parameter. This is achieved through a new Helm template, _versions.tpl, which reads from a version mapping file.
  • User-Configurable Redis Major Version: Users can now specify their desired major Redis version (e.g., v8, v7) via a new version parameter. This parameter is exposed in values.yaml, documented in README.md, and validated through values.schema.json and the cozyrds/redis.yaml OpenAPI schema.
  • Centralized Version Mapping: A new file, files/versions.yaml, has been added to store the mapping of major Redis versions to their latest known patch versions. This file is automatically updated by the update-versions.sh script.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dosubot dosubot bot added the enhancement New feature or request label Dec 1, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an automated version management system for Redis, which is a great improvement for maintainability. The implementation includes a script to fetch the latest versions, updates to Helm templates to use these versions, and corresponding changes in configuration and documentation. My review focuses on the correctness and robustness of the new automation script. I've found a critical issue in how a data file is generated which would break deployments, along with a few other suggestions to improve the script's reliability and completeness. Overall, this is a valuable addition with a few adjustments needed.

Comment on lines +99 to +103
{
for major_ver in "${MAJOR_VERSIONS[@]}"; do
echo "\"${major_ver}\": \"${VERSION_MAP[$major_ver]}\""
done
} > "$VERSIONS_FILE"
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The generated versions.yaml file is not valid YAML. It's being created as a list of strings, but it should be a YAML map for the fromYaml function in the Helm template to parse it correctly. This will cause the Helm installation to fail.

Suggested change
{
for major_ver in "${MAJOR_VERSIONS[@]}"; do
echo "\"${major_ver}\": \"${VERSION_MAP[$major_ver]}\""
done
} > "$VERSIONS_FILE"
{
for major_ver in "${MAJOR_VERSIONS[@]}"; do
echo "${major_ver}: \"${VERSION_MAP[$major_ver]}\"
done
} > "$VERSIONS_FILE"

Comment on lines +107 to +161
# Update values.yaml - enum with major versions only
TEMP_FILE=$(mktemp)
trap "rm -f $TEMP_FILE" EXIT

# Build new version section
NEW_VERSION_SECTION="## @enum {string} Version"
for major_ver in "${MAJOR_VERSIONS[@]}"; do
NEW_VERSION_SECTION="${NEW_VERSION_SECTION}
## @value $major_ver"
done
NEW_VERSION_SECTION="${NEW_VERSION_SECTION}

## @param {Version} version - Redis major version to deploy
version: ${MAJOR_VERSIONS[0]}"

# Check if version section already exists
if grep -q "^## @enum {string} Version" "$VALUES_FILE"; then
# Version section exists, update it using awk
echo "Updating existing version section in $VALUES_FILE..."

# Use awk to replace the section from "## @enum {string} Version" to "version: " (inclusive)
# Delete the old section and insert the new one
awk -v new_section="$NEW_VERSION_SECTION" '
/^## @enum {string} Version/ {
in_section = 1
print new_section
next
}
in_section && /^version: / {
in_section = 0
next
}
in_section {
next
}
{ print }
' "$VALUES_FILE" > "$TEMP_FILE.tmp"
mv "$TEMP_FILE.tmp" "$VALUES_FILE"
else
# Version section doesn't exist, insert it before Application-specific parameters section
echo "Inserting new version section in $VALUES_FILE..."

# Use awk to insert before "## @section Application-specific parameters"
awk -v new_section="$NEW_VERSION_SECTION" '
/^## @section Application-specific parameters/ {
print new_section
print ""
}
{ print }
' "$VALUES_FILE" > "$TEMP_FILE.tmp"
mv "$TEMP_FILE.tmp" "$VALUES_FILE"
fi

echo "Successfully updated $VALUES_FILE with major versions: ${MAJOR_VERSIONS[*]}"

Copy link
Contributor

Choose a reason for hiding this comment

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

high

This script automates updating Redis versions in values.yaml and files/versions.yaml, which is great. However, it doesn't update values.schema.json. This means the schema's enum for the version field will become outdated when new major versions of Redis are found by this script. This would require manual intervention, defeating the purpose of full automation. A similar issue exists for packages/system/cozystack-resource-definitions/cozyrds/redis.yaml, which also contains a schema definition.

Please consider extending this script to also update values.schema.json. You could use jq to modify the enum array in the JSON file. The update-crd.sh script would then likely propagate this change to cozyrds/redis.yaml when make generate is run.


# Update values.yaml - enum with major versions only
TEMP_FILE=$(mktemp)
trap "rm -f $TEMP_FILE" EXIT
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The trap only cleans up $TEMP_FILE, but the script also creates and uses $TEMP_FILE.tmp which is not removed on exit. This will leave temporary files behind. The trap should be updated to clean up both files.

Suggested change
trap "rm -f $TEMP_FILE" EXIT
trap "rm -f '$TEMP_FILE' '$TEMP_FILE.tmp'" EXIT

Comment on lines +3 to +5
{{- if not (hasKey $versionMap .Values.version) }}
{{- printf `Redis version %s is not supported, allowed versions are %s` $.Values.version (keys $versionMap) | fail }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This check is good, but it assumes $versionMap is a map. If files/versions.yaml is malformed (e.g., due to a bug in the generation script), fromYaml might not produce a map, and hasKey would fail with a less-than-helpful error. It's more robust to first check if you have a map. Also, the error message can be improved by sorting and joining the available versions for better readability.

{{- if not (kindIs "map" $versionMap) }}
    {{- fail "files/versions.yaml did not parse as a valid YAML map." }}
{{- else if not (hasKey $versionMap .Values.version) }}
    {{- printf `Redis version %s is not supported, allowed versions are %s` $.Values.version (keys $versionMap | sortAlpha | join ", ") | fail }}
{{- end }}

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 5, 2025
@kvaps kvaps merged commit f86896e into main Dec 5, 2025
47 of 49 checks passed
@kvaps kvaps deleted the redis-versions branch December 5, 2025 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants