Skip to content

Conversation

@s04
Copy link
Contributor

@s04 s04 commented Nov 4, 2025

Summary

Adds a bash script that detects Cluster API version misalignments across the codebase.

Changes

  • New script hack/check-capi-version.sh that:
    • Reads the desired CAPI version from go.mod
    • Scans the repository for CAPI version references
    • Reports any mismatches in configuration files
    • Excludes documentation files (*.md) as they may contain example output

Usage

./hack/check-capi-version.sh

The script exits with status 1 if mismatches are found, making it suitable for CI integration.

Fixes #1705

@guettli
Copy link
Collaborator

guettli commented Nov 4, 2025

@s04 can you please use that heading?

#!/usr/bin/env bash
# Bash Strict Mode: https://github.com/guettli/bash-strict-mode
trap 'echo -e "\n🤷 🚨 🔥 Warning: A command has failed. Exiting the script. Line was ($0:$LINENO): $(sed -n "${LINENO}p" "$0" 2>/dev/null || true) 🔥 🚨 🤷 "; exit 3' ERR
set -Eeuo pipefail

thank you.

Otherwise it looks good.

@s04 s04 force-pushed the feature/check-capi-version-sync branch from b47f8e8 to 0d681e5 Compare November 4, 2025 11:37
@s04
Copy link
Contributor Author

s04 commented Nov 4, 2025

@guettli thanks added.

@guettli guettli changed the title Add script to check CAPI version alignment 🌱 Add script to check CAPI version alignment Nov 4, 2025
@guettli
Copy link
Collaborator

guettli commented Nov 4, 2025

@s04 I am sorry, linting fails. Files need a boilerplate header:

#!/usr/bin/env bash
# Copyright 2025 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

can you please add this?

This script validates that Cluster API versions are consistent across
the codebase by reading the desired version from go.mod and checking
for mismatches in Makefile, Tiltfile, and test configurations.

Documentation files (*.md) are excluded as they may contain example
output that doesn't need to be kept in sync.

Fixes syself#1705
@s04 s04 force-pushed the feature/check-capi-version-sync branch from 0d681e5 to 2cd8724 Compare November 8, 2025 15:36
@s04
Copy link
Contributor Author

s04 commented Nov 8, 2025

@guettli thanks for your patience! Added it and ran the linter.

Looks good now, will make a note to run the validator in the future.

🔍 121 Total (in 9s) ✅ 106 OK 🚫 0 Errors 💤 15 Excluded

@guettli
Copy link
Collaborator

guettli commented Nov 10, 2025

@s04 Please run make verify-boilerplate the boilerplate (license at the top of the file) is not correct. Please adapt.

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.

Check that CAPI versions are aligned

2 participants