Postfix operator for matchBinaries selector #219
Workflow file for this run
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' | |
- 'pkg/k8s/apis/cilium.io/v1alpha1/version.go' | |
- '.github/workflows/validate-crd.yaml' | |
jobs: | |
check-version: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
with: | |
fetch-depth: 0 | |
- name: Check for CRD changes and version update | |
run: | | |
crd_changed=0 | |
version_changed=0 | |
# Check for CRD changes | |
crd_changes=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml) | |
if [ -n "$crd_changes" ]; then | |
crd_changed=1 | |
fi | |
# Check for version variable changes | |
old_version=$(git show ${{ github.event.pull_request.base.sha }}:pkg/k8s/apis/cilium.io/v1alpha1/version.go | sed -n 's/^const CustomResourceDefinitionSchemaVersion = "\(.*\)".*/\1/p') | |
new_version=$(sed -n 's/^const CustomResourceDefinitionSchemaVersion = "\(.*\)".*/\1/p' pkg/k8s/apis/cilium.io/v1alpha1/version.go) | |
echo "old_version=$old_version" | |
echo "new_version=$new_version" | |
if [ "$old_version" != "$new_version" ]; then | |
version_changed=1 | |
fi | |
if [ "$crd_changed" -eq 1 ] && [ "$version_changed" -eq 0 ]; then | |
echo "Changes to the files pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml requires CustomResourceDefinitionSchemaVersion to be updated in pkg/k8s/apis/cilium.io/v1alpha1/version.go" | |
exit 1 | |
fi | |
if [ "$crd_changed" -eq 0 ] && [ "$version_changed" -eq 1 ]; then | |
echo "CustomResourceDefinitionSchemaVersion in pkg/k8s/apis/cilium.io/v1alpha1/version.go to be updated only in case of modifying the files pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml" | |
exit 1 | |
fi |