-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
2d2a3f7
commit 25fa80b
Showing
5 changed files
with
202 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
self-hosted-runner: | ||
# Labels of self-hosted runner in array of string | ||
labels: | ||
- self-hosted-ncn-dind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# Copyright 2024 Nutanix. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
provider: | ||
description: Infrastructure provider to run e2e tests with | ||
type: string | ||
required: true | ||
skip: | ||
description: e2e tests to skip | ||
type: string | ||
focus: | ||
description: e2e tests to focus | ||
type: string | ||
|
||
jobs: | ||
e2e-test: | ||
runs-on: "self-hosted-ncn-dind" | ||
permissions: | ||
contents: read | ||
checks: write | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check Docker service status | ||
run: docker info | ||
|
||
- name: Enable debug logging | ||
run: echo "ENABLE_DEBUG=true" >> $GITHUB_ENV | ||
|
||
- name: Install Devbox | ||
uses: jetify-com/devbox-install-action@v0.11.0 | ||
with: | ||
enable-cache: true | ||
|
||
- name: Go cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Set IP range based on provider | ||
run: | | ||
if [[ "${{ inputs.provider }}" == "Nutanix" ]]; then | ||
CONTROL_PLANE_ENDPOINT_RANGE_START="${{ secrets.NUTANIX_CONTROL_PLANE_ENDPOINT_RANGE_START }}" | ||
CONTROL_PLANE_ENDPOINT_RANGE_END="${{ secrets.NUTANIX_CONTROL_PLANE_ENDPOINT_RANGE_END }}" | ||
fi | ||
echo "CONTROL_PLANE_ENDPOINT_RANGE_START=$CONTROL_PLANE_ENDPOINT_RANGE_START" >> $GITHUB_ENV | ||
echo "CONTROL_PLANE_ENDPOINT_RANGE_END=$CONTROL_PLANE_ENDPOINT_RANGE_END" >> $GITHUB_ENV | ||
- name: Get Control Plane endpoint IP | ||
id: get-control-plane-endpoint-ip | ||
run: | | ||
# Get all available IPs in the range | ||
available_ips=$(fping -g -u $CONTROL_PLANE_ENDPOINT_RANGE_START $CONTROL_PLANE_ENDPOINT_RANGE_END 2>/dev/null) | ||
# Convert the list of available IPs to an array | ||
available_ips_array=(${(f)ip_list}) | ||
# Get the number of available IPs | ||
num_ips=${#available_ips_array[@]} | ||
if [ $num_ips -eq 0 ]; then | ||
echo "No available IPs found" | ||
exit 1 | ||
fi | ||
# Get a random index | ||
random_index=$((RANDOM % num_ips +1)) | ||
# Get the random IP | ||
control_plane_endpoint_ip=${available_ips_array[$random_index]} | ||
# Set the random IP as an output variable | ||
echo "control_plane_endpoint_ip=$control_plane_endpoint_ip" >> $GITHUB_OUTPUT | ||
- name: Run e2e tests | ||
run: devbox run -- make e2e-test E2E_LABEL='provider:${{ inputs.provider }}' E2E_SKIP='${{ inputs.skip }}' E2E_FOCUS='${{ inputs.focus }}' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
NUTANIX_ENDPOINT: ${{ secrets.NUTANIX_ENDPOINT }} | ||
NUTANIX_USER: ${{ secrets.NUTANIX_USER }} | ||
NUTANIX_PASSWORD: ${{ secrets.NUTANIX_PASSWORD }} | ||
NUTANIX_PORT: ${{ vars.NUTANIX_PORT }} | ||
NUTANIX_INSECURE: ${{ vars.NUTANIX_INSECURE }} | ||
NUTANIX_PRISM_ELEMENT_CLUSTER_NAME: ${{ vars.NUTANIX_PRISM_ELEMENT_CLUSTER_NAME }} | ||
NUTANIX_SUBNET_NAME: ${{ vars.NUTANIX_SUBNET_NAME }} | ||
NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME: ${{ vars.NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME }} | ||
NUTANIX_STORAGE_CONTAINER_NAME: ${{ vars.NUTANIX_STORAGE_CONTAINER_NAME }} | ||
CONTROL_PLANE_ENDPOINT_IP: ${{ steps.get-control-plane-endpoint-ip.outputs.control_plane_endpoint_ip }} | ||
|
||
- if: success() || failure() # always run even if the previous step fails | ||
name: Publish e2e test report | ||
uses: mikepenz/action-junit-report@v4 | ||
with: | ||
report_paths: 'junit-e2e.xml' | ||
check_name: 'e2e test report' | ||
detailed_summary: true | ||
require_passed_tests: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters