Skip to content

Commit

Permalink
load test matrix from json file (#4795)
Browse files Browse the repository at this point in the history
* load test matrix from json file
  • Loading branch information
pdabelf5 authored Jan 2, 2024
1 parent be56efb commit ac196d0
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 35 deletions.
3 changes: 2 additions & 1 deletion .github/actions/smoke-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ runs:
make -f tests/Makefile create-kind-cluster K8S_CLUSTER_NAME=${{ github.run_id }} K8S_CLUSTER_VERSION=${{ inputs.k8s-version }} K8S_TIMEOUT=${{ inputs.k8s-timeout }}
make -f tests/Makefile image-load PREFIX=nginx/${{ steps.ingress-type.outputs.name }} TAG=${{ steps.ingress-type.outputs.tag }} K8S_CLUSTER_NAME=${{ github.run_id }}
marker="${{ inputs.marker }}"
sanitized_marker="${marker// /_}"
nospaces="${marker// /_}"
sanitized_marker="${nospaces//\'/}"
name="${sanitized_marker:-${{ inputs.k8s-version }}}"
echo "cluster_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${{ github.run_id }}-control-plane)" >> $GITHUB_OUTPUT
echo "cluster=$(echo nginx-${{ inputs.image }}-$name)" >> $GITHUB_OUTPUT
Expand Down
11 changes: 11 additions & 0 deletions .github/data/matrix-regression.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"k8s": [],
"images": [
{
"image": "debian"
},
{
"image": "debian-plus"
}
]
}
93 changes: 93 additions & 0 deletions .github/data/matrix-smoke.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"images": [
{
"image": "debian",
"marker": "ingresses"
},
{
"image": "alpine",
"marker": "vsr"
},
{
"image": "alpine",
"marker": "'policies and not policies_rl and not policies_ac and not policies_jwt and not policies_mtls'"
},
{
"image": "alpine",
"marker": "'policies_rl or policies_ac or policies_jwt or policies_mtls'"
},
{
"image": "debian",
"marker": "'vs and not vs_ipv6 and not vs_rewrite and not vs_responses and not vs_grpc and not vs_redirects and not vs_externalname and not vs_externaldns and not vs_certmanager'"
},
{
"image": "debian",
"marker": "'vs_grpc or vs_redirects or vs_externalname or vs_externaldns'"
},
{
"image": "debian",
"marker": "'vs_responses or vs_ipv6 or vs_rewrite or vs_certmanager'"
},
{
"image": "ubi",
"marker": "ts"
},
{
"image": "debian-plus",
"marker": "'vs and not vs_ipv6 and not vs_rewrite and not vs_responses and not vs_grpc and not vs_redirects and not vs_externalname and not vs_externaldns and not vs_certmanager'"
},
{
"image": "debian-plus",
"marker": "'vs_grpc or vs_redirects or vs_externalname or vs_externaldns'"
},
{
"image": "debian-plus",
"marker": "'vs_responses or vs_ipv6 or vs_rewrite or vs_certmanager'"
},
{
"image": "debian-plus",
"marker": "ts"
},
{
"image": "alpine-plus",
"marker": "ingresses"
},
{
"image": "alpine-plus",
"marker": "vsr"
},
{
"image": "ubi-plus",
"marker": "'policies and not policies_ac and not policies_jwt and not policies_mtls'"
},
{
"image": "ubi-plus",
"marker": "'policies_ac or policies_jwt or policies_mtls'"
},
{
"image": "debian-plus-nap",
"marker": "appprotect_waf_policies_allow"
},
{
"image": "debian-plus-nap",
"marker": "'appprotect_waf_policies and not appprotect_waf_policies_allow'"
},
{
"image": "debian-plus-nap",
"marker": "appprotect_waf_policies_grpc"
},
{
"image": "debian-plus-nap",
"marker": "'appprotect_watch or appprotect_batch or appprotect_integration'"
},
{
"image": "debian-plus-nap",
"marker": "'dos and not dos_learning'"
},
{
"image": "debian-plus-nap",
"marker": "dos_learning"
}
],
"k8s": []
}
43 changes: 9 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ jobs:
| head -n 7 \
| sort -V \
| sed 's/v//g' \
| sed 's/^/\\\"/' \
| sed 's/$/\\\",/' \
| tr '\n' ' ' \
| sed 's/, $//')
| sed 's/$//' \
| sed 's/, $//' \
| jq -R -s -c 'split("\n")[:-1]')
echo "latest_kindest_node_versions=$kindest_versions" >> $GITHUB_OUTPUT
- name: Check if go.mod and go.sum are up to date
Expand Down Expand Up @@ -273,41 +272,17 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- id: set-matrix
run: |
if [ "${{ github.event_name }}" != "schedule" ]; then
echo "matrix={\"images\": \
[{\"image\": \"debian\", \"marker\": \"ingresses\"}, \
{\"image\": \"alpine\", \"marker\":\"vsr\"}, \
{\"image\": \"alpine\", \"marker\":\"'policies and not policies_rl and not policies_ac and not policies_jwt and not policies_mtls'\"}, \
{\"image\": \"alpine\", \"marker\":\"'policies_rl or policies_ac or policies_jwt or policies_mtls'\"}, \
{\"image\": \"debian\", \"marker\": \"'vs and not vs_ipv6 and not vs_rewrite and not vs_responses and not vs_grpc and not vs_redirects and not vs_externalname and not vs_externaldns and not vs_certmanager'\"}, \
{\"image\": \"debian\", \"marker\": \"'vs_grpc or vs_redirects or vs_externalname or vs_externaldns'\"}, \
{\"image\": \"debian\", \"marker\": \"'vs_responses or vs_ipv6 or vs_rewrite or vs_certmanager'\"}, \
{\"image\": \"ubi\", \"marker\": \"ts\"}, \
{\"image\": \"debian-plus\", \"marker\": \"'vs and not vs_ipv6 and not vs_rewrite and not vs_responses and not vs_grpc and not vs_redirects and not vs_externalname and not vs_externaldns and not vs_certmanager'\"}, \
{\"image\": \"debian-plus\", \"marker\": \"'vs_grpc or vs_redirects or vs_externalname or vs_externaldns'\"}, \
{\"image\": \"debian-plus\", \"marker\": \"'vs_responses or vs_ipv6 or vs_rewrite or vs_certmanager'\"}, \
{\"image\": \"debian-plus\", \"marker\": \"ts\"}, \
{\"image\": \"alpine-plus\", \"marker\":\"ingresses\"}, \
{\"image\": \"alpine-plus\", \"marker\": \"vsr\"}, \
{\"image\": \"ubi-plus\", \"marker\":\"'policies and not policies_ac and not policies_jwt and not policies_mtls'\"}, \
{\"image\": \"ubi-plus\", \"marker\":\"'policies_ac or policies_jwt or policies_mtls'\"}, \
{\"image\": \"debian-plus-nap\", \"marker\": \"appprotect_waf_policies_allow\"}, \
{\"image\": \"debian-plus-nap\", \"marker\": \"'appprotect_waf_policies and not appprotect_waf_policies_allow'\"}, \
{\"image\": \"debian-plus-nap\", \"marker\": \"appprotect_waf_policies_grpc\"}, \
{\"image\": \"debian-plus-nap\", \"marker\": \"'appprotect_watch or appprotect_batch or appprotect_integration'\"}, \
{\"image\": \"debian-plus-nap\", \"marker\": \"'dos and not dos_learning'\"}, \
{\"image\": \"debian-plus-nap\", \"marker\": \"dos_learning\"}], \
\"k8s\": [\"${{ needs.checks.outputs.k8s_latest }}\"]}" >> $GITHUB_OUTPUT
if [ "${{ github.event_name }}" == "schedule" ]; then
echo "matrix=$(cat .github/data/matrix-regression.json | jq -c --argjson latest '${{ needs.checks.outputs.latest_kindest_node_versions }}' '.k8s += $latest')" >> $GITHUB_OUTPUT
else
echo "matrix={\"k8s\": [${{ needs.checks.outputs.latest_kindest_node_versions }}], \
\"images\": [{\"image\": \"debian\"}, {\"image\": \"debian-plus\"}]}" >> $GITHUB_OUTPUT
echo "matrix=$(cat .github/data/matrix-smoke.json | jq -c --arg latest "${{ needs.checks.outputs.k8s_latest }}" '.k8s += [$latest]')" >> $GITHUB_OUTPUT
fi
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

Expand Down

0 comments on commit ac196d0

Please sign in to comment.