Update kola test workflow

* arm64 tests now run in LXD containers instead of VMs
  * parallelism increased for arm64
  * some setup steps are skipped on arm64

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2022-07-13 14:20:12 +03:00
parent b518c3cdb8
commit 340fd39a9f
No known key found for this signature in database
GPG Key ID: 7D073DCC2C074CB5
2 changed files with 50 additions and 36 deletions

View File

@ -285,9 +285,6 @@ jobs:
scripts/ebuild_logs.tar.xz
test:
name: "Run kola tests"
needs: packages
name: "Run kola tests"
uses: ./.github/workflows/run-kola-tests.yaml
with:
workflow_name_or_id: ${{ github.event.workflow_run.workflow_id }}
workflow_run_id: ${{ github.event.workflow_run.id }}

View File

@ -4,19 +4,19 @@ on:
inputs:
workflow_name_or_id:
type: string
required: true
required: false
default: ci.yaml
description: |
The workflow ID from where we'll download the artifacts to be tested.
workflow_run_id:
type: string
required: true
required: false
description: |
The run ID of the workflow specified in workflow_name_or_id
jobs:
tests:
name: "Build Flatcar packages"
name: "Run Kola tests"
runs-on:
- self-hosted
- debian
@ -34,7 +34,7 @@ jobs:
run: |
sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh
sudo apt-get install -y ca-certificates curl gnupg lsb-release qemu-system qemu-user-static git bzip2 jq dnsmasq
sudo apt-get install -y ca-certificates curl gnupg lsb-release qemu-system git bzip2 jq dnsmasq
sudo systemctl stop dnsmasq
sudo systemctl mask dnsmasq
@ -45,13 +45,7 @@ jobs:
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
# Install latest Go
VERSION=$(curl -s -L https://golang.org/dl/?mode=json | jq -r .[0].version)
curl -s -L https://dl.google.com/go/$VERSION.linux-amd64.tar.gz | sudo tar -xz -C /usr/local
sudo ln -s /usr/local/go/bin/go /usr/local/bin/
sudo ln -s /usr/local/go/bin/gofmt /usr/local/bin/
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# Set up MASQUERADE. Don't care much to secure it.
# This is needed for the VMs kola spins up to have internet access.
@ -60,19 +54,24 @@ jobs:
sudo iptables -I FORWARD -o $DEFAULT_ROUTE_DEVICE -j ACCEPT
sudo iptables -I FORWARD -i $DEFAULT_ROUTE_DEVICE -j ACCEPT
# Enable IP forward
echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/ip_forward.conf
# Enable unprivileged bpf
echo 'kernel.unprivileged_bpf_disabled=0' | sudo tee /etc/sysctl.d/enable_unprivileged_bpf.conf
sudo sysctl --system
sysctl -p
# ARM64 tests run inside an LXD container instead of an LXD Virtual machine
# There are some limitations in terms of what we can customize.
if [ "${{ matrix.arch }}" == "amd64" ];then
# Enable IP forward
echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/ip_forward.conf
# Enable extra SWAP
sudo fallocate /swap.img -l 8GiB
sudo chmod 600 /swap.img
sudo mkswap /swap.img
sudo swapon /swap.img
# Enable unprivileged bpf
echo 'kernel.unprivileged_bpf_disabled=0' | sudo tee /etc/sysctl.d/enable_unprivileged_bpf.conf
sudo sysctl --system
sysctl -p
# Enable extra SWAP
sudo fallocate /swap.img -l 8GiB
sudo chmod 600 /swap.img
sudo mkswap /swap.img
sudo swapon /swap.img
fi
- uses: actions/checkout@v3
with:
@ -80,12 +79,19 @@ jobs:
fetch-depth: 0
submodules: true
- name: Download artifacts
uses: gabriel-samfira/action-download-artifact@v5
- name: Download artifact
if: ${{ !inputs.workflow_run_id }}
uses: actions/download-artifact@v3
with:
workflow: ${{ github.event.inputs.workflow_name_or_id }}
name: images-${{ matrix.arch }}
- name: Download artifacts from other workflow
uses: gabriel-samfira/action-download-artifact@v5
if: ${{ inputs.workflow_run_id }}
with:
workflow: ${{ inputs.workflow_name_or_id }}
workflow_conclusion: success
run_id: ${{ github.event.inputs.workflow_run_id }}
run_id: ${{ inputs.workflow_run_id }}
name: images-${{ matrix.arch }}
- name: Run tests
@ -97,21 +103,33 @@ jobs:
# extract the image.
IMG_ARCHIVE=$(readlink -f images/**/flatcar_production_image.bin.bz2)
QEMU_UEFI_BIOS_FILE=$(readlink -f images/**/flatcar_production_qemu_uefi_efi_code.fd)
bzip2 --decompress ${IMG_ARCHIVE}
# export the QEMU_IMAGE_NAME to avoid to download it.
cp ${IMG_ARCHIVE%%.bz2} ./scripts/
cp ${QEMU_UEFI_BIOS_FILE} ./scripts/
pushd scripts
pwd
source ci-automation/test.sh
PARALLEL_ARCH=2
if [ "${{ matrix.arch }}" == "arm64" ];then
# ARM64 servers have more memory and CPUs
PARALLEL_ARCH=10
fi
cat > sdk_container/.env <<EOF
# export the QEMU_IMAGE_NAME to avoid to download it.
export QEMU_IMAGE_NAME="/work/flatcar_production_image.bin"
export PARALLEL_TESTS=2
export QEMU_UEFI_BIOS="/work/flatcar_production_qemu_uefi_efi_code.fd"
export PARALLEL_TESTS=${PARALLEL_ARCH}
EOF
export MAX_RETRIES=2
export MAX_RETRIES=5
export SKIP_COPY_TO_BINCACHE=1
# run the test.
test_run ${{ matrix.arch }} qemu
test_run ${{ matrix.arch }} qemu_uefi
- name: Upload artifacts
if: always()
@ -121,4 +139,3 @@ jobs:
path: |
scripts/__TESTS__
scripts/results-.*.tap