Skip to content

Commit

Permalink
add debug action
Browse files Browse the repository at this point in the history
  • Loading branch information
eaudetcobello committed Sep 9, 2024
1 parent 0f2f9c5 commit 4b9f63e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/e2e-deleteme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:
jobs:
run-e2e-tests:
name: Run E2E Tests
runs-on: [self-hosted, linux, X64, jammy, large]
runs-on: ubuntu-latest
strategy:
matrix:
ginkgo_focus:
Expand All @@ -21,6 +21,10 @@ jobs:
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
detached: true
- name: Install requirements
run: |
sudo apt install make
Expand Down
29 changes: 22 additions & 7 deletions hack/ci-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ readonly SKIP_CLEANUP=${1:-true}
readonly INFRA_PROVIDER=${2:-aws}
readonly CK8S_PROVIDER_VERSION=${3:-v0.1.2}

readonly LXD_CHANNEL="5.21/stable"
readonly LXD_CHANNEL="6.1/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"
Expand All @@ -40,27 +40,41 @@ function check_required_env_vars {
required_env_vars+=("AWS_REGION" "AWS_ACCESS_KEY_ID" "AWS_SECRET_ACCESS_KEY")
fi

set +x
for var in "${required_env_vars[@]}"; do
if [ -z "${!var}" ]; then
error_exit "Missing required environment variable: $var"
fi
done
set -x
}

function exec_in_container {
lxc exec $CONTAINER_NAME -- bash -c "$1"
}

function setup_firewall {
if sudo iptables -L DOCKER-USER; then
sudo iptables -I DOCKER-USER -i lxdbr0 -j ACCEPT
sudo iptables -I DOCKER-USER -o lxdbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
fi
}

# Install LXD snap
function install_lxd {
sudo snap install lxd --channel=$LXD_CHANNEL
if snap list lxd; then
sudo snap refresh lxd --channel=$LXD_CHANNEL
else
sudo snap install lxd --channel=$LXD_CHANNEL
fi
sudo lxd waitready
sudo lxd init --auto
sudo usermod --append --groups lxd "$USER"
}

# Create or ensure the k8s profile exists
function setup_lxd_profile {
lxc profile create k8s || true
lxc profile show k8s || lxc profile create k8s
wget -q $K8S_PROFILE_URL -O $K8S_PROFILE_PATH
cat $K8S_PROFILE_PATH | lxc profile edit k8s
rm -f $K8S_PROFILE_PATH
Expand All @@ -75,6 +89,7 @@ function setup_container {

exec_in_container "apt update && apt install -y snapd"
exec_in_container "systemctl start snapd"
exec_in_container "snap wait core seed.loaded"

# Script is running from the hack directory, so push the entire directory to the container
lxc file push -r .. $CONTAINER_NAME/root/
Expand All @@ -100,10 +115,9 @@ function configure_container_env {

# Main installation and configuration
function setup_management_cluster {
sleep 5
exec_in_container "snap install k8s --classic --edge"
sleep 1
exec_in_container "snap install go --classic"
sleep 15
exec_in_container "sudo snap install k8s --classic --edge"
exec_in_container "sudo snap install go --classic"
exec_in_container "mkdir -p /root/.kube"
exec_in_container "sudo k8s bootstrap"
exec_in_container "sudo k8s status --wait-ready"
Expand Down Expand Up @@ -176,6 +190,7 @@ function main {
check_required_env_vars
install_lxd
setup_lxd_profile
setup_firewall
setup_container
setup_management_cluster
clone_repos
Expand Down

0 comments on commit 4b9f63e

Please sign in to comment.