Skip to content

Fix the Helm chart version fetcher#111

Merged
JakeSCahill merged 2 commits intomainfrom
fix-helm-version-fetcher
Jul 9, 2025
Merged

Fix the Helm chart version fetcher#111
JakeSCahill merged 2 commits intomainfrom
fix-helm-version-fetcher

Conversation

@JakeSCahill
Copy link
Contributor

In redpanda-data/helm-charts#1695, we moved the Redpanda Helm chart to the redpanda-operator repo. As a result, this pull request updates our version fetcher extension to fetch the Helm version from that repo.

This pull request introduces a significant refactor to the Helm chart version-fetching logic, replacing the previous GitHub releases-based approach with a branch-based approach derived from Docker tags. It also updates the integration of this new logic into the version-fetching workflow and improves logging for better clarity.

Refactoring Helm Chart Version Logic:

  • Added a new function get-latest-redpanda-helm-version-from-operator.js to fetch Helm chart versions by deriving branches from Docker tags and reading Chart.yaml files. This replaces the previous logic that relied on GitHub releases.
  • Removed the old function get-latest-redpanda-helm-version.js that fetched Helm chart versions based on GitHub release tags.

Integration Updates:

  • Updated set-latest-version.js to replace the old Helm chart version-fetching logic with the new branch-based approach. The new logic depends on the operator version to determine stable and beta Docker tags. [1] [2]

Logging Improvements:

  • Enhanced logging in set-latest-version.js to provide clearer and more structured output for the latest versions of Redpanda components, including Helm charts and the operator.

Miscellaneous:

  • Updated package.json to increment the version from 4.6.4 to 4.6.5.

@netlify
Copy link

netlify bot commented Jul 8, 2025

Deploy Preview for docs-extensions-and-macros ready!

Name Link
🔨 Latest commit dbd6424
🔍 Latest deploy log https://app.netlify.com/projects/docs-extensions-and-macros/deploys/686d8baeeaddc600073f4932
😎 Deploy Preview https://deploy-preview-111--docs-extensions-and-macros.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 8, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

A new module, get-latest-redpanda-helm-version-from-operator.js, is introduced to fetch the latest Redpanda Helm chart versions by referencing Docker tags from the operator repository. The previous implementation, which fetched Helm chart versions directly from GitHub releases, is removed. The logic in set-latest-version.js is updated to defer fetching the Helm chart version until after the operator version is retrieved, using the new module and passing the operator's stable and beta Docker tags. Error handling and logging are improved to reflect the new dependency chain. The package version is incremented to 4.6.5.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant set-latest-version.js
    participant GetLatestOperatorVersion
    participant GetLatestHelmChartVersionFromOperator
    participant GitHubAPI

    Client->>set-latest-version.js: register()
    set-latest-version.js->>GetLatestOperatorVersion: fetch operator version
    GetLatestOperatorVersion-->>set-latest-version.js: return {stable, beta} tags

    alt operator version available
        set-latest-version.js->>GetLatestHelmChartVersionFromOperator: fetch Helm chart version (with operator tags)
        GetLatestHelmChartVersionFromOperator->>GitHubAPI: fetch Chart.yaml from branch derived from Docker tag
        GitHubAPI-->>GetLatestHelmChartVersionFromOperator: return Chart.yaml content
        GetLatestHelmChartVersionFromOperator-->>set-latest-version.js: return {latestStableRelease, latestBetaRelease}
    else operator version unavailable
        set-latest-version.js->>set-latest-version.js: log error, set Helm chart result as rejected
    end

    set-latest-version.js->>Client: update latestVersions object and log result
Loading

Suggested reviewers

  • asimms41

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
🪧 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @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.

Support

Need 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)

  • @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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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
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: 1

🧹 Nitpick comments (3)
extensions/version-fetcher/get-latest-redpanda-helm-version-from-operator.js (3)

13-13: Consider adding parameter validation for repository specificity.

The function accepts any repository name but the logic is specifically designed for the redpanda-operator repository structure (Chart.yaml path, branch naming convention). Consider adding validation to ensure the repo parameter is redpanda-operator.

module.exports = async (github, owner, repo, stableDockerTag, betaDockerTag) => {
+  if (repo !== 'redpanda-operator') {
+    throw new Error('This function is designed specifically for the redpanda-operator repository');
+  }
  const yaml = require('js-yaml');

15-15: Consider making the Chart.yaml path configurable.

The hardcoded path charts/redpanda/Chart.yaml creates a tight coupling to the current repository structure. Consider making this configurable to improve maintainability.

module.exports = async (github, owner, repo, stableDockerTag, betaDockerTag) => {
  const yaml = require('js-yaml');
-  const path = 'charts/redpanda/Chart.yaml';
+  const path = process.env.CHART_YAML_PATH || 'charts/redpanda/Chart.yaml';

57-60: Improve error specificity for better debugging.

The error handling could be more specific about the type of failure to aid in debugging.

      } catch (error) {
-        console.error(`Failed to fetch Chart.yaml for branch ${branchName}:`, error.message);
+        console.error(`Failed to fetch Chart.yaml for branch ${branchName} (${error.status || 'unknown status'}):`, error.message);
        return null;
      }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8db09f4 and 62c1f7d.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • extensions/version-fetcher/get-latest-redpanda-helm-version-from-operator.js (1 hunks)
  • extensions/version-fetcher/get-latest-redpanda-helm-version.js (0 hunks)
  • extensions/version-fetcher/set-latest-version.js (3 hunks)
  • package.json (1 hunks)
💤 Files with no reviewable changes (1)
  • extensions/version-fetcher/get-latest-redpanda-helm-version.js
🧰 Additional context used
🧬 Code Graph Analysis (1)
extensions/version-fetcher/get-latest-redpanda-helm-version-from-operator.js (1)
extensions/version-fetcher/set-latest-version.js (2)
  • github (27-27)
  • owner (21-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - docs-extensions-and-macros
  • GitHub Check: Header rules - docs-extensions-and-macros
  • GitHub Check: Pages changed - docs-extensions-and-macros
🔇 Additional comments (6)
package.json (1)

3-3: Version increment looks appropriate.

The patch version bump from 4.6.4 to 4.6.5 correctly reflects the refactoring changes to the Helm chart version fetching logic.

extensions/version-fetcher/get-latest-redpanda-helm-version-from-operator.js (2)

29-29: Regex pattern handles expected version formats correctly.

The regex pattern correctly matches both standard versions (v2.4.2) and beta versions (v25.1.3-beta), supporting the documented version formats.


68-71: Efficient concurrent fetching implementation.

Using Promise.all to fetch both stable and beta chart versions concurrently is an excellent performance optimization that reduces the total execution time.

extensions/version-fetcher/set-latest-version.js (3)

7-7: Import statement is correct.

The import of the new Helm chart version fetcher function is properly implemented.


44-69: Well-structured deferred fetching logic with comprehensive error handling.

The approach of deferring Helm chart version fetching until after the operator version is available is logical and correctly implemented. The error handling covers both operator unavailability and Helm chart fetch failures.


134-139: Improved logging format enhances readability.

The structured multiline logging format with conditional beta version information provides much better visibility into the version fetching results.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 8, 2025

Caution

No docstrings were generated.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@JakeSCahill JakeSCahill requested a review from kbatuigas July 9, 2025 08:08
@JakeSCahill JakeSCahill merged commit b943934 into main Jul 9, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants