changecrd #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check CRD Version Update | |
on: | |
pull_request: | |
paths: | |
- 'pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml' | |
jobs: | |
check-version: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check for CRD changes and version update | |
run: | | |
if git diff --name-only HEAD^ | grep -q 'pkg/k8s/apis/cilium.io/client/crds/v1alpha1/'; then | |
old_version=$(grep 'CustomResourceDefinitionSchemaVersion' pkg/k8s/apis/cilium.io/v1alpha1/register.go | awk -F'"' '{print $2}') | |
new_version=$(grep 'CustomResourceDefinitionSchemaVersion' pkg/k8s/apis/cilium.io/v1alpha1/register.go | awk -F'"' '{print $2}') | |
if [ "$old_version" == "$new_version" ]; then | |
echo "Error: CRD version not updated! Please update the CustomResourceDefinitionSchemaVersion in register.go" | |
exit 1 | |
fi | |
else | |
echo "No changes in the CRD files" | |
fi |