Skip to content

Changed version and publish chart workflow #29

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MarkBogelund
Copy link
Contributor

@MarkBogelund MarkBogelund commented May 22, 2025

The version in the helm chart created from the build_push_chart in do.sh now depends on the version specified in chart/CHart.yaml. This means that the version will only be specified in one place instead of both in the Chart.yaml and a proprietary VERSION file.

Also, the publish-chart.yml workflow has been updated, so it only runs when triggered manually or if the version has been bumped.


Summary by cubic

The chart version is now read directly from chart/Chart.yaml, and the publish-chart workflow only runs on manual trigger or when the chart version changes.

  • Refactors
    • Removed the separate VERSION file; version is now managed in one place.
    • Updated workflow to check for version changes before publishing.

Summary by CodeRabbit

  • Chores
    • Workflow can now be triggered manually and only runs publishing steps if the chart version changes.
    • Improved detection of chart version changes for more accurate workflow execution.
    • Updated script to extract chart version directly from the chart file instead of a separate version file.
    • Added prerequisite checks to ensure required tools and files are present before packaging and pushing the chart.

Copy link

coderabbitai bot commented May 22, 2025

📝 Walkthrough

Walkthrough

The workflow for publishing a Helm chart was updated to allow manual triggering, restrict event monitoring to specific files, and introduce a new job to detect version changes in the chart. Additionally, the script responsible for building and pushing the chart now verifies prerequisites and extracts the version from the chart's YAML file using yq instead of reading from a separate version file.

Changes

File(s) Change Summary
.github/workflows/publish-chart.yml Added manual trigger, restricted event paths to chart/Chart.yaml and workflow file, introduced check-version-change job, and made publish-chart conditional on version changes or manual trigger.
do.sh Enhanced build_push_chart to check for yq and chart/Chart.yaml existence before proceeding; changed version extraction to use yq on chart/Chart.yaml; reformatted Helm push command.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub Actions
    participant check-version-change
    participant publish-chart

    User->>GitHub Actions: Push/PR to chart/Chart.yaml or manual trigger
    GitHub Actions->>check-version-change: Run job
    alt Manual trigger
        check-version-change->>publish-chart: Set changed=true
    else Version change detected
        check-version-change->>publish-chart: Set changed=true if version changed
    else No version change
        check-version-change->>publish-chart: Set changed=false
    end
    publish-chart-->>GitHub Actions: Run only if changed=true
Loading

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e2d0d13 and 156f81e.

📒 Files selected for processing (1)
  • do.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • do.sh
✨ Finishing Touches
  • 📝 Generate Docstrings

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

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic found 2 issues across 2 files. Review them in cubic.dev

React with 👍 or 👎 to teach cubic. Tag @cubic-dev-ai to give specific feedback.

if: github.event_name != 'workflow_dispatch' # Skip if manually triggered
run: |
if git diff --name-only HEAD^ HEAD | grep -q 'chart/Chart.yaml'; then
PREVIOUS_VERSION=$(git show HEAD^:chart/Chart.yaml | grep 'version:' | awk '{print $2}')
Copy link

Choose a reason for hiding this comment

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

If Chart.yaml did not exist in the previous commit (e.g. the file was just added), git show HEAD^:chart/Chart.yaml returns a non-zero status which, together with set -eo pipefail used by GitHub runners, terminates the whole step and aborts the workflow. Guard the command or swallow the error so the version-check logic can proceed safely.

@@ -15,12 +15,11 @@ build_push_image() {
}

build_push_chart() {
version=$(cat VERSION)
version=$(yq -r '.version' chart/Chart.yaml)
Copy link

Choose a reason for hiding this comment

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

The yq command is invoked with the -r flag but without the required sub-command (e|eval) that newer versions of mikefarah/yq expect; this exits with "unknown shorthand flag" and stops the build script (set -e).

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

🔭 Outside diff range comments (1)
.github/workflows/publish-chart.yml (1)

57-61: 🛠️ Refactor suggestion

Align checkout ref with version-check job
The check-version-change job uses:

ref: ${{ github.head_ref || github.ref_name }}

but the publish-chart job only uses github.head_ref. To cover both PRs and pushes, update it:

      - name: Checkout Code
        uses: actions/checkout@v3
        with:
-         ref: ${{ github.head_ref }}
+         ref: ${{ github.head_ref || github.ref_name }}
          fetch-depth: 0
🧰 Tools
🪛 actionlint (1.7.7)

58-58: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🧹 Nitpick comments (3)
.github/workflows/publish-chart.yml (3)

29-47: Use yq for robust YAML parsing in version check
Relying on grep and awk can break if Chart.yaml formatting changes. Since you already depend on yq, consider:

-   PREVIOUS_VERSION=$(git show HEAD^:chart/Chart.yaml | grep 'version:' | awk '{print $2}')
+   PREVIOUS_VERSION=$(git show HEAD^:chart/Chart.yaml | yq -r '.version')
-   CURRENT_VERSION=$(grep 'version:' chart/Chart.yaml | awk '{print $2}')
+   CURRENT_VERSION=$(yq -r '.version' chart/Chart.yaml)

This ensures consistent parsing.

🧰 Tools
🪛 actionlint (1.7.7)

31-31: shellcheck reported issue in this script: SC2086:info:7:28: Double quote to prevent globbing and word splitting

(shellcheck)


31-31: shellcheck reported issue in this script: SC2086:info:10:29: Double quote to prevent globbing and word splitting

(shellcheck)


31-31: shellcheck reported issue in this script: SC2086:info:14:27: Double quote to prevent globbing and word splitting

(shellcheck)

🪛 YAMLlint (1.37.1)

[error] 35-35: trailing spaces

(trailing-spaces)


36-36: Remove trailing whitespace
This blank line contains trailing spaces and is flagged by YAML lint. Please delete the extra whitespace to satisfy the linter.


53-55: Simplify publish-chart job condition
Since the manual step already sets should_publish=true, the || github.event_name == 'workflow_dispatch' is redundant. You can streamline to:

if: needs.check-version-change.outputs.should_publish == 'true'
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a32bb29 and e2d0d13.

📒 Files selected for processing (2)
  • .github/workflows/publish-chart.yml (1 hunks)
  • do.sh (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/publish-chart.yml

23-23: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


31-31: shellcheck reported issue in this script: SC2086:info:7:28: Double quote to prevent globbing and word splitting

(shellcheck)


31-31: shellcheck reported issue in this script: SC2086:info:10:29: Double quote to prevent globbing and word splitting

(shellcheck)


31-31: shellcheck reported issue in this script: SC2086:info:14:27: Double quote to prevent globbing and word splitting

(shellcheck)


50-50: shellcheck reported issue in this script: SC2086:info:1:24: Double quote to prevent globbing and word splitting

(shellcheck)

🪛 YAMLlint (1.37.1)
.github/workflows/publish-chart.yml

[error] 35-35: trailing spaces

(trailing-spaces)

🔇 Additional comments (3)
.github/workflows/publish-chart.yml (3)

3-12: Restrict workflow triggers and enable manual dispatch
The on: section now scopes PR and push events to just chart/Chart.yaml and the workflow file, and adds workflow_dispatch for manual runs. This aligns perfectly with the goal of reducing unnecessary runs.


17-21: Expose version-change flag as a job output
Mapping steps.check-version.outputs.changed to outputs.should_publish makes downstream logic more readable.


49-51: Override version check for manual dispatch
The step correctly sets changed=true when workflow_dispatch is used, ensuring the chart is published on manual trigger.

🧰 Tools
🪛 actionlint (1.7.7)

50-50: shellcheck reported issue in this script: SC2086:info:1:24: Double quote to prevent globbing and word splitting

(shellcheck)

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.

1 participant