From 8c74798925ea1ce315056ae5574224dade975e4b Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Thu, 8 Jul 2021 12:46:00 +0900 Subject: [PATCH] CI: switch away from GHA to Cirrus CI Signed-off-by: Akihiro Suda --- .cirrus.yml | 63 +++++++++++++++++++++++++++++++++ .github/workflows/main.yaml | 70 ------------------------------------- Makefile | 7 ++-- 3 files changed, 67 insertions(+), 73 deletions(-) create mode 100644 .cirrus.yml delete mode 100644 .github/workflows/main.yaml diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 0000000..db41f9e --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,63 @@ +# We use Vagrant to prepare cgroup v2 env. + +compute_engine_instance: + image_project: cirrus-images + image: family/docker-kvm + platform: linux + nested_virtualization: true + # CPU limit: `16 / NTASK`: see https://cirrus-ci.org/faq/#are-there-any-limits + cpu: 8 + # Memory limit: `4GB * NCPU` + memory: 32G + +task_template: &TASK_TEMPLATE + timeout_in: 30m + env: + DEBIAN_FRONTEND: noninteractive + HOME: /root + DOCKER_BUILDKIT: 1 + info_script: + - uname -a + - cat /proc/cpuinfo + - docker info + build_script: + - make + install_libvirt_vagrant_script: + - apt-get update + - apt-get install -y libvirt-daemon libvirt-daemon-system vagrant vagrant-libvirt + - systemctl enable --now libvirtd + vagrant_cache: + fingerprint_script: uname -s ; cat Vagrantfile + folder: /root/.vagrant.d + vagrant_up_script: + - vagrant up + # + # Enabling cgroup delegation seems to need rebooting since Fedora 34: https://github.com/rootless-containers/rootlesscontaine.rs/issues/32 + # We shouldn't need this reboot. + vagrant_reboot_script: + - vagrant halt + - vagrant up + # + vagrant_ssh_config_script: + - mkdir -p -m 0700 /root/.ssh + - vagrant ssh-config >> /root/.ssh/config + +single_node_task: + << : *TASK_TEMPLATE + name: "Single node" + containerd_test_script: + - ssh default /vagrant/hack/smoketest-binaries.sh --cri=containerd + crio_test_script: + - ssh default /vagrant/hack/smoketest-binaries.sh --cri=crio + +multi_node_task: + << : *TASK_TEMPLATE + name: "Multi node with Flannel (Docker Compose)" + install_docker_script: + - ssh default sudo dnf install -y moby-engine docker-compose make + - ssh default sudo usermod -aG docker vagrant + - ssh default sudo systemctl enable --now docker + load_image_script: + - docker save ghcr.io/rootless-containers/usernetes:latest | ssh default docker load + compose_test_script: + - ssh default /vagrant/hack/smoketest-docker-compose.sh diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml deleted file mode 100644 index ca55be3..0000000 --- a/.github/workflows/main.yaml +++ /dev/null @@ -1,70 +0,0 @@ -name: Main -on: [push, pull_request] -env: - DOCKER_BUILDKIT: 1 -jobs: - main: - name: "Main" - runs-on: ubuntu-latest - timeout-minutes: 40 - steps: - - name: "System info" - run: sh -xec "uname -a; docker info; cat /proc/cpuinfo; df -h" - - uses: actions/checkout@v2 - - name: "Make" - run: make image artifact - - name: "Upload usernetes-x86_64.tbz" - uses: actions/upload-artifact@v2 - with: - name: usernetes-x86_64.tbz - path: _artifact/usernetes-x86_64.tbz - - name: "Clean up (To avoid `node.kubernetes.io/disk-pressure` taint)" - run: | - make clean - docker builder prune -a -f - - name: "Smoke test (containerd, w/o cgroups)" - run: ./hack/smoketest-docker.sh u7s-test-containerd ghcr.io/rootless-containers/usernetes --cri=containerd - - name: "Smoke test (CRI-O, w/o cgroups)" - run: ./hack/smoketest-docker.sh u7s-test-crio ghcr.io/rootless-containers/usernetes --cri=crio - - name: "Smoke test (multi-node cluster with Flannel)" - run: ./hack/smoketest-docker-compose.sh - fedora: - name: "Fedora (for cgroup v2)" - needs: main - # nested virtualization is only available on macOS hosts - runs-on: macos-10.15 - timeout-minutes: 40 - steps: - - name: "Download usernetes-x86_64.tbz" - uses: actions/download-artifact@v2 - with: - name: usernetes-x86_64.tbz - - name: "Extract usernetes-x86_64.tbz" - run: tar xjvf usernetes-x86_64.tbz - - name: "Boot VM" - working-directory: usernetes - run: | - vagrant up - # - # Enabling cgroup delegation seems to need rebooting since Fedora 34: https://github.com/rootless-containers/rootlesscontaine.rs/issues/32 - # We shouldn't need this reboot. - vagrant halt - vagrant up - # - vagrant ssh-config > ~/vagrant-ssh-config - - name: "Smoke test (containerd, w/ systemd-delegated cgroupfs)" - run: ssh -F ~/vagrant-ssh-config default /vagrant/hack/smoketest-binaries.sh --cri=containerd - - name: "Boot VM" - working-directory: usernetes - run: | - vagrant destroy -f - vagrant up - # - # Enabling cgroup delegation seems to need rebooting since Fedora 34: https://github.com/rootless-containers/rootlesscontaine.rs/issues/32 - # We shouldn't need this reboot. - vagrant halt - vagrant up - # - vagrant ssh-config > ~/vagrant-ssh-config - - name: "Smoke test (CRI-O, w/ systemd-delegated cgroupfs)" - run: ssh -F ~/vagrant-ssh-config default /vagrant/hack/smoketest-binaries.sh --cri=crio diff --git a/Makefile b/Makefile index c8f6f11..bce108e 100644 --- a/Makefile +++ b/Makefile @@ -27,13 +27,14 @@ _test: up: image _up _up: - docker-compose up -d + docker-compose --project-name=usernetes up -d + docker run --rm -v usernetes_tls-master:/a busybox timeout 60 sh -c "until test -f /a/done; do sleep 1; echo \"waiting for /a/done\"; done" mkdir -p $(HOME)/.config/usernetes - docker run --rm -v usernetes_tls-master:/a busybox sh -c "until test -f /a/done; do sleep 1; done; cat /a/admin-localhost.kubeconfig" > $(HOME)/.config/usernetes/docker-compose.kubeconfig + docker run --rm -v usernetes_tls-master:/a busybox cat /a/admin-localhost.kubeconfig > $(HOME)/.config/usernetes/docker-compose.kubeconfig echo "To use kubectl: export KUBECONFIG=$(HOME)/.config/usernetes/docker-compose.kubeconfig" down: - docker-compose down -v -t 0 + docker-compose --project-name=usernetes down -v -t 0 rm -f $(HOME)/.config/usernetes/docker-compose.kubeconfig artifact: binaries _artifact