Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test all images #1533

Merged
merged 4 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 70 additions & 18 deletions .github/workflows/edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,60 +100,71 @@ jobs:
matrix:
include:
- os: ubuntu-20.04
image: nginx-ingress
image: debian
Copy link
Contributor

@vepatel vepatel Apr 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ciarams87 there's an issue with re to test markers, acc. to this only 'ingresses' tests will run on debian and only 'vsr' tests will run on alpine and so on. I think existing matrix will be needed to multiplied by types of images so all markers run on each platform for both oss and plus.
Nightly will be multiplied too but since there are no markers in there, it'll be platform x k8s versions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline, we have to make a trade-off on edge because the matrix of jobs would get too large. I'll add two more jobs so that we are testing everything on Debian Plus image, as agreed.

tag: ${{ github.sha }}
marker: 'ingresses'
type: oss
ic-type: nginx-ingress
- os: ubuntu-20.04
image: nginx-ingress
image: alpine
tag: ${{ github.sha }}
marker: 'vsr'
type: oss
ic-type: nginx-ingress
- os: ubuntu-20.04
image: nginx-ingress
image: opentracing
tag: ${{ github.sha }}
marker: 'vs'
type: oss
ic-type: nginx-ingress
- os: ubuntu-20.04
image: nginx-ingress
image: openshift
tag: ${{ github.sha }}
marker: 'ts'
type: oss
ic-type: nginx-ingress
- os: ubuntu-20.04
image: nginx-ingress
image: debian
tag: ${{ github.sha }}
marker: 'policies'
type: oss
ic-type: nginx-ingress
- os: ubuntu-20.04
image: nginx-plus-ingress
image: openshift-plus
tag: ${{ github.sha }}
marker: 'ingresses'
type: plus
ic-type: nginx-plus-ingress
- os: ubuntu-20.04
image: nginx-plus-ingress
image: debian-plus
tag: ${{ github.sha }}
marker: 'vsr'
type: plus
ic-type: nginx-plus-ingress
- os: ubuntu-20.04
image: nginx-plus-ingress
image: debian-plus
tag: ${{ github.sha }}
marker: 'vs'
type: plus
ic-type: nginx-plus-ingress
- os: ubuntu-20.04
image: nginx-plus-ingress
image: opentracing-plus
tag: ${{ github.sha }}
marker: 'ts'
type: plus
ic-type: nginx-plus-ingress
- os: ubuntu-20.04
image: nginx-plus-ingress
image: debian-plus
tag: ${{ github.sha }}
marker: 'policies'
type: plus
ic-type: nginx-plus-ingress
- os: ubuntu-20.04
image: nginx-plus-ingress
image: debian-plus-ap
tag: ${{ github.sha }}-ap
marker: 'appprotect'
type: plus-ap
ic-type: nginx-plus-ingress
steps:
- name: Checkout Repository
uses: actions/checkout@v2
Expand Down Expand Up @@ -184,7 +195,7 @@ jobs:
tags: ${{ matrix.image }}:${{ matrix.tag }}
load: true
build-args: |
BUILD_OS=debian
BUILD_OS=${{ matrix.image }}
if: matrix.type == 'oss'
- name: Build Plus Docker Image ${{ matrix.image }}
uses: docker/build-push-action@v2
Expand All @@ -200,24 +211,23 @@ jobs:
"nginx-repo.crt=${{ secrets.KIC_NGINX_CRT }}"
"nginx-repo.key=${{ secrets.KIC_NGINX_KEY }}"
build-args: |
BUILD_OS=debian-plus
BUILD_OS=${{ matrix.image }}
PLUS=-plus
if: matrix.type == 'plus'
- name: Build AP Docker Image ${{ matrix.image }}
uses: docker/build-push-action@v2
with:
file: build/Dockerfile
context: '.'
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
target: local
tags: ${{ matrix.image }}:${{ matrix.tag }}
load: true
secrets: |
"nginx-repo.crt=${{ secrets.KIC_NGINX_AP_CRT }}"
"nginx-repo.key=${{ secrets.KIC_NGINX_AP_KEY }}"
"rhel_license=${{ secrets.KIC_RHEL_LICENSE }}"
build-args: |
BUILD_OS=debian-plus-ap
BUILD_OS=${{ matrix.image }}
PLUS=-plus
if: matrix.type == 'plus-ap'
- name: Build Test-Runner Container
Expand All @@ -244,7 +254,7 @@ jobs:
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 }}
kind load docker-image ${{ matrix.image }}:${{ matrix.tag }} --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-${{ matrix.type }}-${{ matrix.marker }}')
echo ::set-output name=cluster::$(echo 'nginx-${{ matrix.image }}-${{ matrix.marker }}')
- name: Setup Kubeconfig
run: |
sed -i 's|server:.*|server: https://${{ steps.k8s.outputs.cluster_ip }}:6443|' kube-${{ github.run_id }}
Expand All @@ -259,7 +269,7 @@ jobs:
--context=kind-${{ github.run_id }} \
--image=${{ matrix.image }}:${{ matrix.tag }} \
--image-pull-policy=Never \
--ic-type=${{ matrix.image }} \
--ic-type=${{ matrix.ic-type }} \
--service=nodeport --node-ip=${{ steps.k8s.outputs.cluster_ip }} \
--html=tests-${{ steps.k8s.outputs.cluster }}.html \
--self-contained-html \
Expand All @@ -273,6 +283,48 @@ jobs:
path: ${{ github.workspace }}/tests/tests-${{ steps.k8s.outputs.cluster }}.html
if: always()

build:
name: Build Docker Images
runs-on: ubuntu-20.04
needs: [binary, unit-tests]
if:
github.event.pull_request.head.repo.full_name == 'nginxinc/kubernetes-ingress' ||
github.event_name == 'push'
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Fetch Cached Artifacts
uses: actions/cache@v2.1.4
with:
path: ${{ github.workspace }}/nginx-ingress
key: nginx-ingress-${{ github.run_id }}-${{ github.run_number }}
- name: Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host
- name: Cache Docker layers
uses: actions/cache@v2.1.4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build AP Docker Image ${{ matrix.image }}
uses: docker/build-push-action@v2
with:
file: build/DockerfileWithAppProtectForPlusForOpenShift
context: '.'
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
target: local
tags: nginx-plus-ingress-ap-openshift:${{ github.sha }}
secrets: |
"nginx-repo.crt=${{ secrets.KIC_NGINX_AP_CRT }}"
"nginx-repo.key=${{ secrets.KIC_NGINX_AP_KEY }}"
"rhel_license=${{ secrets.KIC_RHEL_LICENSE }}"
build-args: |
PLUS=-plus

helm-tests:
name: Helm Tests
runs-on: ${{ matrix.os }}
Expand Down
26 changes: 22 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,24 @@ jobs:
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Determine which image to build
run: |
DOW=$(date +%u)
if [ ${TYPE} == "oss" ]; then
[[ $DOW -lt 5 ]] && build_os="debian"
[[ $DOW -eq 5 ]] && build_os="openshift"
[[ $DOW -eq 6 ]] && build_os="alpine"
[[ $DOW -eq 7 ]] && build_os="opentracing"
elif [ ${TYPE} == "plus" ]; then
[[ $DOW -lt 6 ]] && build_os="debian-plus"
[[ $DOW -eq 6 ]] && build_os="opentracing-plus"
[[ $DOW -eq 7 ]] && build_os="openshift-plus"
elif [ ${TYPE} == "plus-ap" ]; then
[[ $DOW -lt 5 || $DOW -eq 7 ]] && read -r build_os build_dockerfile <<< "debian-plus build/Dockerfile"
[[ $DOW -eq 6 ]] && read -r build_os build_dockerfile <<< "opentracing-plus build/DockerfileWithAppProtectForPlusForOpenShift"
ciarams87 marked this conversation as resolved.
Show resolved Hide resolved
fi
echo "BUILD_OS=${build_os}" >> $GITHUB_ENV
echo "BUILD_DOCKERFILE=${build_dockerfile}" >> $GITHUB_ENV
- name: Build ${{ matrix.image }} Container
uses: docker/build-push-action@v2
with:
Expand All @@ -189,7 +207,7 @@ jobs:
tags: ${{ matrix.image }}:${{ matrix.tag }}
load: true
build-args: |
BUILD_OS=debian
BUILD_OS=${BUILD_OS}
if: matrix.type == 'oss'
- name: Build Plus Docker Image ${{ matrix.image }}
uses: docker/build-push-action@v2
Expand All @@ -205,13 +223,13 @@ jobs:
"nginx-repo.crt=${{ secrets.KIC_NGINX_CRT }}"
"nginx-repo.key=${{ secrets.KIC_NGINX_KEY }}"
build-args: |
BUILD_OS=debian-plus
BUILD_OS=${BUILD_OS}
PLUS=-plus
if: matrix.type == 'plus'
- name: Build AP Docker Image ${{ matrix.image }}
uses: docker/build-push-action@v2
with:
file: build/Dockerfile
file: ${BUILD_DOCKERFILE}
context: '.'
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
Expand All @@ -222,7 +240,7 @@ jobs:
"nginx-repo.crt=${{ secrets.KIC_NGINX_AP_CRT }}"
"nginx-repo.key=${{ secrets.KIC_NGINX_AP_KEY }}"
build-args: |
BUILD_OS=debian-plus-ap
BUILD_OS=${BUILD_OS}
PLUS=-plus
if: matrix.type == 'plus-ap'
- name: Build Test-Runner Container
Expand Down