-
Notifications
You must be signed in to change notification settings - Fork 12
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
base: main
Are you sure you want to change the base?
Conversation
…if the version has been bumped
📝 WalkthroughWalkthroughThe 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 Changes
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
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit 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. Note ⚡️ Faster reviews with cachingCodeRabbit 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 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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}') |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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).
There was a problem hiding this 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 suggestionAlign checkout ref with version-check job
Thecheck-version-change
job uses:ref: ${{ github.head_ref || github.ref_name }}but the
publish-chart
job only usesgithub.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
: Useyq
for robust YAML parsing in version check
Relying ongrep
andawk
can break ifChart.yaml
formatting changes. Since you already depend onyq
, 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 setsshould_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
📒 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
Theon:
section now scopes PR and push events to justchart/Chart.yaml
and the workflow file, and addsworkflow_dispatch
for manual runs. This aligns perfectly with the goal of reducing unnecessary runs.
17-21
: Expose version-change flag as a job output
Mappingsteps.check-version.outputs.changed
tooutputs.should_publish
makes downstream logic more readable.
49-51
: Override version check for manual dispatch
The step correctly setschanged=true
whenworkflow_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)
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.
Summary by CodeRabbit