Skip to content

added a ci check for version bump - #207

Open
Bloodraven21 wants to merge 1 commit into
valkey-io:mainfrom
Bloodraven21:ci/check-version-bump
Open

added a ci check for version bump#207
Bloodraven21 wants to merge 1 commit into
valkey-io:mainfrom
Bloodraven21:ci/check-version-bump

Conversation

@Bloodraven21

Copy link
Copy Markdown
Collaborator

Add CI check to enforce chart version bump on template changes

What

Adds a new chart-version job to .github/workflows/test-operator.yml that fails the build when valkey-operator template files are modified without bumping the
chart version in Chart.yaml.

Why

It is easy to change a chart's templates and forget to bump the chart version. Shipping template changes under an unchanged version means consumers can pull a
different chart for the same version, which breaks reproducibility and caching. This check makes the version bump a required, automated gate.

How it works

  1. Checks out full history (fetch-depth: 0) and fetches the base branch.
  2. Diffs valkey-operator/templates and valkey-operator/crds against the base branch (origin/${GITHUB_BASE_REF:-main}). If nothing there changed, the check is
    skipped.
  3. If templates changed, it reads the chart version from the current Chart.yaml and from the base branch's Chart.yaml.
  4. Using semver-aware comparison (sort -V), the check passes only if the new version is strictly greater than the base version. Otherwise it fails with a
    GitHub annotation: "please bump the chart version".

Examples

  • 0.2.4 to 0.2.5 or 0.3.0: passes
  • 0.2.4 unchanged while templates changed: fails
  • downgrade (0.2.4 to 0.2.3): fails

Signed-off-by: Ishan Jain <ishanij10115@gmail.com>
@Bloodraven21

Copy link
Copy Markdown
Collaborator Author

#205

@Bloodraven21 Bloodraven21 added the chart:valkey-operator Related to the valkey-operator chart label Jun 25, 2026
set -euo pipefail

BASE="origin/${GITHUB_BASE_REF:-main}"
git fetch --no-tags --depth=1 origin "${GITHUB_BASE_REF:-main}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Depth is already set to 0 on the top, may be redundant

git fetch --no-tags --depth=1 origin "${GITHUB_BASE_REF:-main}"

# Did any chart template (or the chart metadata) change vs the base branch?
if git diff --quiet "$BASE"...HEAD -- valkey-operator/templates valkey-operator/crds; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

May want to check for values.yaml or Chart.yaml as well, e.g. if we update default values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chart:valkey-operator Related to the valkey-operator chart

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants