Skip to content

Commit

Permalink
Merge pull request #1 from sadath-12/test-dev-2
Browse files Browse the repository at this point in the history
changecrd
  • Loading branch information
sadath-12 authored Jan 10, 2024
2 parents 58acf63 + aed1c1e commit a3a8c63
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/validate-crd.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
name: Check CRD Version Update
name: Check CRD version update

on:
pull_request:
paths:
- 'pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml'
- 'pkg/k8s/apis/cilium.io/v1alpha1/register.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
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

- name: Get all changed files
id: changed-files
uses: jitterbit/get-changed-files@v1

- name: Check for CRD changes and version update
run: |
crd_changed=0
version_changed=0
for changed_file in ${{ steps.changed-files.outputs.all }}; do
if echo "$changed_file" | grep -q 'pkg/k8s/apis/cilium.io/client/crds/v1alpha1/'; then
crd_changed=1
fi
if echo "$changed_file" | grep -q 'pkg/k8s/apis/cilium.io/v1alpha1/register.go'; then
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=$(grep 'CustomResourceDefinitionSchemaVersion' $changed_file | awk -F'"' '{print $2}')
echo "old_version=$old_version"
echo "new_version=$new_version"
if [ "$old_version" != "$new_version" ]; then
version_changed=1
fi
fi
done
# Check for CRD changes
crd_changes=$(git diff --name-only ${{ github.base_ref }} ${{ github.head_ref }} -- 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/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}')
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 "CRD changed but version not updated"
Expand Down
1 change: 0 additions & 1 deletion pkg/eventcache/eventcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ func (ec *Cache) handleEvents() {
// If the process wasn't found before the Add(), likely because
// the execve event was processed after this event, lets look it up
// now because it should be available. Otherwise we have a valid
// process and lets copy it across.
if event.internal == nil {
event.internal, err = event.msg.RetryInternal(event.event, event.startTime)
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/k8s/apis/cilium.io/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const (
// TPCRDName is the full name of the TracingPolicy CRD.
TPCRDName = TPKindDefinition + "/" + CRDVersion

CustomResourceDefinitionSchemaVersion = "0.10.1"
CustomResourceDefinitionSchemaVersion = "0.10.7"


// TPNamespacedCRDName is the full name of the TracingPolicy CRD.
TPNamespacedCRDName = TPNamespacedKindDefinition + "/" + CRDVersion
Expand Down

0 comments on commit a3a8c63

Please sign in to comment.