Skip to content

Commit

Permalink
d
Browse files Browse the repository at this point in the history
Signed-off-by: sadath-12 <[email protected]>
  • Loading branch information
sadath-12 committed Jan 24, 2024
1 parent a3a8c63 commit 050284d
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions .github/workflows/validate-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ on:
pull_request:
paths:
- 'pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml'
- 'pkg/k8s/apis/cilium.io/v1alpha1/register.go'
- 'pkg/k8s/apis/cilium.io/v1alpha1/version.go'

jobs:
check-version:
runs-on: ubuntu-22.04
steps:
- name: Install git
run: |
apt-get update
apt-get install -y git
- uses: actions/checkout@v3
- name: Check for CRD changes and version update
run: |
Expand All @@ -28,8 +24,8 @@ jobs:
# Check for version variable changes
old_version=$(git show ${{ github.event.pull_request.base.sha }}:pkg/k8s/apis/cilium.io/v1alpha1/register.go | grep 'CustomResourceDefinitionSchemaVersion' | awk -F'"' '{print $2}')
new_version=$(git show HEAD:pkg/k8s/apis/cilium.io/v1alpha1/register.go | grep 'CustomResourceDefinitionSchemaVersion' | awk -F'"' '{print $2}')
old_version=$(git show ${{ github.event.pull_request.base.sha }}:pkg/k8s/apis/cilium.io/v1alpha1/version.go | grep 'CustomResourceDefinitionSchemaVersion' | awk -F'"' '{print $2}')
new_version=$(git show HEAD:pkg/k8s/apis/cilium.io/v1alpha1/version.go | grep 'CustomResourceDefinitionSchemaVersion' | awk -F'"' '{print $2}')
echo "old_version=$old_version"
echo "new_version=$new_version"
Expand All @@ -39,14 +35,11 @@ jobs:
fi
if [ "$crd_changed" -eq 1 ] && [ "$version_changed" -eq 0 ]; then
echo "CRD changed but version not updated"
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 "Version updated but CRD not changed"
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
echo "crd_changed=$crd_changed"
echo "version_changed=$version_changed"
fi

0 comments on commit 050284d

Please sign in to comment.