Skip to content

Conversation

@TylerGillson
Copy link
Collaborator

@TylerGillson TylerGillson commented Sep 16, 2025

Summary by CodeRabbit

  • Chores
    • Optimized CI workflow to detect charts with zero dependencies and skip Helm repo/dependency updates accordingly, reducing unnecessary steps.
    • Improves pipeline efficiency with faster runs and cleaner logs when no chart dependencies are present.
    • No user-facing behavior changes.

Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
@openshift-ci
Copy link

openshift-ci bot commented Sep 16, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: TylerGillson

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@TylerGillson TylerGillson requested review from arturshadnik and removed request for jnpacker and xuezhaojun September 16, 2025 15:27
@coderabbitai
Copy link

coderabbitai bot commented Sep 16, 2025

Walkthrough

Introduced a pre-check in the GitHub Actions workflow step handling Helm repositories to detect zero dependencies in Chart.yaml using yq. When no dependencies are found, the step exits successfully and skips Helm repo operations; otherwise, it proceeds with the existing dependency parsing and update logic.

Changes

Cohort / File(s) Summary of Changes
CI workflow: Helm dependency pre-check
\.github/workflows/test.yml
Added yq-based dependency count check for Chart.yaml. If count is zero, print skip message and exit 0. If dependencies exist, continue existing flow: parse dependencies, add non-OCI/non-file repos, run helm repo update, and helm dependency update.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately and concisely summarizes the primary change: adding a CI pre-check to skip priming Helm repos when a Chart.yaml has no dependencies. It uses the conventional "ci:" prefix and clearly states the behavior being introduced ("skip helm repo priming") and the condition ("if no chart deps exist"), which matches the workflow changes. A reviewer scanning PR history will understand the intent without needing file-level detail.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

Copy link

@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)
.github/workflows/test.yml (3)

114-119: Make yq null‑safe and numeric‑safe

Guard against missing .dependencies (yq can emit null) and ensure numeric comparison won’t error on empty/non‑numeric values.

Apply this diff:

-          dependency_count=$(yq eval '.dependencies | length' ${{ inputs.repo }}/charts/${{ inputs.repo }}/Chart.yaml)
-          if [[ "$dependency_count" -lt 1 ]]; then
+          dependency_count=$(yq eval '.dependencies // [] | length' "${{ inputs.repo }}/charts/${{ inputs.repo }}/Chart.yaml")
+          if [[ ${dependency_count:-0} -eq 0 ]]; then
             echo "No dependencies found in Chart.yaml. Skipping helm repo operations."
             exit 0
           fi

113-113: Harden the shell: fail the pipeline on pipe errors

Add pipefail so failures in the yq/while pipeline don’t get masked.

Apply this diff:

-          
+          set -o pipefail

120-127: Minor robustness: safe read and quoting

  • Use IFS= read -r to avoid trimming/escape issues.
  • Quote path arguments for safety.

Apply this diff:

-          yq eval '.dependencies[] | .name + " " + .repository' ${{ inputs.repo }}/charts/${{ inputs.repo }}/Chart.yaml | while read -r repo_name repo_url; do
+          yq eval '.dependencies[] | .name + " " + .repository' "${{ inputs.repo }}/charts/${{ inputs.repo }}/Chart.yaml" | while IFS= read -r repo_name repo_url; do
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51d485b and 0915479.

📒 Files selected for processing (1)
  • .github/workflows/test.yml (1 hunks)
🔇 Additional comments (1)
.github/workflows/test.yml (1)

108-131: Change intent LGTM; avoids unnecessary Helm ops

Early‑exit when no deps is a good CI speedup and reduces flakiness.

Please confirm that all charts under charts/ follow the ${{ inputs.repo }} subdir convention; otherwise this step won’t prime repos for other chart names.

@arturshadnik
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Sep 16, 2025
@TylerGillson TylerGillson merged commit 379bb9d into open-cluster-management-io:main Sep 16, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants