diff --git a/.github/actions/vagrant-setup/action.yaml b/.github/actions/vagrant-setup/action.yaml new file mode 100644 index 000000000000..28a8f2b0bb5f --- /dev/null +++ b/.github/actions/vagrant-setup/action.yaml @@ -0,0 +1,25 @@ +name: 'Setup Vagrant and Libvirt' +description: 'A composite action that installs latest versions of vagrant and libvirt for use on ubuntu based runners' +runs: + using: 'composite' + steps: + - name: Add vagrant to apt-get sources + shell: bash + run: | + curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg + echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list + sudo sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list + - name: Install vagrant and libvirt + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant + sudo systemctl enable --now libvirtd + - name: Build vagrant dependencies + shell: bash + run: | + sudo apt-get build-dep -y vagrant ruby-libvirt + sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev + - name: Install vagrant-libvirt plugin + shell: bash + run: sudo vagrant plugin install vagrant-libvirt \ No newline at end of file diff --git a/.github/workflows/install.yaml b/.github/workflows/install.yaml index 6dc5bcc07218..c4787738df4d 100644 --- a/.github/workflows/install.yaml +++ b/.github/workflows/install.yaml @@ -25,13 +25,13 @@ jobs: test: name: "Smoke Test" needs: build - runs-on: macos-12 + runs-on: ubuntu-latest timeout-minutes: 40 strategy: fail-fast: false matrix: vm: [centos-7, rocky-8, rocky-9, fedora, opensuse-leap, ubuntu-2204] - max-parallel: 2 + max-parallel: 3 defaults: run: working-directory: tests/install/${{ matrix.vm }} @@ -42,51 +42,61 @@ jobs: uses: actions/checkout@v4 with: {fetch-depth: 1} - name: "Vagrant Cache" - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | - ~/.vagrant.d/boxes - ~/.vagrant.d/gems + /root/.vagrant.d/boxes + /root/.vagrant.d/gems key: install-${{ hashFiles(format('tests/install/{0}/Vagrantfile', matrix.vm)) }} id: vagrant-cache continue-on-error: true + - name: Set up vagrant and libvirt + uses: ./.github/actions/vagrant-setup - name: "Vagrant Plugin(s)" - run: vagrant plugin install vagrant-k3s vagrant-reload vagrant-scp + run: sudo vagrant plugin install vagrant-k3s vagrant-reload vagrant-scp - name: "Download k3s binary" uses: actions/download-artifact@v3 with: name: k3s path: tests/install/${{ matrix.vm }} - name: "Vagrant Up" - run: vagrant up --no-provision - - name: "Upload k3s binary" + run: sudo vagrant up --no-provision + - name: "Upload k3s binary to VM" run: | chmod +x k3s - vagrant scp k3s /tmp/k3s - vagrant ssh -c "sudo mv /tmp/k3s /usr/local/bin/k3s" - vagrant provision --provision-with=k3s-upload + sudo vagrant scp k3s /tmp/k3s + sudo vagrant ssh -c "sudo mv /tmp/k3s /usr/local/bin/k3s" + sudo vagrant provision --provision-with=k3s-upload - name: Add binary to PATH if: matrix.vm == 'centos-7' || matrix.vm == 'rocky-8' || matrix.vm == 'rocky-9' - run: vagrant provision --provision-with=add-bin-path + run: sudo vagrant provision --provision-with=add-bin-path - name: "⏩ Install K3s" run: | - vagrant provision --provision-with=k3s-prepare - vagrant provision --provision-with=k3s-install + sudo vagrant provision --provision-with=k3s-prepare + sudo vagrant provision --provision-with=k3s-install if [ ${{ matrix.vm }} = 'opensuse-microos' ]; then vagrant reload --no-provision; fi - name: "⏳ Node" - run: vagrant provision --provision-with=k3s-wait-for-node + run: sudo vagrant provision --provision-with=k3s-wait-for-node - name: "⏳ CoreDNS" - run: vagrant provision --provision-with=k3s-wait-for-coredns + run: sudo vagrant provision --provision-with=k3s-wait-for-coredns - name: "⏳ Local Storage" - run: vagrant provision --provision-with=k3s-wait-for-local-storage + run: sudo vagrant provision --provision-with=k3s-wait-for-local-storage continue-on-error: true - name: "⏳ Metrics Server" - run: vagrant provision --provision-with=k3s-wait-for-metrics-server + run: sudo vagrant provision --provision-with=k3s-wait-for-metrics-server continue-on-error: true - name: "⏳ Traefik" - run: vagrant provision --provision-with=k3s-wait-for-traefik + run: sudo vagrant provision --provision-with=k3s-wait-for-traefik continue-on-error: true - name: "k3s-status" - run: vagrant provision --provision-with=k3s-status + run: sudo vagrant provision --provision-with=k3s-status - name: "k3s-procps" - run: vagrant provision --provision-with=k3s-procps + run: sudo vagrant provision --provision-with=k3s-procps + - name: Cleanup VM + run: sudo vagrant destroy -f + - name: On Failure, launch debug session + uses: lhotari/action-upterm@v1 + if: ${{ failure() }} + with: + ## If no one connects after 5 minutes, shut down server. + wait-timeout-minutes: 5 \ No newline at end of file diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 053be2b11f27..733cb5a33711 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -65,9 +65,11 @@ jobs: mkdir -p $GOCOVERDIR sudo -E env "PATH=$PATH" go test -v -timeout=45m ./tests/integration/${{ matrix.itest }}/... -run Integration - name: On Failure, Launch Debug Session + uses: lhotari/action-upterm@v1 if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 5 + with: + ## If no one connects after 5 minutes, shut down server. + wait-timeout-minutes: 5 - name: Generate coverage report run: go tool covdata textfmt -i $GOCOVERDIR -o ${{ matrix.itest }}.out - name: Upload Results To Codecov diff --git a/.github/workflows/nightly-install.yaml b/.github/workflows/nightly-install.yaml index dd8ee48fe656..ad52dd034fb8 100644 --- a/.github/workflows/nightly-install.yaml +++ b/.github/workflows/nightly-install.yaml @@ -10,7 +10,7 @@ permissions: jobs: test: name: "Smoke Test" - runs-on: macos-12 + runs-on: ubuntu-latest timeout-minutes: 40 strategy: fail-fast: false @@ -28,14 +28,16 @@ jobs: uses: actions/checkout@v4 with: {fetch-depth: 1} - name: "Vagrant Cache" - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | - ~/.vagrant.d/boxes - ~/.vagrant.d/gems + /root/.vagrant.d/boxes + /root/.vagrant.d/gems key: install-${{ matrix.vm }}-${{ hashFiles('tests/install/${{ matrix.vm }}/Vagrantfile') }} id: vagrant-cache continue-on-error: true + - name: Set up vagrant and libvirt + uses: ./.github/actions/vagrant-setup - name: "Vagrant Plugin(s)" run: vagrant plugin install vagrant-k3s vagrant-reload - name: "Vagrant Up ⏩ Install K3s" diff --git a/.github/workflows/snapshotter.yaml b/.github/workflows/snapshotter.yaml index c342f068dc3a..0705ace1ccaa 100644 --- a/.github/workflows/snapshotter.yaml +++ b/.github/workflows/snapshotter.yaml @@ -29,8 +29,7 @@ jobs: test: name: "Smoke Test" needs: build - # nested virtualization is only available on macOS hosts - runs-on: macos-12 + runs-on: ubuntu-latest timeout-minutes: 40 strategy: fail-fast: false @@ -51,23 +50,25 @@ jobs: uses: actions/download-artifact@v3 with: { name: k3s, path: dist/artifacts/ } - name: "Vagrant Cache" - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | - ~/.vagrant.d/boxes - ~/.vagrant.d/gems + /root/.vagrant.d/boxes + /root/.vagrant.d/gems key: snapshotter-${{ hashFiles(format('tests/snapshotter/{0}/{1}/Vagrantfile', matrix.snapshotter, matrix.vm)) }} id: vagrant-cache continue-on-error: true + - name: Set up vagrant and libvirt + uses: ./.github/actions/vagrant-setup - name: "Vagrant Plugin(s)" - run: vagrant plugin install vagrant-k3s + run: sudo vagrant plugin install vagrant-k3s - name: "Vagrant Up ⏩ Install K3s" - run: vagrant up + run: sudo vagrant up - name: "⏳ Node" - run: vagrant provision --provision-with=k3s-wait-for-node + run: sudo vagrant provision --provision-with=k3s-wait-for-node - name: "⏳ CoreDNS" - run: vagrant provision --provision-with=k3s-wait-for-coredns + run: sudo vagrant provision --provision-with=k3s-wait-for-coredns - name: "k3s-status" # kubectl get node,all -A -o wide - run: vagrant provision --provision-with=k3s-status + run: sudo vagrant provision --provision-with=k3s-status - name: "k3s-snapshots" # if no snapshots then we fail - run: vagrant provision --provision-with=k3s-snapshots + run: sudo vagrant provision --provision-with=k3s-snapshots \ No newline at end of file