@@ -2,51 +2,32 @@ name: Run Smoke Tests
22description : Run Smoke Tests for the project
33
44inputs :
5- go-md5 :
6- required : true
7- type : string
8- base-image-md5 :
9- required : true
10- type : string
115 k8s-version :
126 description : Kubernetes version to use
137 required : false
148 k8s-timeout :
159 description : Timeout to use
1610 default : 75s
1711 required : false
18- image :
19- description : Docker image to use
20- default : debian
21- required : false
12+ image-type :
13+ description : Image type to test
14+ required : true
15+ image-name :
16+ description : Docker image name to test
17+ required : true
18+ tag :
19+ description : Docker image tag to test
20+ required : true
2221 test-image :
2322 description : Test Docker image to use
2423 default : gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:latest
2524 required : false
2625 marker :
2726 description : Marker to use
2827 required : false
29- nginx-key :
30- description : Nginx key to use
31- required : false
32- nginx-crt :
33- description : Nginx cert to use
34- required : false
3528 azure-ad-secret :
3629 description : Azure Active Directory secret for JWKs
3730 required : false
38- rhel-license :
39- description : RHEL license for UBI builds
40- required : false
41- gcr-workload-identity-secret :
42- description : Google Workflow Identity secret
43- required : false
44- gcr-service-account-secret :
45- description : Google Service Account secret
46- required : false
47- forked-workflow :
48- description : Does this workflow full access to repo resources?
49- required : false
5031
5132outputs :
5233 test-results-name :
@@ -56,90 +37,24 @@ outputs:
5637runs :
5738 using : composite
5839 steps :
59- - name : Fetch Cached Artifacts
60- uses : actions/cache@v3
61- with :
62- path : ${{ github.workspace }}/dist
63- key : nginx-ingress-${{ inputs.go-md5 }}
64-
65- - name : Ingress type
66- id : ingress-type
67- run : |
68- echo "name=nginx${{ contains(inputs.image, 'plus') && '-plus' || '' }}-ingress" >> $GITHUB_OUTPUT
69- echo "tag=${{ inputs.image }}${{ contains(inputs.marker, 'dos') && '-dos' || '' }}${{ contains(inputs.marker, 'appprotect') && '-nap' || '' }}-${{ github.sha }}" >> $GITHUB_OUTPUT
70- echo "modules=${{ contains(inputs.marker, 'appprotect') && 'waf' || '' }}${{ contains(inputs.marker, 'dos') && 'dos' || '' }}" >> $GITHUB_OUTPUT
71- shell : bash
72-
73- - name : Docker Buildx
74- uses : docker/setup-buildx-action@v2
75-
76- - name : Authenticate to Google Cloud
77- id : auth
78- uses : google-github-actions/auth@v2
79- with :
80- token_format : access_token
81- workload_identity_provider : ${{ inputs.gcr-workload-identity-secret }}
82- service_account : ${{ inputs.gcr-service-account-secret }}
83- if : ${{ inputs.forked-workflow == 'false' }}
84-
85- - name : Login to GCR
86- uses : docker/login-action@v3
87- with :
88- registry : gcr.io
89- username : oauth2accesstoken
90- password : ${{ steps.auth.outputs.access_token }}
91- if : ${{ inputs.forked-workflow == 'false' }}
92-
93- - name : Build ${{ inputs.image }} Container
94- uses : docker/build-push-action@v3
95- with :
96- file : build/Dockerfile
97- context : " ."
98- cache-from : type=gha,scope=${{ inputs.image }}${{ contains(inputs.marker, 'dos') && '-dos' || '' }}${{ contains(inputs.marker, 'appprotect') && '-nap' || '' }}
99- target : goreleaser${{ inputs.forked-workflow == 'false' && '-prebuilt' || '' }}
100- tags : " docker.io/nginx/${{ steps.ingress-type.outputs.name }}:${{ steps.ingress-type.outputs.tag }}"
101- load : true
102- pull : true
103- build-args : |
104- BUILD_OS=${{ inputs.image }}
105- PREBUILT_BASE_IMG=gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic-base/${{ contains(inputs.image, 'plus') && 'plus' || 'oss' }}:${{ inputs.base-image-md5 }}-${{ inputs.image }}${{ contains(inputs.marker, 'appprotect') && '-waf' || '' }}${{ contains(inputs.marker, 'dos') && '-dos' || '' }}
106- IC_VERSION=CI
107- ${{ steps.ingress-type.outputs.modules != '' && format('NAP_MODULES={0}', steps.ingress-type.outputs.modules) || '' }}
108- ${{ contains(inputs.marker, 'appprotect') && 'DEBIAN_VERSION=buster-slim' || '' }}
109- secrets : |
110- ${{ contains(inputs.image, 'plus') && format('"nginx-repo.crt={0}"', inputs.nginx-crt) || '' }}
111- ${{ contains(inputs.image, 'plus') && format('"nginx-repo.key={0}"', inputs.nginx-key) || '' }}
112- ${{ contains(inputs.image, 'ubi') && format('"rhel_license={0}"', inputs.rhel-license) || '' }}
113-
11440 - name : Deploy Kubernetes
11541 id : k8s
11642 run : |
11743 make -f tests/Makefile create-kind-cluster K8S_CLUSTER_NAME=${{ github.run_id }} K8S_CLUSTER_VERSION=${{ inputs.k8s-version }} K8S_TIMEOUT=${{ inputs.k8s-timeout }}
118- 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 }}
44+ make -f tests/Makefile image-load REGISTRY="" PREFIX=${{ inputs.image- name }} TAG=${{ inputs .tag }} K8S_CLUSTER_NAME=${{ github.run_id }}
11945 marker="${{ inputs.marker }}"
12046 nospaces="${marker// /_}"
12147 sanitized_marker="${nospaces//\'/}"
12248 name="${sanitized_marker:-${{ inputs.k8s-version }}}"
12349 echo "cluster_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${{ github.run_id }}-control-plane)" >> $GITHUB_OUTPUT
124- echo "cluster=$(echo nginx-${{ inputs.image }}-$name)" >> $GITHUB_OUTPUT
50+ echo "cluster=$(echo nginx-${{ inputs.image-type }}-$name)" >> $GITHUB_OUTPUT
12551 shell : bash
12652
12753 - name : Setup Kubeconfig
12854 run : |
12955 sed -i 's|server:.*|server: https://${{ steps.k8s.outputs.cluster_ip }}:6443|' ~/.kube/kind/config
13056 shell : bash
13157
132- - name : Build Test-Runner Container
133- uses : docker/build-push-action@v3
134- with :
135- file : tests/Dockerfile
136- context : " ."
137- cache-from : type=gha,scope=test-runner
138- tags : ${{ inputs.test-image }}
139- pull : true
140- load : true
141- if : ${{ inputs.forked-workflow == 'true' }}
142-
14358 - name : Run Smoke Tests
14459 run : |
14560 touch tests-${{ steps.k8s.outputs.cluster }}.html
14964 -v ${{ github.workspace }}/tests:/workspace/tests \
15065 -v ~/.kube/kind/config:/root/.kube/config ${{ inputs.test-image }} \
15166 --context=kind-${{ github.run_id }} \
152- --image=docker.io/nginx/ ${{ steps.ingress-type.outputs. name }}:${{ steps.ingress-type.outputs .tag }} \
67+ --image=${{ inputs.image- name }}:${{ inputs .tag }} \
15368 --image-pull-policy=Never \
154- --ic-type=${{ steps.ingress -type.outputs.name }} \
69+ --ic-type=nginx ${{ contains(inputs.image -type, 'plus') && '-plus' || '' }}-ingress \
15570 --service=nodeport --node-ip=${{ steps.k8s.outputs.cluster_ip }} \
15671 --html=tests-${{ steps.k8s.outputs.cluster }}.html \
15772 --self-contained-html \
0 commit comments