Skip to content

Relax the yaml parsing #1

Relax the yaml parsing

Relax the yaml parsing #1

Workflow file for this run

name: CI
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
workflow_dispatch:
jobs:
unit-tests:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install python3-pip arping ndisc6
sudo pip3 install invoke semver pyyaml
- uses: actions/setup-go@v2
with:
go-version: '1.16'
- name: Unit Tests
run: |
inv test
cp manifests/metallb.yaml manifests/metallb.yaml.prev
- name: Lint
run: |
inv checkpatch
inv lint -e host
inv verifylicense
helm:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: "0"
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.7.1
## ct v3.4.0, which in turn uses helm v3.5.4
- name: Lint
uses: docker://quay.io/helmpack/chart-testing:v3.4.0
with:
args: ct lint
## TODO: Can't pass flags to the conftest GHA in order to use --fail-on-warn
## Should be fixed when https://github.com/instrumenta/conftest-action/issues/3
## is resolved
##
# - name: Conftest
# uses: instrumenta/conftest-action/helm@master
# with:
# chart: charts/metallb/
# policy: charts/metallb/policy
- name: Conftest
run: |
helm plugin install --debug https://github.com/instrumenta/helm-conftest
helm conftest charts/metallb/ -p charts/metallb/policy/ --fail-on-warn
e2e:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
ip-family: [ipv4, ipv6, dual]
bgp-type: [native, frr]
deployment: [manifests, helm]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: '1.16.3'
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install python3-pip arping ndisc6
sudo pip3 install invoke semver pyyaml
GO111MODULE="on" go get sigs.k8s.io/[email protected]
- name: Build MetalLB
run: |
inv build
HELM_FLAGS=""
if [ ${{ matrix.deployment }} = "helm" ]; then HELM_FLAGS="--helm-install"; fi
inv dev-env -i ${{ matrix.ip-family }} -b ${{ matrix.bgp-type }} -l all $HELM_FLAGS
- name: E2E
run: |
HELM_FLAGS=""
echo '/etc/frr/core-%e.%p.%h.%t' | sudo tee /proc/sys/kernel/core_pattern
if [ ${{ matrix.deployment }} = "helm" ]; then HELM_FLAGS="--system-namespaces=default" && export OO_INSTALL_NAMESPACE=default && export CONFIGMAP_NAME=metallb && export SPEAKER_SELECTOR="app.kubernetes.io/component=speaker" && export CONTROLLER_SELECTOR="app.kubernetes.io/component=controller"; fi
SKIP="none"
if [ "${{ matrix.bgp-type }}" == "native" ]; then SKIP="$SKIP|FRR|BFD|DUALSTACK"; fi
if [ "${{ matrix.ip-family }}" == "ipv4" ]; then SKIP="$SKIP|IPV6|DUALSTACK"; fi
if [ "${{ matrix.ip-family }}" == "dual" ]; then SKIP="$SKIP|IPV6"; fi
if [ "${{ matrix.ip-family }}" == "ipv6" ]; then SKIP="$SKIP|IPV4|DUALSTACK"; fi
if [ "${{ matrix.ip-family }}" == "ipv6" ] && [ ${{ matrix.bgp-type }} == "native" ]; then SKIP="$SKIP|BGP"; fi
echo "Skipping $SKIP"
sudo -E env "PATH=$PATH" inv e2etest --skip $SKIP -e /tmp/kind_logs $HELM_FLAGS
- name: Log permissions
if: ${{ always() }}
run: |
sudo chmod -R o+r /tmp/kind_logs
- name: Upload logs
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: kind-logs-${{ matrix.ip-family }}-${{ matrix.bgp-type }}-${{ matrix.deployment}}
path: /tmp/kind_logs/
e2e-use-operator:
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
working-directory: metallb
strategy:
fail-fast: false
steps:
- name: Checkout Metal LB Operator
uses: actions/checkout@v2
with:
repository: metallb/metallb-operator
path: metallboperator
ref: e84470bf3644e6444169abb65483bb1a60c957af
- uses: actions/setup-go@v2
with:
go-version: '1.16.3'
- name: Checkout MetalLB
uses: actions/checkout@v2
with:
path: metallb
fetch-depth: 0
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install python3-pip arping ndisc6
sudo pip3 install -r ./dev-env/requirements.txt
GO111MODULE="on" go get sigs.k8s.io/[email protected]
- name: Build MetalLB Images
run: |
inv build
- name: Create multi-node K8s Kind Cluster
run: |
cd ${GITHUB_WORKSPACE}/metallboperator
./hack/kind-multi-node-cluster-without-registry.sh
kind load docker-image quay.io/metallb/speaker:dev-amd64
kind load docker-image quay.io/metallb/controller:dev-amd64
export KUBECONFIG=${HOME}/.kube/config
- name: Deploy Metal LB Operator
run: |
cd ${GITHUB_WORKSPACE}/metallboperator
sed -i 's/quay.io\/metallb\/speaker:main/quay.io\/metallb\/speaker:dev-amd64/g' bin/metallb-operator-with-webhooks.yaml
sed -i 's/quay.io\/metallb\/controller:main/quay.io\/metallb\/controller:dev-amd64/g' bin/metallb-operator-with-webhooks.yaml
sed -i 's/native/frr/g' bin/metallb-operator-with-webhooks.yaml
make deploy-cert-manager
kubectl apply -f bin/metallb-operator-with-webhooks.yaml
- name: MetalLB E2E Tests with Operator Deployment
run: |
kubectl apply -f ${GITHUB_WORKSPACE}/metallboperator/config/samples/metallb.yaml
sudo -E env "PATH=$PATH" inv e2etest --skip "IPV6|DUALSTACK" -e /tmp/kind_logs --use-operator
- name: Change permissions for kind logs
if: ${{ failure() }}
run: |
sudo chmod -R o+r /tmp/kind_logs
- name: Archive kind logs
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: kind_logs_use_operator
path: /tmp/kind_logs