k3s/.github/workflows/cgroup2.yaml
Jacob Blain Christen a9fce84ab6
github actions: enable workflow_dispatch (#3923)
Addresses #3922

Signed-off-by: Jacob Blain Christen <jacob@rancher.com>
2021-08-26 23:40:06 -07:00

77 lines
2.4 KiB
YAML

name: cgroup2
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
workflow_dispatch: {}
jobs:
build:
name: "Build"
runs-on: ubuntu-20.04
timeout-minutes: 40
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: "Make"
run: DOCKER_BUILDKIT=1 SKIP_VALIDATE=1 make
- name: "Upload k3s binary"
uses: actions/upload-artifact@v2
with:
name: k3s
path: dist/artifacts/k3s
test:
name: "Test"
needs: build
# nested virtualization is only available on macOS hosts
runs-on: macos-10.15
timeout-minutes: 40
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: "Download k3s binary"
uses: actions/download-artifact@v2
with:
name: k3s
path: ./tests/cgroup2
- name: "Boot Fedora VM"
run: |
cp -r k3s.service k3s-rootless.service ./tests/util ./tests/cgroup2
cd ./tests/cgroup2
vagrant up
vagrant ssh-config >> ~/.ssh/config
- name: "Starting k3s"
run: |
ssh default -- sudo systemctl start k3s
# Sonobuoy requires CoreDNS to be ready
- name: "Waiting for CoreDNS to be ready"
run: |
ssh default -- sudo KUBECONFIG=/etc/rancher/k3s/k3s.yaml /vagrant/util/wait-for-coredns.sh
# Vagrant is slow, so we set --mode=quick here
- name: "Run Sonobuoy (--mode=quick)"
run: |
ssh default -- sudo KUBECONFIG=/etc/rancher/k3s/k3s.yaml sonobuoy run --mode=quick --wait
- name: "Stopping k3s"
run: |
ssh default -- sudo systemctl stop k3s
# FIXME: rootful k3s processes are still running even after `systemctl stop k3s`, so we reboot the VM here.
# This reboot is also useful for ensuring `systemctl daemon-reload`: https://github.com/rootless-containers/rootlesscontaine.rs/issues/32
cd ./tests/cgroup2
vagrant halt
vagrant up
- name: "[Rootless] Starting k3s-rootless"
run: |
ssh default -- systemctl --user start k3s-rootless
- name: "[Rootless] Waiting for CoreDNS to be ready"
run: |
ssh default -- KUBECONFIG=/home/vagrant/.kube/k3s.yaml /vagrant/util/wait-for-coredns.sh
- name: "[Rootless] Run Sonobuoy (--mode=quick)"
run: |
ssh default -- KUBECONFIG=/home/vagrant/.kube/k3s.yaml sonobuoy run --mode=quick --wait