Skip to content

Test matrix for different k0s versions #95

Test matrix for different k0s versions

Test matrix for different k0s versions #95

Workflow file for this run

name: Go build
on:
push:
branches:
- main
- release-*
paths-ignore:
- 'config/**'
- 'docs/**'
- 'mkdocs.yml'
- '**.md'
- LICENSE
- '**.svg'
pull_request:
branches:
- main
- release-*
paths-ignore:
- 'config/**'
- 'docs/**'
- 'mkdocs.yml'
- '**.md'
- LICENSE
- '**.svg'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0 # for `git describe`
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
run: |
make build
- name: Build image
run: |
make docker-build
generate-sbom:
name: "Build :: SBOM"
needs: [ build ]
runs-on: ubuntu-22.04
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Generate SBOM
run: |
mkdir -p sbom && chmod 777 sbom
make sbom/spdx.json
- uses: actions/upload-artifact@v4
with:
name: spdx.json
path: sbom/spdx.json
unittest:
name: Unit test
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run unit tests
run: |
make test
smoketest-on-different-k0s-versions:
name: Smoke test on different k0s versions
name: Smoke test

Check failure on line 91 in .github/workflows/go.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/go.yml

Invalid workflow file

You have an error in your yaml syntax on line 91
needs: build
runs-on: ubuntu-22.04-8core
strategy:
fail-fast: false
matrix:
smoke-suite:
- check-basic
k0s-version: [ "v1.28.11", "v1.29.6", "v1.30.2" ]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Create image bundle
run: |
make release
make k0smotron-image-bundle.tar
- name: Run inttest
run: |
make -C inttest ${{ matrix.smoke-suite }} K0S_VERSION=${{ matrix.k0s-version }}
smoketest:
name: Smoke test
needs: build
runs-on: ubuntu-22.04-8core
strategy:
fail-fast: false
matrix:
smoke-suite:
- check-config-update-hcp
- check-hostpath
- check-ha-controller
- check-ha-controller-etcd
- check-ha-controller-secret
- check-jointoken
- check-monitoring
- check-scaling-etcd
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Create image bundle
run: |
make release
make k0smotron-image-bundle.tar
- name: Run inttest
run: |
make -C inttest ${{ matrix.smoke-suite }}
capi-smokes:
name: Cluster API smoke tests
needs: build
runs-on: ubuntu-22.04-8core
strategy:
fail-fast: false
matrix:
smoke-suite:
- check-capi-docker
- check-capi-config-update-vm
- check-capi-docker-clusterclass
- check-capi-docker-clusterclass-k0smotron
- check-capi-docker-machinedeployment
- check-capi-controlplane-docker
- check-capi-controlplane-docker-downscaling
- check-capi-controlplane-docker-tunneling
- check-capi-controlplane-docker-tunneling-proxy
- check-capi-controlplane-docker-worker
- check-capi-remote-machine
- check-capi-remote-machine-template
- check-capi-remote-machine-template-update
- check-capi-docker-machine-template-update
- check-capi-remote-machine-job-provision
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Create image bundle
run: |
make release
make k0smotron-image-bundle.tar
- name: Create kind network with IPv4 only
run: |
docker network create kind --opt com.docker.network.bridge.enable_ip_masquerade=true
- name: Download kind
uses: supplypike/setup-bin@v4
with:
name: kind
version: v0.20.0
uri: https://github.com/kubernetes-sigs/kind/releases/download/v0.20.0/kind-linux-amd64
- name: Setup KinD cluster
run: |
kind create cluster --config config/samples/capi/docker/kind.yaml
- name: Load k0smotron image to KinD
run: |
kind load image-archive k0smotron-image-bundle.tar
- name: Download clusterctl
uses: supplypike/setup-bin@v4
with:
name: clusterctl
version: v1.4.3
uri: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.3/clusterctl-linux-amd64
- name: Prepare cluster api components
run: |
make bootstrap-components.yaml control-plane-components.yaml infrastructure-components.yaml
mkdir -p v0.0.0 k0sproject-k0smotron/control-plane-k0sproject-k0smotron/ k0sproject-k0smotron/bootstrap-k0sproject-k0smotron/ k0sproject-k0smotron/infrastructure-k0sproject-k0smotron/
mv bootstrap-components.yaml v0.0.0
mv control-plane-components.yaml v0.0.0
mv infrastructure-components.yaml v0.0.0
mv ./hack/capi-ci/metadata.yaml v0.0.0
cp -r v0.0.0 k0sproject-k0smotron/bootstrap-k0sproject-k0smotron/
cp -r v0.0.0 k0sproject-k0smotron/control-plane-k0sproject-k0smotron/
cp -r v0.0.0 k0sproject-k0smotron/infrastructure-k0sproject-k0smotron/
sed -e 's#%pwd%#'`pwd`'#g' ./hack/capi-ci/config.yaml > config.yaml
- name: Install cluster api components
run: |
clusterctl init --control-plane k0sproject-k0smotron --bootstrap k0sproject-k0smotron --infrastructure k0sproject-k0smotron,docker --config config.yaml
kubectl patch -n capi-system deployment/capi-controller-manager -p \
'{"spec":{"template":{"spec":{"containers":[{"name":"manager","args":["--leader-elect", "--metrics-bind-addr=localhost:8080", "--feature-gates=ClusterTopology=true"]}]}}}}'
kubectl patch -n capd-system deployment/capd-controller-manager -p \
'{"spec":{"template":{"spec":{"containers":[{"name":"manager","args":["--leader-elect", "--metrics-bind-addr=localhost:8080", "--feature-gates=ClusterTopology=true"]}]}}}}'
- name: Install PVC provider
run: |
kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.24/deploy/local-path-storage.yaml
- name: Run inttest for CAPI with docker provider
run: |
kind get kubeconfig > kind.conf
export KUBECONFIG=$(realpath kind.conf)
docker system prune -f
make -C inttest ${{ matrix.smoke-suite }}
- name: Get k0smotron logs
if: failure()
run: |
kubectl logs -n k0smotron deploy/k0smotron-controller-manager-bootstrap > /tmp/${{ matrix.smoke-suite }}-k0smotron-bootstrap.log
kubectl logs -n k0smotron deploy/k0smotron-controller-manager-control-plane > /tmp/${{ matrix.smoke-suite }}-k0smotron-control-plane.log
kubectl logs -n k0smotron deploy/k0smotron-controller-manager-infrastructure > /tmp/${{ matrix.smoke-suite }}-k0smotron-infrastructure.log
- name: Collect k0s logs and support bundle
if: failure()
uses: actions/upload-artifact@v4
with:
name: smoketests-${{ matrix.smoke-suite }}-files
path: |
/tmp/${{ matrix.smoke-suite }}-k0smotron.log