-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
132 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,10 +62,136 @@ jobs: | |
- name: Run Tests | ||
run: go test ./... | ||
|
||
build: | ||
name: Build Docker Images | ||
runs-on: ${{ matrix.os }} | ||
needs: [binary, unit-tests] | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-20.04 | ||
file: build/Dockerfile | ||
context: '.' | ||
target: local | ||
image: debian | ||
type: oss | ||
- os: ubuntu-20.04 | ||
file: build/Dockerfile | ||
context: '.' | ||
target: local | ||
image: alpine | ||
type: oss | ||
- os: ubuntu-20.04 | ||
file: build/Dockerfile | ||
context: '.' | ||
target: local | ||
image: debian-plus | ||
type: plus | ||
- os: ubuntu-20.04 | ||
file: build/Dockerfile | ||
context: '.' | ||
target: local | ||
image: opentracing | ||
type: oss | ||
- os: ubuntu-20.04 | ||
file: build/Dockerfile | ||
context: '.' | ||
target: local | ||
image: opentracing-plus | ||
type: plus | ||
- os: ubuntu-20.04 | ||
file: build/Dockerfile | ||
context: '.' | ||
target: local | ||
image: openshift | ||
type: oss | ||
- os: ubuntu-20.04 | ||
file: build/Dockerfile | ||
context: '.' | ||
target: local | ||
image: openshift-plus | ||
type: plus | ||
- os: ubuntu-20.04 | ||
file: build/Dockerfile | ||
context: '.' | ||
target: local | ||
image: debian-plus-ap | ||
type: plus-ap | ||
- os: ubuntu-20.04 | ||
file: build/DockerfileWithAppProtectForPlusForOpenShift | ||
context: '.' | ||
target: local | ||
image: nginx-plus-ingress-ap-openshift | ||
type: plus-ap-openshift | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
- name: Fetch Cached Artifacts | ||
uses: actions/[email protected] | ||
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/[email protected] | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build Docker Image ${{ matrix.image }} | ||
uses: docker/build-push-action@v2 | ||
with: | ||
file: ${{ matrix.file }} | ||
context: ${{ matrix.context }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
target: ${{ matrix.target }} | ||
tags: ${{ matrix.image }}:${{ github.sha }} | ||
build-args: | | ||
BUILD_OS=${{ matrix.image }} | ||
if: matrix.type == 'oss' | ||
- name: Build Plus Docker Image ${{ matrix.image }} | ||
uses: docker/build-push-action@v2 | ||
with: | ||
file: ${{ matrix.file }} | ||
context: ${{ matrix.context }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
target: ${{ matrix.target }} | ||
tags: ${{ matrix.image }}:${{ github.sha }} | ||
secrets: | | ||
"nginx-repo.crt=${{ secrets.KIC_NGINX_CRT }}" | ||
"nginx-repo.key=${{ secrets.KIC_NGINX_KEY }}" | ||
build-args: | | ||
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: ${{ matrix.file }} | ||
context: ${{ matrix.context }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
target: ${{ matrix.target }} | ||
tags: ${{ matrix.image }}:${{ 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: | | ||
BUILD_OS=${{ matrix.image }} | ||
PLUS=-plus | ||
if: matrix.type == 'plus-ap' || matrix.type == 'plus-ap-openshift' | ||
|
||
smoke-tests: | ||
name: Smoke Tests | ||
runs-on: ${{ matrix.os }} | ||
needs: [binary, unit-tests] | ||
needs: [build, binary, unit-tests] | ||
strategy: | ||
matrix: | ||
include: | ||
|
@@ -178,24 +304,6 @@ 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-ap build/Dockerfile" | ||
[[ $DOW -eq 6 ]] && build_dockerfile="build/DockerfileWithAppProtectForPlusForOpenShift" | ||
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: | ||
|
@@ -207,7 +315,7 @@ jobs: | |
tags: ${{ matrix.image }}:${{ matrix.tag }} | ||
load: true | ||
build-args: | | ||
BUILD_OS=${BUILD_OS} | ||
BUILD_OS=debian | ||
if: matrix.type == 'oss' | ||
- name: Build Plus Docker Image ${{ matrix.image }} | ||
uses: docker/build-push-action@v2 | ||
|
@@ -223,13 +331,13 @@ jobs: | |
"nginx-repo.crt=${{ secrets.KIC_NGINX_CRT }}" | ||
"nginx-repo.key=${{ secrets.KIC_NGINX_KEY }}" | ||
build-args: | | ||
BUILD_OS=${BUILD_OS} | ||
BUILD_OS=debian-plus | ||
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 | ||
|
@@ -240,7 +348,7 @@ jobs: | |
"nginx-repo.crt=${{ secrets.KIC_NGINX_AP_CRT }}" | ||
"nginx-repo.key=${{ secrets.KIC_NGINX_AP_KEY }}" | ||
build-args: | | ||
BUILD_OS=${BUILD_OS} | ||
BUILD_OS=debian-plus-ap | ||
PLUS=-plus | ||
if: matrix.type == 'plus-ap' | ||
- name: Build Test-Runner Container | ||
|
@@ -300,7 +408,7 @@ jobs: | |
helm-tests: | ||
name: Helm Tests | ||
runs-on: ${{ matrix.os }} | ||
needs: [binary, unit-tests] | ||
needs: [build, binary, unit-tests] | ||
env: | ||
NGINX_HTTP_PORT: 8080 | ||
NGINX_HTTPS_PORT: 8443 | ||
|