Skip to content

Commit 2e7328a

Browse files
committed
ci: Run Nutanix provider e2e tests on self-hosted runner
1 parent d6d7b61 commit 2e7328a

File tree

3 files changed

+55
-163
lines changed

3 files changed

+55
-163
lines changed

.github/workflows/checks.yml

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -59,32 +59,15 @@ jobs:
5959
matrix:
6060
provider:
6161
- Docker
62+
- Nutanix
6263
# Uncomment below once we have the ability to run e2e tests on other providers from GHA.
6364
# - AWS
6465
fail-fast: false
6566
uses: ./.github/workflows/e2e.yml
6667
with:
6768
provider: ${{ matrix.provider }}
6869
focus: Quick start
69-
secrets: inherit
70-
permissions:
71-
contents: read
72-
checks: write
73-
74-
# The actions runner controller does not support using multiple labels to target the runners so we have to create separate jobs for self-hosted runners.
75-
# https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners-with-actions-runner-controller/using-actions-runner-controller-runners-in-a-workflow#using-runner-scale-set-names
76-
e2e-quick-start-custom-runner:
77-
strategy:
78-
matrix:
79-
provider:
80-
- Nutanix
81-
# Uncomment below once we have the ability to run e2e tests on other providers via self-hosted runners.
82-
# - Vsphere (example)
83-
fail-fast: false
84-
uses: ./.github/workflows/e2e-custom-runner.yml
85-
with:
86-
provider: ${{ matrix.provider }}
87-
focus: Quick start
70+
runs-on: ${{ matrix.provider == 'Nutanix' && 'self-hosted-ncn-dind' || 'ubuntu-22.04' }}
8871
secrets: inherit
8972
permissions:
9073
contents: read
@@ -95,32 +78,15 @@ jobs:
9578
matrix:
9679
provider:
9780
- Docker
81+
- Nutanix
9882
# Uncomment below once we have the ability to run e2e tests on other providers from GHA.
9983
# - AWS
10084
fail-fast: false
10185
uses: ./.github/workflows/e2e.yml
10286
with:
10387
provider: ${{ matrix.provider }}
10488
focus: Self-hosted
105-
secrets: inherit
106-
permissions:
107-
contents: read
108-
checks: write
109-
110-
# The actions runner controller does not support using multiple labels to target the runners so we have to create separate jobs for self-hosted runners.
111-
# https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners-with-actions-runner-controller/using-actions-runner-controller-runners-in-a-workflow#using-runner-scale-set-names
112-
e2e-self-hosted-custom-runner:
113-
strategy:
114-
matrix:
115-
provider:
116-
- Nutanix
117-
# Uncomment below once we have the ability to run e2e tests on other providers via self-hosted runners.
118-
# - Vsphere (example)
119-
fail-fast: false
120-
uses: ./.github/workflows/e2e-custom-runner.yml
121-
with:
122-
provider: ${{ matrix.provider }}
123-
focus: Self-hosted
89+
runs-on: ${{ matrix.provider == 'Nutanix' && 'self-hosted-ncn-dind' || 'ubuntu-22.04' }}
12490
secrets: inherit
12591
permissions:
12692
contents: read

.github/workflows/e2e-custom-runner.yml

Lines changed: 0 additions & 111 deletions
This file was deleted.

.github/workflows/e2e.yml

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ on:
1414
focus:
1515
description: e2e tests to focus
1616
type: string
17+
runs-on:
18+
description: The runner to run the e2e tests on
19+
type: string
20+
required: true
1721

1822
jobs:
1923
e2e-test:
20-
runs-on: ubuntu-22.04
24+
runs-on: ${{ inputs.runs-on }}
2125
permissions:
2226
contents: read
2327
checks: write
@@ -30,17 +34,7 @@ jobs:
3034
- name: Install devbox
3135
uses: jetify-com/[email protected]
3236
with:
33-
enable-cache: true
34-
35-
- name: Go cache
36-
uses: actions/cache@v4
37-
with:
38-
path: |
39-
~/.cache/go-build
40-
~/go/pkg/mod
41-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
42-
restore-keys: |
43-
${{ runner.os }}-go-
37+
enable-cache: "true"
4438

4539
# The default disk size of these runners is ~14GB, this is not enough to run the e2e tests.
4640
# Cleanup the disk, see upstream discussion https://github.com/actions/runner-images/issues/2840.
@@ -51,17 +45,60 @@ jobs:
5145
sudo rm -rf /usr/share/dotnet
5246
sudo rm -rf /opt/ghc
5347
sudo rm -rf "/usr/local/share/boost"
54-
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
48+
sudo rm -rf "${AGENT_TOOLSDIRECTORY}"
5549
echo "After removing files:"
5650
df -h
5751
52+
- name: Get Control Plane endpoint IP
53+
id: get-control-plane-endpoint-ip
54+
if: inputs.provider == 'Nutanix'
55+
run: |
56+
# Get all available IPs in the range
57+
mapfile -t available_ips <<< "$(fping -g -u '${{ secrets.NUTANIX_CONTROL_PLANE_ENDPOINT_RANGE_START }}' '${{ secrets.NUTANIX_CONTROL_PLANE_ENDPOINT_RANGE_END }}')"
58+
59+
# Get the number of available IPs
60+
num_ips="${#available_ips[@]}"
61+
62+
if [ "${num_ips}" -eq 0 ]; then
63+
echo "No available IPs found"
64+
exit 1
65+
fi
66+
67+
# Get a random index
68+
random_index="$((RANDOM % num_ips +1))"
69+
70+
# Get the random IP
71+
control_plane_endpoint_ip="${available_ips[${random_index}]}"
72+
73+
# Set the random IP as an output variable
74+
echo "control_plane_endpoint_ip=${control_plane_endpoint_ip}" >> "${GITHUB_OUTPUT}"
75+
76+
- name: Go cache
77+
uses: actions/cache@v4
78+
with:
79+
path: |
80+
~/.cache/go-build
81+
~/go/pkg/mod
82+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
83+
restore-keys: |
84+
${{ runner.os }}-go-
85+
5886
- name: Run e2e tests
5987
run: devbox run -- make e2e-test E2E_LABEL='provider:${{ inputs.provider }}' E2E_SKIP='${{ inputs.skip }}' E2E_FOCUS='${{ inputs.focus }}'
6088
env:
6189
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
91+
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
6292
NUTANIX_ENDPOINT: ${{ secrets.NUTANIX_ENDPOINT }}
63-
NUTANIX_PASSWORD: ${{ secrets.NUTANIX_PASSWORD }}
6493
NUTANIX_USER: ${{ secrets.NUTANIX_USER }}
94+
NUTANIX_PASSWORD: ${{ secrets.NUTANIX_PASSWORD }}
95+
NUTANIX_PORT: ${{ vars.NUTANIX_PORT }}
96+
NUTANIX_INSECURE: ${{ vars.NUTANIX_INSECURE }}
97+
NUTANIX_PRISM_ELEMENT_CLUSTER_NAME: ${{ vars.NUTANIX_PRISM_ELEMENT_CLUSTER_NAME }}
98+
NUTANIX_SUBNET_NAME: ${{ vars.NUTANIX_SUBNET_NAME }}
99+
NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME: ${{ vars.NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME }}
100+
NUTANIX_STORAGE_CONTAINER_NAME: ${{ vars.NUTANIX_STORAGE_CONTAINER_NAME }}
101+
CONTROL_PLANE_ENDPOINT_IP: ${{ steps.get-control-plane-endpoint-ip.outputs.control_plane_endpoint_ip }}
65102

66103
- if: success() || failure() # always run even if the previous step fails
67104
name: Publish e2e test report

0 commit comments

Comments
 (0)