Skip to content

Commit 0ca75be

Browse files
authored
add NIC+WAFv5 tests (#6456)
1 parent 1b4b134 commit 0ca75be

20 files changed

+689
-10
lines changed

.github/actions/smoke-tests/action.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ inputs:
3131
azure-ad-secret:
3232
description: Azure Active Directory secret for JWKs
3333
required: false
34+
registry-token:
35+
description: JWT token for accessing container registry
36+
required: false
3437

3538
outputs:
3639
test-results-name:
@@ -76,13 +79,17 @@ runs:
7679
docker run --rm \
7780
--name test-runner-${{ github.run_id }} \
7881
--network=kind \
82+
-v "/var/run/docker.sock:/var/run/docker.sock" \
83+
-v ~/.docker:/root/.docker \
7984
-v ${{ github.workspace }}/tests:/workspace/tests \
8085
-v ${{ github.workspace }}/deployments:/workspace/deployments \
8186
-v ${{ github.workspace }}/charts:/workspace/charts \
8287
-v ${{ github.workspace }}/config:/workspace/config \
8388
-v ${{ github.workspace }}/pyproject.toml:/workspace/pyproject.toml \
8489
-v ${{ steps.k8s.outputs.test_output_path }}:${{ steps.k8s.outputs.test_output_path }} \
8590
-v ~/.kube/kind/config:/root/.kube/config ${{ inputs.test-image }} \
91+
--docker-registry-user=oauth2accesstoken \
92+
--docker-registry-token=${{ inputs.registry-token }} \
8693
--context=kind-${{ github.run_id }} \
8794
--image=${{ inputs.image-name }}:${{ inputs.tag }} \
8895
--image-pull-policy=Never \

.github/data/matrix-smoke-nap.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@
3232
"marker": "'appprotect_watch or appprotect_batch or appprotect_integration or appprotect_waf_policies_vsr'",
3333
"platforms": "linux/amd64"
3434
},
35+
{
36+
"label": "AP_WAF_V5 1/1",
37+
"image": "debian-plus-nap-v5",
38+
"type": "plus",
39+
"nap_modules": "waf",
40+
"marker": "appprotect_waf_v5",
41+
"platforms": "linux/amd64"
42+
},
3543
{
3644
"label": "AP_DOS 1/3",
3745
"image": "debian-plus-nap",

.github/workflows/build-test-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
context: "."
5656
cache-from: type=gha,scope=test-runner
5757
tags: |
58-
gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt') }}
58+
gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt', './tests/Dockerfile') }}
5959
gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:latest
6060
pull: true
6161
push: true

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ jobs:
548548
- name: Check if test image exists
549549
id: check-image
550550
run: |
551-
docker pull gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt') || 'latest' }}
551+
docker pull gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt', './tests/Dockerfile') || 'latest' }}
552552
shell: bash
553553
continue-on-error: true
554554
if: ${{ needs.checks.outputs.forked_workflow == 'false' && needs.checks.outputs.docs_only == 'false' }}
@@ -559,7 +559,7 @@ jobs:
559559
file: tests/Dockerfile
560560
context: "."
561561
cache-from: type=gha,scope=test-runner
562-
tags: "gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt') || 'latest' }}"
562+
tags: "gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt', './tests/Dockerfile') || 'latest' }}"
563563
pull: true
564564
push: ${{ needs.checks.outputs.forked_workflow == 'false' }}
565565
load: false

.github/workflows/regression.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ jobs:
271271
k8s-version: ${{ matrix.k8s }}
272272
label: ${{ matrix.images.label }}
273273
azure-ad-secret: ${{ secrets.AZURE_AD_AUTOMATION }}
274-
test-image: "gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt') || 'latest' }}"
274+
registry-token: ${{ steps.auth.outputs.access_token }}
275+
test-image: "gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt', './tests/Dockerfile') || 'latest' }}"
275276

276277
- name: Upload Test Results
277278
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0

.github/workflows/setup-smoke.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- name: Set image variables
5555
id: image_details
5656
run: |
57-
echo "name=gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic${{ contains(inputs.nap-modules, 'dos') && '-dos' || '' }}${{ contains(inputs.nap-modules, 'waf') && '-nap' || '' }}/nginx${{ contains(inputs.image, 'plus') && '-plus' || '' }}-ingress" >> $GITHUB_OUTPUT
57+
echo "name=gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic${{ contains(inputs.nap-modules, 'dos') && '-dos' || '' }}${{ contains(inputs.nap-modules, 'waf') && '-nap' || '' }}${{ contains(inputs.image, 'v5') && '-v5' || '' }}/nginx${{ contains(inputs.image, 'plus') && '-plus' || '' }}-ingress" >> $GITHUB_OUTPUT
5858
echo "build_tag=${{ inputs.build-tag }}${{ contains(inputs.image, 'ubi-9') && '-ubi' || '' }}${{ contains(inputs.image, 'ubi-8') && '-ubi8' || '' }}${{ contains(inputs.image, 'alpine') && '-alpine' || '' }}${{ contains(inputs.target, 'aws') && '-mktpl' || '' }}${{ contains(inputs.image, 'fips') && '-fips' || ''}}" >> $GITHUB_OUTPUT
5959
echo "stable_tag=${{ inputs.stable-tag }}${{ contains(inputs.image, 'ubi-9') && '-ubi' || '' }}${{ contains(inputs.image, 'ubi-8') && '-ubi8' || '' }}${{ contains(inputs.image, 'alpine') && '-alpine' || '' }}${{ contains(inputs.target, 'aws') && '-mktpl' || '' }}${{ contains(inputs.image, 'fips') && '-fips' || ''}}" >> $GITHUB_OUTPUT
6060
@@ -108,7 +108,7 @@ jobs:
108108
- name: Check if test image exists
109109
id: check-image
110110
run: |
111-
docker manifest inspect "gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt') || 'latest' }}"
111+
docker manifest inspect "gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt', './tests/Dockerfile') || 'latest' }}"
112112
shell: bash
113113
continue-on-error: true
114114
if: ${{ inputs.authenticated }}
@@ -119,7 +119,7 @@ jobs:
119119
file: tests/Dockerfile
120120
context: "."
121121
cache-from: type=gha,scope=test-runner
122-
tags: "gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt') || 'latest' }}"
122+
tags: "gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt', './tests/Dockerfile') || 'latest' }}"
123123
pull: true
124124
push: ${{ inputs.authenticated }}
125125
load: ${{ !inputs.authenticated }}
@@ -147,6 +147,11 @@ jobs:
147147
${{ contains(inputs.image, 'ubi') && format('"rhel_license={0}"', secrets.RHEL_LICENSE) || '' }}
148148
if: ${{ !inputs.authenticated }}
149149

150+
- name: Generate WAF v5 tgz from JSON
151+
run: |
152+
docker run --rm --user root -v /var/run/docker.sock:/var/run/docker.sock -v ${{ github.workspace }}/tests/data/ap-waf-v5:/data gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/nap/waf-compiler:5.2.0 -p /data/wafv5.json -o /data/wafv5.tgz
153+
if: ${{ contains(inputs.image, 'nap-v5')}}
154+
150155
- name: Run Smoke Tests
151156
id: smoke-tests
152157
uses: ./.github/actions/smoke-tests
@@ -158,7 +163,8 @@ jobs:
158163
label: ${{ inputs.label }}
159164
k8s-version: ${{ inputs.k8s-version }}
160165
azure-ad-secret: ${{ secrets.AZURE_AD_AUTOMATION }}
161-
test-image: "gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt') || 'latest' }}"
166+
registry-token: ${{ steps.auth.outputs.access_token }}
167+
test-image: "gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt', './tests/Dockerfile') || 'latest' }}"
162168
if: ${{ steps.stable_exists.outputs.exists != 'true' }}
163169

164170
- name: Upload Test Results

.github/workflows/single-image-regression.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,5 @@ jobs:
107107
label: "${{ inputs.image }} regression"
108108
k8s-version: ${{ inputs.k8s-version }}
109109
azure-ad-secret: ${{ secrets.AZURE_AD_AUTOMATION }}
110+
registry-token: ${{ steps.auth.outputs.access_token }}
110111
test-image: "gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ inputs.test-image-tag }}"

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ markers =[
3232
"appprotect_waf_policies_block",
3333
"appprotect_waf_policies_grpc",
3434
"appprotect_waf_policies_vsr",
35+
"appprotect_waf_v5",
3536
"appprotect_watch",
3637
"appprotect_batch",
3738
"basic_auth",

tests/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s
2323
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl \
2424
&& apt-get update && apt-get install -y apache2-utils
2525

26+
RUN apt update -y \
27+
&& curl https://get.docker.com/builds/Linux/x86_64/docker-latest.tgz | tar xvz -C /tmp/ && mv /tmp/docker/docker /usr/bin/docker
28+
2629
COPY --link tests /workspace/tests
2730

2831
COPY --link pyproject.toml /workspace/

tests/conftest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ def pytest_addoption(parser) -> None:
126126
default="1",
127127
help="Number of resources to deploy for upgrade tests",
128128
)
129+
parser.addoption(
130+
"--docker-registry-user",
131+
action="store",
132+
default="",
133+
help="Docker registry username",
134+
)
135+
parser.addoption(
136+
"--docker-registry-token",
137+
action="store",
138+
default="",
139+
help="Docker registry token",
140+
)
129141

130142

131143
# import fixtures into pytest global namespace

0 commit comments

Comments
 (0)