forked from cilium/tetragon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: sadath-12 <[email protected]>
- Loading branch information
Showing
1 changed file
with
13 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,21 +3,26 @@ on: | |
pull_request: | ||
paths: | ||
- 'pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml' | ||
|
||
jobs: | ||
check-version: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 # you need this step to access the repository files | ||
- id: file_changes # use the File Changes Action | ||
uses: trilom/[email protected] | ||
with: | ||
output: ' ' # use space as the delimiter for output variables | ||
- name: Check for CRD changes and version update | ||
run: | | ||
changed_files=$(git diff --name-only ${{ github.base_ref }} ${{ github.head_ref }}) | ||
# use the modified files from the output variable | ||
if git diff --name-only $ { { steps.file_changes.outputs.files_modified }} | 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 echo "$changed_files" | grep -q 'pkg/k8s/apis/cilium.io/client/crds/v1alpha1/'; then | ||
if ! echo "$changed_files" | grep -q 'pkg/k8s/apis/cilium.io/v1alpha1/register.go'; then | ||
echo "Error: CRD files changed, but register.go not modified." | ||
if [ "$old_version" == "$new_version" ]; then | ||
echo "Error: CRD version not updated! Please update the CustomResourceDefinitionSchemaVersion in register.go" | ||
exit 1 | ||
fi | ||
else | ||
|