Skip to content

Commit 5a46b06

Browse files
Add another e2e workflow that gets run on self-hosted-github runner
This is necessary as we want some e2e jobs to run on hosted runners and some to run on self-hosted runners. The actions runner controller does not support using multiple labels to target the runners See: 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
1 parent 2d2a3f7 commit 5a46b06

File tree

6 files changed

+187
-3
lines changed

6 files changed

+187
-3
lines changed

.github/actionlint.yaml

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

.github/workflows/checks.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ jobs:
6161
- Docker
6262
# Uncomment below once we have the ability to run e2e tests on other providers from GHA.
6363
# - AWS
64-
# - Nutanix
6564
fail-fast: false
6665
uses: ./.github/workflows/e2e.yml
6766
with:
@@ -72,14 +71,32 @@ jobs:
7271
contents: read
7372
checks: write
7473

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
88+
secrets: inherit
89+
permissions:
90+
contents: read
91+
checks: write
92+
7593
e2e-self-hosted:
7694
strategy:
7795
matrix:
7896
provider:
7997
- Docker
8098
# Uncomment below once we have the ability to run e2e tests on other providers from GHA.
8199
# - AWS
82-
# - Nutanix
83100
fail-fast: false
84101
uses: ./.github/workflows/e2e.yml
85102
with:
@@ -90,6 +107,25 @@ jobs:
90107
contents: read
91108
checks: write
92109

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
124+
secrets: inherit
125+
permissions:
126+
contents: read
127+
checks: write
128+
93129
lint-go:
94130
runs-on: ubuntu-22.04
95131
strategy:
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Copyright 2024 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
provider:
8+
description: Infrastructure provider to run e2e tests with
9+
type: string
10+
required: true
11+
skip:
12+
description: e2e tests to skip
13+
type: string
14+
focus:
15+
description: e2e tests to focus
16+
type: string
17+
18+
jobs:
19+
e2e-test:
20+
runs-on: "self-hosted-ncn-dind"
21+
permissions:
22+
contents: read
23+
checks: write
24+
steps:
25+
- name: Check out code
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- uses: cachix/install-nix-action@V27
31+
if: inputs.provider == 'Nutanix'
32+
with:
33+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Install Devbox
36+
uses: jetify-com/[email protected]
37+
with:
38+
enable-cache: "true"
39+
skip-nix-installation: ${{ inputs.provider == 'Nutanix' }}
40+
41+
- name: Go cache
42+
uses: actions/cache@v4
43+
with:
44+
path: |
45+
~/.cache/go-build
46+
~/go/pkg/mod
47+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
48+
restore-keys: |
49+
${{ runner.os }}-go-
50+
51+
- name: Set IP range based on provider
52+
run: |
53+
if [[ "${{ inputs.provider }}" == "Nutanix" ]]; then
54+
CONTROL_PLANE_ENDPOINT_RANGE_START="${{ secrets.NUTANIX_CONTROL_PLANE_ENDPOINT_RANGE_START }}"
55+
CONTROL_PLANE_ENDPOINT_RANGE_END="${{ secrets.NUTANIX_CONTROL_PLANE_ENDPOINT_RANGE_END }}"
56+
fi
57+
echo "CONTROL_PLANE_ENDPOINT_RANGE_START=$CONTROL_PLANE_ENDPOINT_RANGE_START" >> "$GITHUB_ENV"
58+
echo "CONTROL_PLANE_ENDPOINT_RANGE_END=$CONTROL_PLANE_ENDPOINT_RANGE_END" >> "$GITHUB_ENV"
59+
60+
- name: Get Control Plane endpoint IP
61+
id: get-control-plane-endpoint-ip
62+
run: |
63+
control_plane_endpoint_ip=$(fping -g -u "$CONTROL_PLANE_ENDPOINT_RANGE_START" "$CONTROL_PLANE_ENDPOINT_RANGE_END" 2>/dev/null | shuf --head-count=1)
64+
echo "control_plane_endpoint_ip=$control_plane_endpoint_ip" >> "$GITHUB_OUTPUT"
65+
66+
- name: Run e2e tests
67+
run: devbox run -- make e2e-test E2E_LABEL='provider:${{ inputs.provider }}' E2E_SKIP='${{ inputs.skip }}' E2E_FOCUS='${{ inputs.focus }}'
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
71+
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
72+
NUTANIX_ENDPOINT: ${{ secrets.NUTANIX_ENDPOINT }}
73+
NUTANIX_USER: ${{ secrets.NUTANIX_USER }}
74+
NUTANIX_PASSWORD: ${{ secrets.NUTANIX_PASSWORD }}
75+
NUTANIX_PORT: ${{ vars.NUTANIX_PORT }}
76+
NUTANIX_INSECURE: ${{ vars.NUTANIX_INSECURE }}
77+
NUTANIX_PRISM_ELEMENT_CLUSTER_NAME: ${{ vars.NUTANIX_PRISM_ELEMENT_CLUSTER_NAME }}
78+
NUTANIX_SUBNET_NAME: ${{ vars.NUTANIX_SUBNET_NAME }}
79+
NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME: ${{ vars.NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME }}
80+
NUTANIX_STORAGE_CONTAINER_NAME: ${{ vars.NUTANIX_STORAGE_CONTAINER_NAME }}
81+
CONTROL_PLANE_ENDPOINT_IP: ${{ steps.get-control-plane-endpoint-ip.outputs.control_plane_endpoint_ip }}
82+
83+
- if: success() || failure() # always run even if the previous step fails
84+
name: Publish e2e test report
85+
uses: mikepenz/action-junit-report@v4
86+
with:
87+
report_paths: 'junit-e2e.xml'
88+
check_name: 'e2e test report'
89+
detailed_summary: true
90+
require_passed_tests: true

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

devbox.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"coreutils@latest",
66
"envsubst@latest",
77
"findutils@latest",
8+
"fping@latest",
89
"gh@latest",
910
"ginkgo@latest",
1011
"git@latest",

devbox.lock

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,54 @@
297297
}
298298
}
299299
},
300+
"fping@latest": {
301+
"last_modified": "2024-06-12T20:55:33Z",
302+
"resolved": "github:NixOS/nixpkgs/a9858885e197f984d92d7fe64e9fff6b2e488d40#fping",
303+
"source": "devbox-search",
304+
"version": "5.2",
305+
"systems": {
306+
"aarch64-darwin": {
307+
"outputs": [
308+
{
309+
"name": "out",
310+
"path": "/nix/store/clxfp6jl0d2fs1bp2d1278534n2gixbj-fping-5.2",
311+
"default": true
312+
}
313+
],
314+
"store_path": "/nix/store/clxfp6jl0d2fs1bp2d1278534n2gixbj-fping-5.2"
315+
},
316+
"aarch64-linux": {
317+
"outputs": [
318+
{
319+
"name": "out",
320+
"path": "/nix/store/ilzq042wih0h5vdzxcpf6sd826h37g6w-fping-5.2",
321+
"default": true
322+
}
323+
],
324+
"store_path": "/nix/store/ilzq042wih0h5vdzxcpf6sd826h37g6w-fping-5.2"
325+
},
326+
"x86_64-darwin": {
327+
"outputs": [
328+
{
329+
"name": "out",
330+
"path": "/nix/store/hrh3202f2njx3skj3xn33fish5az5691-fping-5.2",
331+
"default": true
332+
}
333+
],
334+
"store_path": "/nix/store/hrh3202f2njx3skj3xn33fish5az5691-fping-5.2"
335+
},
336+
"x86_64-linux": {
337+
"outputs": [
338+
{
339+
"name": "out",
340+
"path": "/nix/store/2nr99jpa9g7b5z8pwj85awzh4qbhas28-fping-5.2",
341+
"default": true
342+
}
343+
],
344+
"store_path": "/nix/store/2nr99jpa9g7b5z8pwj85awzh4qbhas28-fping-5.2"
345+
}
346+
}
347+
},
300348
"gh@latest": {
301349
"last_modified": "2024-05-30T12:09:21Z",
302350
"resolved": "github:NixOS/nixpkgs/aa61b27554a5fc282758bf0324781e3464ef2cde#gh",

0 commit comments

Comments
 (0)