Filter github actions to be executed
This commit is contained in:
parent
9aa1a59e1d
commit
8836cfe04a
4 changed files with 130 additions and 24 deletions
87
.github/workflows/ci.yaml
vendored
87
.github/workflows/ci.yaml
vendored
|
@ -4,25 +4,55 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "*"
|
- "*"
|
||||||
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
|
||||||
name: Build
|
changes:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
go: ${{ steps.filter.outputs.go }}
|
||||||
|
charts: ${{ steps.filter.outputs.charts }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go 1.14
|
|
||||||
uses: actions/setup-go@v1
|
|
||||||
with:
|
|
||||||
go-version: 1.14
|
|
||||||
id: go
|
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- uses: dorny/paths-filter@v2.2.0
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
filters: |
|
||||||
|
go:
|
||||||
|
- '**/*.go'
|
||||||
|
- 'go.mod'
|
||||||
|
- 'go.sum'
|
||||||
|
- 'rootfs/**/*'
|
||||||
|
charts:
|
||||||
|
- 'charts/ingress-nginx/Chart.yaml'
|
||||||
|
- 'charts/ingress-nginx/*'
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: changes
|
||||||
|
if: ${{ needs.changes.outputs.go == 'true' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Set up Go 1.14
|
||||||
|
id: go
|
||||||
|
uses: actions/setup-go@v1
|
||||||
|
with:
|
||||||
|
go-version: 1.14
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: crazy-max/ghaction-docker-buildx@v1
|
uses: crazy-max/ghaction-docker-buildx@v1
|
||||||
|
@ -63,15 +93,55 @@ jobs:
|
||||||
name: docker.tar.gz
|
name: docker.tar.gz
|
||||||
path: docker.tar.gz
|
path: docker.tar.gz
|
||||||
|
|
||||||
|
helm:
|
||||||
|
name: Helm chart
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- changes
|
||||||
|
if: ${{ needs.changes.outputs.charts == 'true' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: |
|
||||||
|
./build/run-in-docker.sh ./hack/verify-chart-lint.sh
|
||||||
|
|
||||||
|
- name: fix permissions
|
||||||
|
run: |
|
||||||
|
sudo mkdir -p $HOME/.kube
|
||||||
|
sudo chmod -R 777 $HOME/.kube
|
||||||
|
|
||||||
|
- name: Create Kubernetes cluster
|
||||||
|
id: kind
|
||||||
|
uses: engineerd/setup-kind@v0.4.0
|
||||||
|
with:
|
||||||
|
version: v0.8.1
|
||||||
|
image: kindest/node:v1.18.4
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
env:
|
||||||
|
KIND_CLUSTER_NAME: kind
|
||||||
|
SKIP_CLUSTER_CREATION: true
|
||||||
|
run: |
|
||||||
|
kind get kubeconfig > $HOME/.kube/kind-config-kind
|
||||||
|
make kind-e2e-chart-tests
|
||||||
|
|
||||||
kubernetes:
|
kubernetes:
|
||||||
name: Kubernetes
|
name: Kubernetes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs:
|
||||||
|
- changes
|
||||||
|
- build
|
||||||
|
if: ${{ needs.changes.outputs.go == 'true' }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
k8s: [v1.14.10, v1.15.11, v1.16.9, v1.17.5, v1.18.4]
|
k8s: [v1.14.10, v1.15.11, v1.16.9, v1.17.5, v1.18.4]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
@ -88,7 +158,6 @@ jobs:
|
||||||
config: test/e2e/kind.yaml
|
config: test/e2e/kind.yaml
|
||||||
image: kindest/node:${{ matrix.k8s }}
|
image: kindest/node:${{ matrix.k8s }}
|
||||||
|
|
||||||
# delete-artifact
|
|
||||||
- uses: geekyeggo/delete-artifact@v1
|
- uses: geekyeggo/delete-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: docker.tar.gz
|
name: docker.tar.gz
|
||||||
|
|
31
.github/workflows/main.yaml
vendored
31
.github/workflows/main.yaml
vendored
|
@ -7,8 +7,31 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
docs:
|
changes:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
go: ${{ steps.filter.outputs.go }}
|
||||||
|
charts: ${{ steps.filter.outputs.charts }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- uses: dorny/paths-filter@v2.2.0
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
filters: |
|
||||||
|
docs:
|
||||||
|
- 'docs/**/*'
|
||||||
|
charts:
|
||||||
|
- 'charts/ingress-nginx/Chart.yaml'
|
||||||
|
|
||||||
|
docs:
|
||||||
|
name: Update Documentation
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- changes
|
||||||
|
if: ${{ needs.changes.outputs.docs == 'true' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout master
|
- name: Checkout master
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
@ -19,8 +42,12 @@ jobs:
|
||||||
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
|
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
|
||||||
|
|
||||||
chart:
|
chart:
|
||||||
needs: docs
|
name: Release Chart
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- changes
|
||||||
|
if: ${{ needs.changes.outputs.charts == 'true' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout master
|
- name: Checkout master
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
|
|
@ -36,20 +36,31 @@ fi
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
export K8S_VERSION=${K8S_VERSION:-v1.18.4@sha256:d8ff5fc405fc679dd3dd0cccc01543ba4942ed90823817d2e9e2c474a5343c4f}
|
export KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-ingress-nginx-dev}
|
||||||
|
|
||||||
KIND_CLUSTER_NAME="ingress-nginx-dev"
|
export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/kind-config-$KIND_CLUSTER_NAME}"
|
||||||
|
|
||||||
echo "[dev-env] creating Kubernetes cluster with kind"
|
# Disable execution if running as a Prow job
|
||||||
export KUBECONFIG="${HOME}/.kube/kind-config-${KIND_CLUSTER_NAME}"
|
if [[ ! -z ${PROW_JOB_ID:-} ]]; then
|
||||||
kind create cluster \
|
echo "skipping execution..."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${SKIP_CLUSTER_CREATION:-false}" = "false" ]; then
|
||||||
|
echo "[dev-env] creating Kubernetes cluster with kind"
|
||||||
|
|
||||||
|
export K8S_VERSION=${K8S_VERSION:-v1.18.4@sha256:d8ff5fc405fc679dd3dd0cccc01543ba4942ed90823817d2e9e2c474a5343c4f}
|
||||||
|
|
||||||
|
kind create cluster \
|
||||||
|
--verbosity=${KIND_LOG_LEVEL} \
|
||||||
--name ${KIND_CLUSTER_NAME} \
|
--name ${KIND_CLUSTER_NAME} \
|
||||||
--config "${DIR}/kind.yaml" \
|
--config ${DIR}/kind.yaml \
|
||||||
--retain \
|
--retain \
|
||||||
--image "kindest/node:${K8S_VERSION}"
|
--image "kindest/node:${K8S_VERSION}"
|
||||||
|
|
||||||
echo "Kubernetes cluster:"
|
echo "Kubernetes cluster:"
|
||||||
kubectl get nodes -o wide
|
kubectl get nodes -o wide
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[dev-env] running helm chart e2e tests..."
|
echo "[dev-env] running helm chart e2e tests..."
|
||||||
docker run --rm --interactive --network host \
|
docker run --rm --interactive --network host \
|
||||||
|
|
|
@ -39,8 +39,7 @@ trap cleanup EXIT
|
||||||
|
|
||||||
export KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-ingress-nginx-dev}
|
export KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-ingress-nginx-dev}
|
||||||
|
|
||||||
export KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-ingress-nginx-dev}
|
# Disable execution if running as a Prow job
|
||||||
|
|
||||||
if [[ ! -z ${PROW_JOB_ID:-} ]]; then
|
if [[ ! -z ${PROW_JOB_ID:-} ]]; then
|
||||||
echo "skipping execution..."
|
echo "skipping execution..."
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue