Skip to content

Commit

Permalink
Run tests for Plus images
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Nov 24, 2021
1 parent da80303 commit 0bdf2a0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
27 changes: 23 additions & 4 deletions .github/actions/smoke-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ inputs:
marker:
description: Marker to use
required: false
nginx-key:
description: Nginx key to use
required: false
nginx-crt:
description: Nginx cert to use
required: false

outputs:
test-results-name:
Expand All @@ -32,6 +38,16 @@ runs:
path: ${{ github.workspace }}/dist
key: nginx-ingress-${{ github.run_id }}-${{ github.run_number }}-single

- name: Ingress type
id: ingress-type
run: |
plus=""
if [[ ${{ inputs.image }} == *plus* ]]; then
plus="-plus"
fi
echo ::set-output name=name::nginx$plus-ingress
shell: bash

- name: Docker Buildx
uses: docker/setup-buildx-action@v1

Expand All @@ -43,10 +59,13 @@ runs:
cache-from: type=gha,scope=${{ inputs.image }}
cache-to: type=gha,scope=${{ inputs.image }},mode=max
target: goreleaser
tags: 'docker.io/nginx/nginx-ingress:${{ inputs.image }}-${{ github.sha }}'
tags: 'docker.io/nginx/${{ steps.ingress-type.outputs.name }}:${{ inputs.image }}-${{ github.sha }}'
load: true
pull: true
build-args: BUILD_OS=${{ inputs.image }}
secrets: |
"nginx-repo.crt=${{ inputs.nginx-crt }}"
"nginx-repo.key=${{ inputs.nginx-key }}"
- name: Build Test-Runner Container
uses: docker/build-push-action@v2
Expand All @@ -63,7 +82,7 @@ runs:
id: k8s
run: |
kind create cluster --name ${{ github.run_id }} --image=kindest/node:v${{ inputs.k8s-version }} --config ${{ github.workspace }}/tests/ci-files/ci-kind-config.yaml --kubeconfig kube-${{ github.run_id }} --wait ${{ inputs.k8s-timeout }}
kind load docker-image docker.io/nginx/nginx-ingress:${{ inputs.image }}-${{ github.sha }} --name ${{ github.run_id }}
kind load docker-image docker.io/nginx/${{ steps.ingress-type.outputs.name }}:${{ inputs.image }}-${{ github.sha }} --name ${{ github.run_id }}
echo ::set-output name=cluster_ip::$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${{ github.run_id }}-control-plane)
echo ::set-output name=cluster::$(echo nginx-${{ inputs.image }}-${{ inputs.marker != '' && inputs.marker || inputs.k8s-version }})
shell: bash
Expand All @@ -82,9 +101,9 @@ runs:
-v ${{ github.workspace }}/tests/tests-${{ steps.k8s.outputs.cluster }}.html:/workspace/tests/tests-${{ steps.k8s.outputs.cluster }}.html \
-v ${{ github.workspace }}/kube-${{ github.run_id }}:/root/.kube/config test-runner:${{ github.sha }} \
--context=kind-${{ github.run_id }} \
--image=docker.io/nginx/nginx-ingress:${{ inputs.image }}-${{ github.sha }} \
--image=docker.io/nginx/${{ steps.ingress-type.outputs.name }}:${{ inputs.image }}-${{ github.sha }} \
--image-pull-policy=Never \
--ic-type=nginx-ingress \
--ic-type=${{ steps.ingress-type.outputs.name }} \
--service=nodeport --node-ip=${{ steps.k8s.outputs.cluster_ip }} \
--html=tests-${{ steps.k8s.outputs.cluster }}.html \
--self-contained-html \
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ jobs:
{\"image\": \"alpine\", \"marker\":\"vsr\"}, \
{\"image\": \"alpine-opentracing\", \"marker\":\"policies\"}, \
{\"image\": \"opentracing\", \"marker\": \"vs\"}, \
{\"image\": \"ubi\", \"marker\": \"ts\"}]}"
{\"image\": \"ubi\", \"marker\": \"ts\"}, \
{\"image\": \"debian-plus\", \"marker\": \"vs\"}, \
{\"image\": \"alpine-plus\", \"marker\":\"ingresses\"}, \
{\"image\": \"opentracing-plus\", \"marker\": \"vsr\"}, \
{\"image\": \"ubi-plus\", \"marker\": \"policies\"}]}"
else
echo "::set-output name=matrix::{\"k8s\": [\"1.19.11\", \"1.20.7\", \"1.21.2\", \"1.22.2\"]}"
fi
Expand All @@ -172,6 +176,8 @@ jobs:
image: ${{ matrix.images.image != '' && matrix.images.image || 'debian' }}
marker: ${{ matrix.images.marker != '' && matrix.images.marker || '' }}
k8s-version: ${{ matrix.k8s != '' && matrix.k8s || env.K8S_VERSION }}
nginx-crt: ${{ secrets.NGINX_CRT }}
nginx-key: ${{ secrets.NGINX_KEY }}
- name: Upload Test Results
uses: actions/upload-artifact@v2
with:
Expand Down

0 comments on commit 0bdf2a0

Please sign in to comment.