From 9b7796fd9a3f8cce601f000f1779fb492a64e512 Mon Sep 17 00:00:00 2001 From: Etienne Audet-Cobello Date: Wed, 4 Sep 2024 11:40:01 -0400 Subject: [PATCH] Add Github action --- .github/workflows/e2e-deleteme.yaml | 40 +++++++++++++++++++++++++++++ .github/workflows/e2e.yaml | 2 ++ hack/ci-e2e-tests.sh | 11 ++------ 3 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/e2e-deleteme.yaml diff --git a/.github/workflows/e2e-deleteme.yaml b/.github/workflows/e2e-deleteme.yaml new file mode 100644 index 00000000..78ea8bde --- /dev/null +++ b/.github/workflows/e2e-deleteme.yaml @@ -0,0 +1,40 @@ +name: E2E Tests + +on: + pull_request: + +permissions: + contents: read + +jobs: + run-e2e-tests: + name: Run E2E Tests + runs-on: [self-hosted, linux, X64, jammy, large] + env: + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} + AWS_REGION: us-east-2 + strategy: + matrix: + ginkgo_focus: + #- "KCP remediation" + #- "MachineDeployment remediation" + - "Workload cluster creation" + #- "Workload cluster scaling" + #- "Workload cluster upgrade" + steps: + - name: Check out repo + uses: actions/checkout@v4 + - name: Install requirements + run: | + sudo apt install make + sudo apt install wget + - name: Increase inotify watches + run: | + # Prevents https://cluster-api.sigs.k8s.io/user/troubleshooting#cluster-api-with-docker----too-many-open-files + sudo sysctl fs.inotify.max_user_watches=1048576 + sudo sysctl fs.inotify.max_user_instances=8192 + - name: Run e2e tests + run: | + sudo ./hack/ci-e2e-tests.sh true aws v0.1.2 diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index d054c4e1..66edb7ec 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -2,6 +2,8 @@ name: E2E Tests on: pull_request: + branches: + - does-not-exist permissions: contents: read diff --git a/hack/ci-e2e-tests.sh b/hack/ci-e2e-tests.sh index 6f5b41b7..31ffcde6 100755 --- a/hack/ci-e2e-tests.sh +++ b/hack/ci-e2e-tests.sh @@ -7,16 +7,12 @@ readonly HACK_DIR="$(realpath $(dirname "${0}"))" cd "$HACK_DIR" readonly SKIP_CLEANUP=${1:-true} -readonly readonly LXD_CHANNEL="5.21/stable" readonly LXC_IMAGE="ubuntu:20.04" readonly K8S_PROFILE_URL="https://raw.githubusercontent.com/canonical/k8s-snap/main/tests/integration/lxd-profile.yaml" readonly K8S_PROFILE_PATH="/tmp/k8s.profile" readonly CONTAINER_NAME="k8s-test" -# User specific paths -readonly USER_CREDENTIALS_PATH="/home/user/.creds" - # Install LXD snap function install_lxd { sudo snap install lxd --channel=$LXD_CHANNEL @@ -63,17 +59,14 @@ function install_tools { lxc exec $CONTAINER_NAME -- bash -c "chmod +x /root/$script && /root/$script /root/.cluster-api/clusterctl.yaml v0.1.2" fi done - - lxc file push $USER_CREDENTIALS_PATH $CONTAINER_NAME/root/.creds - lxc exec $CONTAINER_NAME -- bash -c 'echo "source /root/.creds" >/root/.bashrc' } function init_clusterctl { - lxc exec $CONTAINER_NAME -- bash -c "source /root/.creds && clusterctl init -i aws -b ck8s:v0.1.2 -c ck8s:v0.1.2 --config /root/.cluster-api/clusterctl.yaml" + lxc exec $CONTAINER_NAME -- bash -c "clusterctl init -i aws -b ck8s:v0.1.2 -c ck8s:v0.1.2 --config /root/.cluster-api/clusterctl.yaml" } function run_e2e_tests { - make GINKGO.FOCUS="Workload cluster creation" test-e2e + make USE_EXISTING_CLUSTER=true GINKGO_FOCUS="Workload cluster creation" test-e2e } function write_aws_nuke_config {