Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release-1.26] Install and Unit test backports #9645

Merged
merged 6 commits into from Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/actions/setup-go/action.yaml
@@ -0,0 +1,28 @@
name: 'Setup golang with master only caching'
description: 'A composite action that installs golang, but with a caching strategy that only updates the cache on master branch.'
runs:
using: 'composite'
steps:
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod' # Just use whatever version is in the go.mod file
cache: ${{ github.ref == 'refs/heads/master' }}

- name: Prepare for go cache
if: ${{ github.ref != 'refs/heads/master' }}
shell: bash
run: |
echo "GO_CACHE=$(go env GOCACHE)" | tee -a "$GITHUB_ENV"
echo "GO_MODCACHE=$(go env GOMODCACHE)" | tee -a "$GITHUB_ENV"
echo "GO_VERSION=$(go env GOVERSION | tr -d 'go')" | tee -a "$GITHUB_ENV"

- name: Setup read-only cache
if: ${{ github.ref != 'refs/heads/master' }}
uses: actions/cache/restore@v4
with:
path: |
${{ env.GO_MODCACHE }}
${{ env.GO_CACHE }}
key: setup-go-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('go.sum') }}
restore-keys: |
setup-go-${{ runner.os }}-
25 changes: 25 additions & 0 deletions .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
91 changes: 0 additions & 91 deletions .github/workflows/cgroup.yaml

This file was deleted.

69 changes: 45 additions & 24 deletions .github/workflows/install.yaml
Expand Up @@ -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, fedora, opensuse-leap, ubuntu-focal]
max-parallel: 2
vm: [centos-7, rocky-8, fedora, opensuse-leap, ubuntu-2204]
max-parallel: 3
defaults:
run:
working-directory: tests/install/${{ matrix.vm }}
Expand All @@ -41,49 +41,70 @@ jobs:
- name: "Checkout"
uses: actions/checkout@v3
with: {fetch-depth: 1}
- name: Set up vagrant and libvirt
uses: ./.github/actions/vagrant-setup

- name: "Vagrant Cache"
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.vagrant.d/boxes
~/.vagrant.d/gems
key: install-${{ hashFiles(format('tests/install/{0}/Vagrantfile', matrix.vm)) }}
id: vagrant-cache
continue-on-error: true
/tmp/boxes
key: vagrant-box-${{ matrix.vm }}
# Workaround for https://github.com/actions/cache/issues/1319
- name: Move vagrant cache to /root
run: |
mkdir -p /tmp/boxes
sudo rm -rf /root/.vagrant.d/boxes
sudo mv -f /tmp/boxes /root/.vagrant.d
- 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 == 'opensuse-leap'
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
- name: Copy out vagrant boxes for cache
run: |
sudo mv -f /root/.vagrant.d/boxes /tmp/boxes
sudo chmod -R 777 /tmp/boxes
15 changes: 5 additions & 10 deletions .github/workflows/integration.yaml
Expand Up @@ -43,14 +43,7 @@ jobs:
with:
fetch-depth: 1
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.21.7'
check-latest: true
cache: true
cache-dependency-path: |
**/go.sum
**/go.mod
uses: ./.github/actions/setup-go
- name: "Download k3s binary"
uses: actions/download-artifact@v3
with:
Expand All @@ -61,6 +54,8 @@ jobs:
chmod +x ./dist/artifacts/k3s
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
32 changes: 19 additions & 13 deletions .github/workflows/nightly-install.yaml
Expand Up @@ -10,18 +10,14 @@ permissions:
jobs:
test:
name: "Smoke Test"
runs-on: macos-12
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
channel: [stable]
vm: [centos-7, rocky-8, fedora, opensuse-leap, ubuntu-focal]
include:
- {channel: latest, vm: rocky-8}
- {channel: latest, vm: ubuntu-focal}
- {channel: latest, vm: opensuse-leap}
max-parallel: 2
channel: [stable, latest]
vm: [rocky-8, fedora, opensuse-leap, ubuntu-2204]
max-parallel: 4
defaults:
run:
working-directory: tests/install/${{ matrix.vm }}
Expand All @@ -31,15 +27,21 @@ jobs:
- name: "Checkout"
uses: actions/checkout@v3
with: {fetch-depth: 1}
- name: Set up vagrant and libvirt
uses: ./.github/actions/vagrant-setup
# Workaround for https://github.com/actions/cache/issues/1319
- name: Move vagrant cache to /root
run: |
mkdir -p /tmp/boxes
sudo rm -rf /root/.vagrant.d/boxes
sudo mv -f /tmp/boxes /root/.vagrant.d
- name: "Vagrant Cache"
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.vagrant.d/boxes
~/.vagrant.d/gems
key: install-${{ matrix.vm }}-${{ hashFiles('tests/install/${{ matrix.vm }}/Vagrantfile') }}
/tmp/boxes
key: vagrant-box-${{ matrix.vm }}
id: vagrant-cache
continue-on-error: true
- name: "Vagrant Plugin(s)"
run: vagrant plugin install vagrant-k3s vagrant-reload
- name: "Vagrant Up ⏩ Install K3s"
Expand All @@ -61,3 +63,7 @@ jobs:
run: vagrant provision --provision-with=k3s-status
- name: "k3s-procps"
run: vagrant provision --provision-with=k3s-procps
- name: Copy out vagrant boxes for cache
run: |
sudo mv -f /root/.vagrant.d/boxes /tmp/boxes
sudo chmod -R 777 /tmp/boxes