Skip to content

Commit

Permalink
Add Github action
Browse files Browse the repository at this point in the history
  • Loading branch information
eaudetcobello committed Sep 4, 2024
1 parent 45b5e97 commit 9b7796f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 9 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/e2e-deleteme.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: E2E Tests

on:
pull_request:
branches:
- does-not-exist

permissions:
contents: read
Expand Down
11 changes: 2 additions & 9 deletions hack/ci-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 9b7796f

Please sign in to comment.