Add CRC testing against Ubuntu #424
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: QE Testing (Ubuntu-hosted) | ||
on: | ||
# pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
# Schedule a daily cron at midnight UTC | ||
schedule: | ||
- cron: '0 0 * * *' | ||
env: | ||
QE_REPO: test-network-function/cnfcert-tests-verification | ||
jobs: | ||
qe-testing: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
suite: [accesscontrol, affiliatedcertification, manageability, networking, lifecycle, performance, platformalteration, observability, operator] | ||
env: | ||
SHELL: /bin/bash | ||
KUBECONFIG: '/home/runner/.kube/config' | ||
PFLT_DOCKERCONFIG: '/home/runner/.docker/config' | ||
TEST_TNF_IMAGE_NAME: quay.io/testnetworkfunction/cnf-certification-test | ||
TEST_TNF_IMAGE_TAG: localtest | ||
DOCKER_CONFIG_DIR: '/home/runner/.docker/' | ||
SKIP_PRELOAD_IMAGES: true | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.sha }} | ||
- name: Run initial setup | ||
uses: ./.github/actions/setup | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y python3-pip | ||
sudo pip3 install j2cli | ||
- name: Build the test image | ||
uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 90 | ||
max_attempts: 3 | ||
command: make build-image-local # quay.io/testnetworkfunction/cnf-certification-test:localtest | ||
- name: Install required packages for Linux | ||
run: | | ||
sudo apt-get update | ||
sudo apt install qemu-kvm libvirt-daemon libvirt-daemon-system network-manager jq | ||
if: runner.os == 'Linux' | ||
- name: Enable KVM group perms | ||
run: | | ||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
sudo udevadm control --reload-rules | ||
sudo udevadm trigger --name-match=kvm | ||
sudo apt-get update | ||
sudo apt-get install -y libvirt-clients libvirt-daemon-system libvirt-daemon virtinst bridge-utils qemu qemu-system-x86 | ||
sudo usermod -a -G kvm,libvirt $USER | ||
sudo adduser `id -un` libvirt | ||
- name: reload the terminal to load the libvirt group | ||
run: | | ||
sudo -E bash -c 'exec su -l '$USER | ||
if: runner.os == 'Linux' | ||
- name: Check kvm | ||
run: | | ||
sudo apt-get install cpu-checker | ||
egrep -c '(vmx|svm)' /proc/cpuinfo | ||
kvm-ok | ||
- name: Check if user is part of libvirt group | ||
run: | | ||
groups | ||
sudo usermod -a -G libvirt $USER | ||
groups | ||
if: runner.os == 'Linux' | ||
- name: Disable default go problem matcher | ||
run: echo "::remove-matcher owner=go::" | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.sha }} | ||
- name: check if CRC_PULL_SECRET exists | ||
env: | ||
super_secret: ${{ secrets.CRC_PULL_SECRET }} | ||
if: ${{ env.super_secret == '' }} | ||
run: 'echo the secret \"CRC_PULL_SECRET\" has not been made; echo please go to \"settings \> secrets \> actions\" to create it' | ||
- name: Write the pull secret to json file | ||
run: | | ||
echo $CRC_PULL_SECRET > temp-ps.json | ||
cat temp-ps.json | ||
env: | ||
CRC_PULL_SECRET: ${{ secrets.CRC_PULL_SECRET }} | ||
shell: bash | ||
# Create a OpenShift Local Cluster for testing | ||
- name: Download the CRC binary (Linux) | ||
run: | | ||
wget -O crc-linux-amd64.tar.xz https://developers.redhat.com/content-gateway/file/pub/openshift-v4/clients/crc/2.31.0/crc-linux-amd64.tar.xz | ||
tar xvf crc-linux-amd64.tar.xz | ||
sudo mv crc-linux-*/crc /usr/local/bin/ | ||
if: runner.os == 'Linux' | ||
- name: Set Microshift Preset | ||
uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 5 | ||
max_attempts: 3 | ||
command: crc config set preset microshift | ||
- name: Set Telemetry | ||
uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 5 | ||
max_attempts: 3 | ||
command: crc config set consent-telemetry yes | ||
- name: Set Network-Mode User | ||
uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 5 | ||
max_attempts: 3 | ||
command: crc config set network-mode user | ||
- name: Run CRC Setup | ||
uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 15 | ||
max_attempts: 3 | ||
command: sudo -su $USER crc setup | ||
- name: Run CRC Start | ||
uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 30 | ||
max_attempts: 3 | ||
command: sudo -su $USER crc start --pull-secret-file temp-ps.json --log-level debug | ||
on_retry_command: sudo -su $USER crc delete -f | ||
- name: Wait until node is Ready state | ||
run: | | ||
while [[ $(oc get nodes --request-timeout='30s' -o json | jq -r '.items[] | select(.metadata.name=="api.crc.testing") | .status.conditions[] | select(.reason=="KubeletReady") | .status') == "False" ]]; do | ||
echo "Waiting for node to be in Ready state" | ||
sleep 5 | ||
done | ||
- name: Set the adm policy | ||
run: | | ||
oc adm policy add-scc-to-user privileged user | ||
- name: Run oc version | ||
run: | | ||
eval $(crc oc-env) | ||
oc version | ||
oc get nodes | ||
oc get pods -A | ||
# Create a Kind cluster for testing. | ||
- name: Check out `cnf-certification-test-partner` | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: test-network-function/cnf-certification-test-partner | ||
path: cnf-certification-test-partner | ||
- name: Install partner resources | ||
uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 90 | ||
max_attempts: 3 | ||
command: cd ${GITHUB_WORKSPACE}/cnf-certification-test-partner; make install-for-qe | ||
- name: Show pods | ||
run: oc get pods -A | ||
- name: Wait for all pods to be ready | ||
run: ./scripts/wait-for-all-pods-running.sh | ||
working-directory: cnf-certification-test-partner | ||
- name: Clone the QE repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ env.QE_REPO }} | ||
path: cnfcert-tests-verification | ||
ref: main | ||
- name: Extract dependent Pull Requests | ||
uses: depends-on/depends-on-action@main | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Run the tests | ||
uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 60 | ||
max_attempts: 3 | ||
command: cd ${GITHUB_WORKSPACE}/cnfcert-tests-verification; FEATURES=${{matrix.suite}} TNF_REPO_PATH=${GITHUB_WORKSPACE} TNF_IMAGE=${{env.TEST_TNF_IMAGE_NAME}} TNF_IMAGE_TAG=${{env.TEST_TNF_IMAGE_TAG}} DISABLE_INTRUSIVE_TESTS=true ENABLE_PARALLEL=true ENABLE_FLAKY_RETRY=true make test-features | ||
- name: (if on main and upstream) Send chat msg to dev team if failed to run QE tests | ||
if: ${{ failure() && github.ref == 'refs/heads/main' && github.repository_owner == 'test-network-function' }} | ||
env: | ||
COMMIT_SHA: ${{ github.sha }} | ||
JOB_RUN_ID: ${{ github.run_id }} | ||
JOB_RUN_ATTEMPT: ${{ github.run_attempt }} | ||
GITHUB_REPO: https://github.com/test-network-function/cnf-certification-test | ||
run: | | ||
curl -X POST --data "{ | ||
\"text\": \"🚨⚠️ Failed to run Github hosted QE tests from commit \<$GITHUB_REPO/commit/$COMMIT_SHA|$COMMIT_SHA\>, job ID \<$GITHUB_REPO/actions/runs/$JOB_RUN_ID/attempts/$JOB_RUN_ATTEMPT|$JOB_RUN_ID\> \" | ||
}" -H 'Content-type: application/json; charset=UTF-8' '${{ secrets.QE_NIGHTLY_WEBHOOK }}' |