Skip to content

Commit c3d24c4

Browse files
authored
Test all images (#1533)
* Test on all images * Update nightly to test all images * Run all test markers on debian plus also * Update .github/workflows/nightly.yml
1 parent 00d9097 commit c3d24c4

File tree

2 files changed

+92
-22
lines changed

2 files changed

+92
-22
lines changed

.github/workflows/edge.yml

Lines changed: 70 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,60 +100,71 @@ jobs:
100100
matrix:
101101
include:
102102
- os: ubuntu-20.04
103-
image: nginx-ingress
103+
image: debian
104104
tag: ${{ github.sha }}
105105
marker: 'ingresses'
106106
type: oss
107+
ic-type: nginx-ingress
107108
- os: ubuntu-20.04
108-
image: nginx-ingress
109+
image: alpine
109110
tag: ${{ github.sha }}
110111
marker: 'vsr'
111112
type: oss
113+
ic-type: nginx-ingress
112114
- os: ubuntu-20.04
113-
image: nginx-ingress
115+
image: opentracing
114116
tag: ${{ github.sha }}
115117
marker: 'vs'
116118
type: oss
119+
ic-type: nginx-ingress
117120
- os: ubuntu-20.04
118-
image: nginx-ingress
121+
image: openshift
119122
tag: ${{ github.sha }}
120123
marker: 'ts'
121124
type: oss
125+
ic-type: nginx-ingress
122126
- os: ubuntu-20.04
123-
image: nginx-ingress
127+
image: debian
124128
tag: ${{ github.sha }}
125129
marker: 'policies'
126130
type: oss
131+
ic-type: nginx-ingress
127132
- os: ubuntu-20.04
128-
image: nginx-plus-ingress
133+
image: openshift-plus
129134
tag: ${{ github.sha }}
130135
marker: 'ingresses'
131136
type: plus
137+
ic-type: nginx-plus-ingress
132138
- os: ubuntu-20.04
133-
image: nginx-plus-ingress
139+
image: debian-plus
134140
tag: ${{ github.sha }}
135141
marker: 'vsr'
136142
type: plus
143+
ic-type: nginx-plus-ingress
137144
- os: ubuntu-20.04
138-
image: nginx-plus-ingress
145+
image: debian-plus
139146
tag: ${{ github.sha }}
140147
marker: 'vs'
141148
type: plus
149+
ic-type: nginx-plus-ingress
142150
- os: ubuntu-20.04
143-
image: nginx-plus-ingress
151+
image: opentracing-plus
144152
tag: ${{ github.sha }}
145153
marker: 'ts'
146154
type: plus
155+
ic-type: nginx-plus-ingress
147156
- os: ubuntu-20.04
148-
image: nginx-plus-ingress
157+
image: debian-plus
149158
tag: ${{ github.sha }}
150159
marker: 'policies'
151160
type: plus
161+
ic-type: nginx-plus-ingress
152162
- os: ubuntu-20.04
153-
image: nginx-plus-ingress
163+
image: debian-plus-ap
154164
tag: ${{ github.sha }}-ap
155165
marker: 'appprotect'
156166
type: plus-ap
167+
ic-type: nginx-plus-ingress
157168
steps:
158169
- name: Checkout Repository
159170
uses: actions/checkout@v2
@@ -184,7 +195,7 @@ jobs:
184195
tags: ${{ matrix.image }}:${{ matrix.tag }}
185196
load: true
186197
build-args: |
187-
BUILD_OS=debian
198+
BUILD_OS=${{ matrix.image }}
188199
if: matrix.type == 'oss'
189200
- name: Build Plus Docker Image ${{ matrix.image }}
190201
uses: docker/build-push-action@v2
@@ -200,24 +211,23 @@ jobs:
200211
"nginx-repo.crt=${{ secrets.KIC_NGINX_CRT }}"
201212
"nginx-repo.key=${{ secrets.KIC_NGINX_KEY }}"
202213
build-args: |
203-
BUILD_OS=debian-plus
214+
BUILD_OS=${{ matrix.image }}
204215
PLUS=-plus
205216
if: matrix.type == 'plus'
206217
- name: Build AP Docker Image ${{ matrix.image }}
207218
uses: docker/build-push-action@v2
208219
with:
209220
file: build/Dockerfile
210221
context: '.'
211-
cache-from: type=local,src=/tmp/.buildx-cache
212-
cache-to: type=local,dest=/tmp/.buildx-cache
213222
target: local
214223
tags: ${{ matrix.image }}:${{ matrix.tag }}
215224
load: true
216225
secrets: |
217226
"nginx-repo.crt=${{ secrets.KIC_NGINX_AP_CRT }}"
218227
"nginx-repo.key=${{ secrets.KIC_NGINX_AP_KEY }}"
228+
"rhel_license=${{ secrets.KIC_RHEL_LICENSE }}"
219229
build-args: |
220-
BUILD_OS=debian-plus-ap
230+
BUILD_OS=${{ matrix.image }}
221231
PLUS=-plus
222232
if: matrix.type == 'plus-ap'
223233
- name: Build Test-Runner Container
@@ -244,7 +254,7 @@ jobs:
244254
kind create cluster --name ${{ github.run_id }} --image=kindest/node:v${{ env.K8S_VERSION }} --config kind-config.yaml --kubeconfig kube-${{ github.run_id }} --wait ${{ env.K8S_TIMEOUT }}
245255
kind load docker-image ${{ matrix.image }}:${{ matrix.tag }} --name ${{ github.run_id }}
246256
echo ::set-output name=cluster_ip::$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${{ github.run_id }}-control-plane)
247-
echo ::set-output name=cluster::$(echo 'nginx-${{ matrix.type }}-${{ matrix.marker }}')
257+
echo ::set-output name=cluster::$(echo 'nginx-${{ matrix.image }}-${{ matrix.marker }}')
248258
- name: Setup Kubeconfig
249259
run: |
250260
sed -i 's|server:.*|server: https://${{ steps.k8s.outputs.cluster_ip }}:6443|' kube-${{ github.run_id }}
@@ -259,7 +269,7 @@ jobs:
259269
--context=kind-${{ github.run_id }} \
260270
--image=${{ matrix.image }}:${{ matrix.tag }} \
261271
--image-pull-policy=Never \
262-
--ic-type=${{ matrix.image }} \
272+
--ic-type=${{ matrix.ic-type }} \
263273
--service=nodeport --node-ip=${{ steps.k8s.outputs.cluster_ip }} \
264274
--html=tests-${{ steps.k8s.outputs.cluster }}.html \
265275
--self-contained-html \
@@ -273,6 +283,48 @@ jobs:
273283
path: ${{ github.workspace }}/tests/tests-${{ steps.k8s.outputs.cluster }}.html
274284
if: always()
275285

286+
build:
287+
name: Build Docker Images
288+
runs-on: ubuntu-20.04
289+
needs: [binary, unit-tests]
290+
if:
291+
github.event.pull_request.head.repo.full_name == 'nginxinc/kubernetes-ingress' ||
292+
github.event_name == 'push'
293+
steps:
294+
- name: Checkout Repository
295+
uses: actions/checkout@v2
296+
- name: Fetch Cached Artifacts
297+
uses: actions/[email protected]
298+
with:
299+
path: ${{ github.workspace }}/nginx-ingress
300+
key: nginx-ingress-${{ github.run_id }}-${{ github.run_number }}
301+
- name: Docker Buildx
302+
uses: docker/setup-buildx-action@v1
303+
with:
304+
driver-opts: network=host
305+
- name: Cache Docker layers
306+
uses: actions/[email protected]
307+
with:
308+
path: /tmp/.buildx-cache
309+
key: ${{ runner.os }}-buildx-${{ github.sha }}
310+
restore-keys: |
311+
${{ runner.os }}-buildx-
312+
- name: Build AP Docker Image ${{ matrix.image }}
313+
uses: docker/build-push-action@v2
314+
with:
315+
file: build/DockerfileWithAppProtectForPlusForOpenShift
316+
context: '.'
317+
cache-from: type=local,src=/tmp/.buildx-cache
318+
cache-to: type=local,dest=/tmp/.buildx-cache
319+
target: local
320+
tags: nginx-plus-ingress-ap-openshift:${{ github.sha }}
321+
secrets: |
322+
"nginx-repo.crt=${{ secrets.KIC_NGINX_AP_CRT }}"
323+
"nginx-repo.key=${{ secrets.KIC_NGINX_AP_KEY }}"
324+
"rhel_license=${{ secrets.KIC_RHEL_LICENSE }}"
325+
build-args: |
326+
PLUS=-plus
327+
276328
helm-tests:
277329
name: Helm Tests
278330
runs-on: ${{ matrix.os }}

.github/workflows/nightly.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,24 @@ jobs:
178178
key: ${{ runner.os }}-buildx-${{ github.sha }}
179179
restore-keys: |
180180
${{ runner.os }}-buildx-
181+
- name: Determine which image to build
182+
run: |
183+
DOW=$(date +%u)
184+
if [ ${TYPE} == "oss" ]; then
185+
[[ $DOW -lt 5 ]] && build_os="debian"
186+
[[ $DOW -eq 5 ]] && build_os="openshift"
187+
[[ $DOW -eq 6 ]] && build_os="alpine"
188+
[[ $DOW -eq 7 ]] && build_os="opentracing"
189+
elif [ ${TYPE} == "plus" ]; then
190+
[[ $DOW -lt 6 ]] && build_os="debian-plus"
191+
[[ $DOW -eq 6 ]] && build_os="opentracing-plus"
192+
[[ $DOW -eq 7 ]] && build_os="openshift-plus"
193+
elif [ ${TYPE} == "plus-ap" ]; then
194+
[[ $DOW -lt 5 || $DOW -eq 7 ]] && read -r build_os build_dockerfile <<< "debian-plus-ap build/Dockerfile"
195+
[[ $DOW -eq 6 ]] && build_dockerfile="build/DockerfileWithAppProtectForPlusForOpenShift"
196+
fi
197+
echo "BUILD_OS=${build_os}" >> $GITHUB_ENV
198+
echo "BUILD_DOCKERFILE=${build_dockerfile}" >> $GITHUB_ENV
181199
- name: Build ${{ matrix.image }} Container
182200
uses: docker/build-push-action@v2
183201
with:
@@ -189,7 +207,7 @@ jobs:
189207
tags: ${{ matrix.image }}:${{ matrix.tag }}
190208
load: true
191209
build-args: |
192-
BUILD_OS=debian
210+
BUILD_OS=${BUILD_OS}
193211
if: matrix.type == 'oss'
194212
- name: Build Plus Docker Image ${{ matrix.image }}
195213
uses: docker/build-push-action@v2
@@ -205,13 +223,13 @@ jobs:
205223
"nginx-repo.crt=${{ secrets.KIC_NGINX_CRT }}"
206224
"nginx-repo.key=${{ secrets.KIC_NGINX_KEY }}"
207225
build-args: |
208-
BUILD_OS=debian-plus
226+
BUILD_OS=${BUILD_OS}
209227
PLUS=-plus
210228
if: matrix.type == 'plus'
211229
- name: Build AP Docker Image ${{ matrix.image }}
212230
uses: docker/build-push-action@v2
213231
with:
214-
file: build/Dockerfile
232+
file: ${BUILD_DOCKERFILE}
215233
context: '.'
216234
cache-from: type=local,src=/tmp/.buildx-cache
217235
cache-to: type=local,dest=/tmp/.buildx-cache
@@ -222,7 +240,7 @@ jobs:
222240
"nginx-repo.crt=${{ secrets.KIC_NGINX_AP_CRT }}"
223241
"nginx-repo.key=${{ secrets.KIC_NGINX_AP_KEY }}"
224242
build-args: |
225-
BUILD_OS=debian-plus-ap
243+
BUILD_OS=${BUILD_OS}
226244
PLUS=-plus
227245
if: matrix.type == 'plus-ap'
228246
- name: Build Test-Runner Container

0 commit comments

Comments
 (0)