Skip to content

Commit

Permalink
opt
Browse files Browse the repository at this point in the history
Signed-off-by: sadath-12 <[email protected]>
  • Loading branch information
sadath-12 committed Dec 27, 2023
1 parent 3605577 commit cc8ee68
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/validate-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@ 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 git diff --name-only HEAD^ | grep -q 'pkg/k8s/apis/cilium.io/v1alpha1/register.go'; then
old_version=$(grep 'CustomResourceDefinitionSchemaVersion' tetragon/pkg/k8s/apis/cilium.io/v1alpha1/register.go | awk -F'"' '{print $2}')
new_version=$(grep 'CustomResourceDefinitionSchemaVersion' tetragon/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"
if [ "$old_version" == "$new_version" ]; then
echo "Error: CRD version not updated! Please update the CustomResourceDefinitionSchemaVersion in register.go"
exit 1
fi
else
echo "Error: CRD files changed, but register.go not modified."
exit 1
fi
else
Expand Down

0 comments on commit cc8ee68

Please sign in to comment.