Skip to content

Commit

Permalink
Use one workflow for Edge and Nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Sep 1, 2021
1 parent 2198fb4 commit 866bfaa
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 235 deletions.
78 changes: 50 additions & 28 deletions .github/workflows/edge.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Edge
name: CI

on:
push:
Expand All @@ -21,6 +21,8 @@ on:
- opened
- reopened
- synchronize
schedule:
- cron: '0 4 * * *'

defaults:
run:
Expand Down Expand Up @@ -143,6 +145,7 @@ jobs:
target: goreleaser
tags: docker.io/nginx/nginx-ingress:${{ matrix.image }}-${{ github.sha }}
load: true
pull: true
build-args: |
BUILD_OS=${{ matrix.image }}
UBI_VERSION=${{ matrix.ubi_version }}
Expand All @@ -165,23 +168,30 @@ jobs:
path: 'trivy-results-${{ matrix.image }}.sarif'
if: always()

setup-matrix:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
if [ "${{ github.event_name }}" != "schedule" ]; then
echo "::set-output name=matrix::{\"include\": \
[{\"image\": \"debian\", \"marker\": \"ingresses\"}, \
{\"image\": \"alpine\", \"marker\":\"vsr\"}, \
{\"image\": \"opentracing\", \"marker\": \"vs\"}, \
{\"image\": \"ubi\", \"marker\": \"ts\"}, \
{\"image\": \"debian\", \"marker\": \"policies\"}]}"
else
echo "::set-output name=matrix::{\"k8s\": [\"1.19.11\", \"1.20.7\", \"1.21.2\", \"1.22.1\"]}"
fi
smoke-tests:
name: Smoke Tests
runs-on: ubuntu-20.04
needs: [checks, binary, build-image-scan, unit-tests]
needs: [checks, binary, build-image-scan, unit-tests, setup-matrix]
strategy:
matrix:
include:
- image: debian
marker: 'ingresses'
- image: alpine
marker: 'vsr'
- image: opentracing
marker: 'vs'
- image: ubi
marker: 'ts'
- image: debian
marker: 'policies'
matrix: ${{ fromJSON(needs.setup-matrix.outputs.matrix) }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
Expand All @@ -191,6 +201,7 @@ jobs:
with:
image: ${{ matrix.image }}
marker: ${{ matrix.marker }}
k8s-version: ${{ matrix.k8s }}
- name: Upload Test Results
uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -260,7 +271,7 @@ jobs:
name: Build Binaries for release
runs-on: ubuntu-20.04
needs: [checks, smoke-tests, helm-tests]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: github.event_name != 'pull_request'
steps:
- name: Checkout Repository
uses: actions/checkout@v2
Expand Down Expand Up @@ -288,21 +299,21 @@ jobs:
name: Release Images
runs-on: ubuntu-20.04
needs: [checks, binaries-release]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: github.event_name != 'pull_request'
strategy:
matrix:
include:
- tag: edge
type: debian
- type: debian
suffix: ''
platforms: linux/arm,linux/arm64,linux/amd64,linux/ppc64le,linux/s390x
- tag: edge-alpine
type: alpine
- type: alpine
suffix: '-alpine'
platforms: linux/arm,linux/arm64,linux/amd64,linux/ppc64le,linux/s390x
- tag: edge-ubi
type: ubi
- type: ubi
suffix: '-ubi'
platforms: linux/arm64,linux/amd64
- tag: edge-ot
type: opentracing
- type: opentracing
suffix: '-ot'
platforms: linux/amd64
steps:
- name: Checkout Repository
Expand All @@ -313,7 +324,6 @@ jobs:
id: commit
run: |
echo "::set-output name=tag::$(git describe --tags --abbrev=0)"
echo "::set-output name=date::$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
- name: Fetch Cached Artifacts
uses: actions/cache@v2
with:
Expand All @@ -330,6 +340,18 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: nginx/nginx-ingress
tags: |
type=edge,suffix=${{ matrix.suffix }}
type=schedule,suffix=${{ matrix.suffix }}
labels: |
org.opencontainers.image.title=NGINX Ingress Controller for Kubernetes
org.opencontainers.image.documentation=https://docs.nginx.com/nginx-ingress-controller
org.opencontainers.image.vendor=NGINX Inc <kubernetes@nginx.com>
- name: Push to Dockerhub
uses: docker/build-push-action@v2
with:
Expand All @@ -339,14 +361,14 @@ jobs:
# cache-from: type=gha
# cache-to: type=gha,mode=max
target: goreleaser
tags: nginx/nginx-ingress:${{ matrix.tag }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ matrix.platforms }}
pull: true
push: true
build-args: |
BUILD_OS=${{ matrix.type }}
IC_VERSION=${{ steps.commit.outputs.tag }}-SNAPSHOT-${{ needs.checks.outputs.sha_short }}
DATE=${{ steps.commit.outputs.date }}
GIT_COMMIT=${{ github.sha }}
package-helm:
name: Package Helm Chart
Expand Down
199 changes: 0 additions & 199 deletions .github/workflows/nightly.yml

This file was deleted.

11 changes: 3 additions & 8 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ ARG BUILD_OS
ARG IC_VERSION
ARG GIT_COMMIT
ARG DATE
ARG BUILDPLATFORM
ARG TARGETPLATFORM

RUN mkdir -p /var/lib/nginx /etc/nginx/secrets /etc/nginx/stream-conf.d \
Expand All @@ -246,16 +245,12 @@ STOPSIGNAL SIGTERM
ENTRYPOINT ["/nginx-ingress"]
USER nginx

LABEL org.opencontainers.image.title="NGINX Ingress Controller for Kubernetes"
LABEL org.opencontainers.image.documentation="https://docs.nginx.com/nginx-ingress-controller"
LABEL org.opencontainers.image.source="https://github.com/nginxinc/kubernetes-ingress"
LABEL org.opencontainers.image.vendor="NGINX Inc <kubernetes@nginx.com>"
LABEL org.opencontainers.image.licenses="Apache-2.0"
LABEL org.opencontainers.image.version="${IC_VERSION}-${BUILD_OS}-${NGINX_PLUS_VERSION}${NGINX_VERSION}"
LABEL org.opencontainers.image.version="${IC_VERSION}"
LABEL org.opencontainers.image.revision="${GIT_COMMIT}"
LABEL org.opencontainers.image.created="${DATE}"
LABEL org.nginx.kic.image.build.platform="${BUILDPLATFORM}"
LABEL org.nginx.kic.image.build.target="${TARGETPLATFORM}"
LABEL org.nginx.kic.image.build.os="${BUILD_OS}"
LABEL org.nginx.kic.image.build.nginx.vesion="${NGINX_PLUS_VERSION}${NGINX_VERSION}"


############################################# Build nginx-ingress in golang container #############################################
Expand Down

0 comments on commit 866bfaa

Please sign in to comment.