From cb3f958f91f8f822c4a14538a246de3270cfdff9 Mon Sep 17 00:00:00 2001 From: David Edler Date: Wed, 13 Nov 2024 13:35:29 +0100 Subject: [PATCH] chore(ci) set environment variables for e2e tests Signed-off-by: David Edler --- .github/workflows/tests.yml | 62 ++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 81d54d86c7cb..119edb8b2eaf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -499,27 +499,25 @@ jobs: runs-on: ubuntu-latest needs: [code-tests, documentation] if: "!startsWith(github.ref, 'refs/heads/stable-')" - + env: + LXD_DIR: "/var/lib/lxd" + LXD_OIDC_CLIENT_ID: "gxj297yfAjmklILK5WqPWDSbtVBAeSQm" + LXD_OIDC_ISSUER: "https://dev-xjrvvfikbsv4jxn7.us.auth0.com/" + LXD_OIDC_AUDIENCE: "https://dev-xjrvvfikbsv4jxn7.us.auth0.com/api/v2/" + LXD_OIDC_USER: "lxd-ui-e2e-tests@example.org" + LXD_OIDC_PASSWORD: "lxd-ui-e2e-password" + LXD_OIDC_GROUPS_CLAIM: "lxd-idp-groups" steps: - name: Checkout code uses: actions/checkout@v4 - - name: Performance tuning - run: | - set -eux - # optimize ext4 FSes for performance, not reliability - for fs in $(findmnt --noheading --type ext4 --list --uniq | awk '{print $1}'); do - # nombcache and data=writeback cannot be changed on remount - sudo mount -o remount,noatime,barrier=0,commit=6000 "${fs}" || true - done - - # disable dpkg from calling sync() - echo "force-unsafe-io" | sudo tee /etc/dpkg/dpkg.cfg.d/force-unsafe-io + - name: Tune disk performance + uses: ./.github/actions/tune-disk-performance - - name: Install Go (1.22) - uses: actions/setup-go@v5 + - name: Install Go + uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 with: - go-version: 1.22.x + go-version-file: 'go.mod' - name: Install dependencies run: | @@ -607,6 +605,7 @@ jobs: export CGO_LDFLAGS="-L/home/runner/work/lxd/lxd-test/vendor/dqlite/.libs/" export LD_LIBRARY_PATH="/home/runner/work/lxd/lxd-test/vendor/dqlite/.libs/" export LXD_DOCUMENTATION="/home/runner/work/lxd/lxd/doc/_build/" + export PATH="/home/runner/go/bin:$PATH" sudo rm -rf /var/lib/lxd sudo -E PATH=${PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} $(go env GOPATH)/bin/lxd --group sudo & @@ -614,14 +613,15 @@ jobs: shell: bash run: | set -eux - sudo LXD_DIR=/var/lib/lxd lxc storage create local-storage zfs - sudo LXD_DIR=/var/lib/lxd lxc profile device add default root disk path=/ pool=local-storage - sudo LXD_DIR=/var/lib/lxd lxc network create local-network - sudo LXD_DIR=/var/lib/lxd lxc profile device add default eth0 nic network=local-network - sudo LXD_DIR=/var/lib/lxd lxc config set core.https_address "[::]:8443" - sudo LXD_DIR=/var/lib/lxd lxc config set cluster.https_address "127.0.0.1" - sudo LXD_DIR=/var/lib/lxd lxc cluster enable local - sudo LXD_DIR=/var/lib/lxd lxc config set user.show_permissions=true + export PATH="/home/runner/go/bin:$PATH" + sudo -E LXD_DIR=/var/lib/lxd lxc storage create default zfs + sudo -E LXD_DIR=/var/lib/lxd lxc profile device add default root disk path=/ pool=default + sudo -E LXD_DIR=/var/lib/lxd lxc network create local-network + sudo -E LXD_DIR=/var/lib/lxd lxc profile device add default eth0 nic network=local-network + sudo -E LXD_DIR=/var/lib/lxd lxc config set core.https_address "[::]:8443" + sudo -E LXD_DIR=/var/lib/lxd lxc config set cluster.https_address "127.0.0.1" + sudo -E LXD_DIR=/var/lib/lxd lxc cluster enable local + sudo -E LXD_DIR=/var/lib/lxd lxc config set user.show_permissions=true - name: Checkout LXD-UI uses: actions/checkout@v4 @@ -673,15 +673,17 @@ jobs: shell: bash run: | set -eux - sudo LXD_DIR=/var/lib/lxd lxc config trust add lxd-ui/keys/lxd-ui.crt + export PATH="/home/runner/go/bin:$PATH" + sudo -E LXD_DIR=/var/lib/lxd lxc config trust add lxd-ui/keys/lxd-ui.crt - name: Create a custom image shell: bash run: | set -eux - sudo LXD_DIR=/var/lib/lxd lxc launch ubuntu-minimal:22.04 my-instance - sudo LXD_DIR=/var/lib/lxd lxc publish my-instance --alias my-custom-image --force - sudo LXD_DIR=/var/lib/lxd lxc delete my-instance --force + export PATH="/home/runner/go/bin:$PATH" + sudo -E LXD_DIR=/var/lib/lxd lxc launch ubuntu-minimal:22.04 my-instance + sudo -E LXD_DIR=/var/lib/lxd lxc publish my-instance --alias my-custom-image --force + sudo -E LXD_DIR=/var/lib/lxd lxc delete my-instance --force - uses: actions/setup-node@v4 with: @@ -697,13 +699,15 @@ jobs: shell: bash run: | set -eux - sudo LXD_DIR=/var/lib/lxd PATH=/home/runner/go/bin:$PATH ./lxd-ui/tests/scripts/setup_test + sudo -E LXD_DIR=/var/lib/lxd PATH=/home/runner/go/bin:$PATH ./lxd-ui/tests/scripts/setup_test - name: Run Playwright tests run: | set -eux cd lxd-ui - CI=true DISABLE_VM_TESTS=true npx playwright test --project chromium:lxd-latest-edge + sudo chown $USER -R /home/runner/.config + sudo chown $USER /var/lib/lxd/unix.socket + CI=true DISABLE_VM_TESTS=true LXD_DIR=/var/lib/lxd PATH=/home/runner/go/bin:$PATH npx playwright test --project chromium:lxd-latest-edge #npx playwright test --project chromium:lxd-5.21-edge #npx playwright test --project lxd-5.0-edge