Skip to content

Commit 87cd1a3

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

File tree

5 files changed

+48
-164
lines changed

5 files changed

+48
-164
lines changed

.github/actionlint.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright 2024 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
14
self-hosted-runner:
25
# Labels of self-hosted runner in array of string
36
labels:

.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: 39 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
@@ -27,20 +31,16 @@ jobs:
2731
with:
2832
fetch-depth: 0
2933

30-
- name: Install devbox
31-
uses: jetify-com/[email protected]
34+
- uses: cachix/install-nix-action@V27
35+
if: inputs.provider == 'Nutanix'
3236
with:
33-
enable-cache: true
37+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
3438

35-
- name: Go cache
36-
uses: actions/cache@v4
39+
- name: Install devbox
40+
uses: jetify-com/[email protected]
3741
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-
42+
enable-cache: "true"
43+
skip-nix-installation: ${{ inputs.provider == 'Nutanix' }}
4444

4545
# The default disk size of these runners is ~14GB, this is not enough to run the e2e tests.
4646
# Cleanup the disk, see upstream discussion https://github.com/actions/runner-images/issues/2840.
@@ -51,17 +51,42 @@ jobs:
5151
sudo rm -rf /usr/share/dotnet
5252
sudo rm -rf /opt/ghc
5353
sudo rm -rf "/usr/local/share/boost"
54-
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
54+
sudo rm -rf "${AGENT_TOOLSDIRECTORY}"
5555
echo "After removing files:"
5656
df -h
5757
58+
- name: Get Control Plane endpoint IP
59+
id: get-control-plane-endpoint-ip
60+
if: inputs.provider == 'Nutanix'
61+
run: |
62+
control_plane_endpoint_ip="$(devbox run -- fping -g -u "${CONTROL_PLANE_ENDPOINT_RANGE_START}" "${CONTROL_PLANE_ENDPOINT_RANGE_END}" 2>/dev/null | devbox run -- shuf --head-count=1)"
63+
echo "control_plane_endpoint_ip=${control_plane_endpoint_ip}" >> "${GITHUB_OUTPUT}"
64+
- name: Go cache
65+
uses: actions/cache@v4
66+
with:
67+
path: |
68+
~/.cache/go-build
69+
~/go/pkg/mod
70+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
71+
restore-keys: |
72+
${{ runner.os }}-go-
73+
5874
- name: Run e2e tests
5975
run: devbox run -- make e2e-test E2E_LABEL='provider:${{ inputs.provider }}' E2E_SKIP='${{ inputs.skip }}' E2E_FOCUS='${{ inputs.focus }}'
6076
env:
6177
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
79+
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
6280
NUTANIX_ENDPOINT: ${{ secrets.NUTANIX_ENDPOINT }}
63-
NUTANIX_PASSWORD: ${{ secrets.NUTANIX_PASSWORD }}
6481
NUTANIX_USER: ${{ secrets.NUTANIX_USER }}
82+
NUTANIX_PASSWORD: ${{ secrets.NUTANIX_PASSWORD }}
83+
NUTANIX_PORT: ${{ vars.NUTANIX_PORT }}
84+
NUTANIX_INSECURE: ${{ vars.NUTANIX_INSECURE }}
85+
NUTANIX_PRISM_ELEMENT_CLUSTER_NAME: ${{ vars.NUTANIX_PRISM_ELEMENT_CLUSTER_NAME }}
86+
NUTANIX_SUBNET_NAME: ${{ vars.NUTANIX_SUBNET_NAME }}
87+
NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME: ${{ vars.NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME }}
88+
NUTANIX_STORAGE_CONTAINER_NAME: ${{ vars.NUTANIX_STORAGE_CONTAINER_NAME }}
89+
CONTROL_PLANE_ENDPOINT_IP: ${{ steps.get-control-plane-endpoint-ip.outputs.control_plane_endpoint_ip }}
6590

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

test/e2e/self_hosted_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import (
2222
)
2323

2424
var _ = Describe("Self-hosted", Serial, func() {
25-
provider := "Docker"
25+
for _, provider := range []string{"Docker", "Nutanix"} {
26+
lowercaseProvider := strings.ToLower(provider)
2627
lowercaseProvider := strings.ToLower(provider)
2728
for _, cniProvider := range []string{"Cilium", "Calico"} {
2829
for _, addonStrategy := range []string{"HelmAddon", "ClusterResourceSet"} {

0 commit comments

Comments
 (0)