From 050284dc84181f816dd6529a512b984d65f1f38f Mon Sep 17 00:00:00 2001 From: sadath-12 Date: Wed, 24 Jan 2024 14:17:58 +0530 Subject: [PATCH] d Signed-off-by: sadath-12 --- .github/workflows/validate-crd.yaml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/validate-crd.yaml b/.github/workflows/validate-crd.yaml index d48d63e751b..53d63fd4be1 100644 --- a/.github/workflows/validate-crd.yaml +++ b/.github/workflows/validate-crd.yaml @@ -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: | @@ -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" @@ -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 \ No newline at end of file