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 scripts/ebuild_logs.tar.xz
test: test:
name: "Run kola tests"
needs: packages needs: packages
name: "Run kola tests"
uses: ./.github/workflows/run-kola-tests.yaml 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: inputs:
workflow_name_or_id: workflow_name_or_id:
type: string type: string
required: true required: false
default: ci.yaml default: ci.yaml
description: | description: |
The workflow ID from where we'll download the artifacts to be tested. The workflow ID from where we'll download the artifacts to be tested.
workflow_run_id: workflow_run_id:
type: string type: string
required: true required: false
description: | description: |
The run ID of the workflow specified in workflow_name_or_id The run ID of the workflow specified in workflow_name_or_id
jobs: jobs:
tests: tests:
name: "Build Flatcar packages" name: "Run Kola tests"
runs-on: runs-on:
- self-hosted - self-hosted
- debian - debian
@ -34,7 +34,7 @@ jobs:
run: | run: |
sudo rm /bin/sh sudo rm /bin/sh
sudo ln -s /bin/bash /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 stop dnsmasq
sudo systemctl mask 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 \ "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 $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# 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/
# Set up MASQUERADE. Don't care much to secure it. # Set up MASQUERADE. Don't care much to secure it.
# This is needed for the VMs kola spins up to have internet access. # This is needed for the VMs kola spins up to have internet access.
@ -60,10 +54,15 @@ jobs:
sudo iptables -I FORWARD -o $DEFAULT_ROUTE_DEVICE -j ACCEPT sudo iptables -I FORWARD -o $DEFAULT_ROUTE_DEVICE -j ACCEPT
sudo iptables -I FORWARD -i $DEFAULT_ROUTE_DEVICE -j ACCEPT sudo iptables -I FORWARD -i $DEFAULT_ROUTE_DEVICE -j ACCEPT
# 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 # Enable IP forward
echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/ip_forward.conf echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/ip_forward.conf
# Enable unprivileged bpf # Enable unprivileged bpf
echo 'kernel.unprivileged_bpf_disabled=0' | sudo tee /etc/sysctl.d/enable_unprivileged_bpf.conf echo 'kernel.unprivileged_bpf_disabled=0' | sudo tee /etc/sysctl.d/enable_unprivileged_bpf.conf
sudo sysctl --system sudo sysctl --system
sysctl -p sysctl -p
@ -72,7 +71,7 @@ jobs:
sudo chmod 600 /swap.img sudo chmod 600 /swap.img
sudo mkswap /swap.img sudo mkswap /swap.img
sudo swapon /swap.img sudo swapon /swap.img
fi
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -80,12 +79,19 @@ jobs:
fetch-depth: 0 fetch-depth: 0
submodules: true submodules: true
- name: Download artifacts - name: Download artifact
uses: gabriel-samfira/action-download-artifact@v5 if: ${{ !inputs.workflow_run_id }}
uses: actions/download-artifact@v3
with: 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 workflow_conclusion: success
run_id: ${{ github.event.inputs.workflow_run_id }} run_id: ${{ inputs.workflow_run_id }}
name: images-${{ matrix.arch }} name: images-${{ matrix.arch }}
- name: Run tests - name: Run tests
@ -97,21 +103,33 @@ jobs:
# extract the image. # extract the image.
IMG_ARCHIVE=$(readlink -f images/**/flatcar_production_image.bin.bz2) 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} bzip2 --decompress ${IMG_ARCHIVE}
# export the QEMU_IMAGE_NAME to avoid to download it.
cp ${IMG_ARCHIVE%%.bz2} ./scripts/ cp ${IMG_ARCHIVE%%.bz2} ./scripts/
cp ${QEMU_UEFI_BIOS_FILE} ./scripts/
pushd scripts pushd scripts
pwd
source ci-automation/test.sh 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 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 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 EOF
export MAX_RETRIES=2
export MAX_RETRIES=5
export SKIP_COPY_TO_BINCACHE=1 export SKIP_COPY_TO_BINCACHE=1
# run the test. # run the test.
test_run ${{ matrix.arch }} qemu test_run ${{ matrix.arch }} qemu_uefi
- name: Upload artifacts - name: Upload artifacts
if: always() if: always()
@ -121,4 +139,3 @@ jobs:
path: | path: |
scripts/__TESTS__ scripts/__TESTS__
scripts/results-.*.tap scripts/results-.*.tap