Skip to content

Commit

Permalink
add anp e2e in github ci
Browse files Browse the repository at this point in the history
Signed-off-by: 马洪贞 <[email protected]>
  • Loading branch information
hongzhen-ma committed Nov 6, 2024
1 parent 5734a27 commit 0c33f77
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 1 deletion.
149 changes: 149 additions & 0 deletions .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2836,6 +2836,154 @@ jobs:
if: ${{ success() || (failure() && (steps.install.conclusion == 'failure' || steps.kube-ovn-ipsec-e2e.conclusion == 'failure')) }}
run: make check-kube-ovn-pod-restarts

anp-banp-e2e:
name: AdminNetworkPolicy E2E
needs:
- build-kube-ovn
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: jlumbroso/[email protected]
with:
android: true
dotnet: true
haskell: true
docker-images: false
large-packages: false
tool-cache: false
swap-storage: false

- uses: actions/checkout@v4

- name: Create the default branch directory
if: (github.base_ref || github.ref_name) != github.event.repository.default_branch
run: mkdir -p test/e2e/source

- name: Check out the default branch
if: (github.base_ref || github.ref_name) != github.event.repository.default_branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
fetch-depth: 1
path: test/e2e/source

- name: Export E2E directory
run: |
if [ '${{ github.base_ref || github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then
echo "E2E_DIR=." >> "$GITHUB_ENV"
else
echo "E2E_DIR=test/e2e/source" >> "$GITHUB_ENV"
fi
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION || '' }}
go-version-file: ${{ env.E2E_DIR }}/go.mod
check-latest: true
cache: false

- name: Export Go full version
run: echo "GO_FULL_VER=$(go env GOVERSION)" >> "$GITHUB_ENV"

- name: Go cache
uses: actions/cache/restore@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-

- name: Install kind
uses: helm/[email protected]
with:
version: ${{ env.KIND_VERSION }}
install_only: true

- name: Install ginkgo
working-directory: ${{ env.E2E_DIR }}
run: go install -v -mod=mod github.com/onsi/ginkgo/v2/ginkgo

- name: Download kube-ovn image
uses: actions/download-artifact@v4
with:
name: kube-ovn

- name: Load images
run: |
docker load -i kube-ovn.tar
- name: Create kind cluster
run: |
pipx install jinjanator
make kind-init
- name: Install Kube-OVN
id: install
run: make kind-install-anp

- name: Run E2E
id: e2e
working-directory: ${{ env.E2E_DIR }}
env:
E2E_BRANCH: ${{ github.base_ref || github.ref_name }}
run: make kube-ovn-anp-e2e

- name: Collect k8s events
if: failure() && steps.e2e.conclusion == 'failure'
run: |
kubectl get events -A -o yaml > anp-e2e-events.yaml
tar zcf anp-e2e-events.tar.gz anp-e2e-events.yaml
- name: Upload k8s events
uses: actions/upload-artifact@v4
if: failure() && steps.e2e.conclusion == 'failure'
with:
name: anp-e2e-events
path: anp-e2e-events.tar.gz

- name: Collect apiserver audit logs
if: failure() && steps.e2e.conclusion == 'failure'
run: |
docker cp kube-ovn-control-plane:/var/log/kubernetes/kube-apiserver-audit.log .
tar zcf anp-e2e-audit-log.tar.gz kube-apiserver-audit.log
- name: Upload apiserver audit logs
uses: actions/upload-artifact@v4
if: failure() && steps.e2e.conclusion == 'failure'
with:
name: anp-e2e-audit-log
path: anp-e2e-audit-log.tar.gz

- name: kubectl ko log
if: failure() && steps.e2e.conclusion == 'failure'
run: |
make kubectl-ko-log
mv kubectl-ko-log.tar.gz anp-e2e-ko-log.tar.gz
- name: upload kubectl ko log
uses: actions/upload-artifact@v4
if: failure() && steps.e2e.conclusion == 'failure'
with:
name: anp-e2e-ko-log
path: anp-e2e-ko-log.tar.gz

- name: Collect anp test case execute report
if: failure() && steps.e2e.conclusion == 'failure'
run: |
tar zcf anp-e2e-report.tar.gz anp-test-report.yaml
- name: Upload anp report
uses: actions/upload-artifact@v4
if: failure() && steps.e2e.conclusion == 'failure'
with:
name: anp-e2e-report
path: anp-e2e-report.tar.gz

- name: Check kube ovn pod restarts
if: ${{ success() || (failure() && (steps.install.conclusion == 'failure' || steps.e2e.conclusion == 'failure')) }}
run: make check-kube-ovn-pod-restarts

push:
name: Push Images
needs:
Expand All @@ -2858,6 +3006,7 @@ jobs:
- cilium-chaining-e2e
- kube-ovn-ha-e2e
- kube-ovn-submariner-conformance-e2e
- anp-banp-e2e
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
runs-on: ubuntu-24.04
steps:
Expand Down
2 changes: 1 addition & 1 deletion test/anp/anp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestAdminNetworkPolicyConformance(t *testing.T) {
CleanupBaseResources: true,
SupportedFeatures: suite.CoreFeatures,
BaseManifests: baseManifests,
TimeoutConfig: netpolv1config.TimeoutConfig{GetTimeout: 300 * time.Second},
TimeoutConfig: netpolv1config.TimeoutConfig{GetTimeout: 300 * time.Second, RequestTimeout: 10 * time.Second},
},
ConformanceProfiles: profiles,
})
Expand Down

0 comments on commit 0c33f77

Please sign in to comment.