Skip to content

Commit c705191

Browse files
Add GitHub action for E2E
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
1 parent 0c5eacb commit c705191

File tree

7 files changed

+134
-25
lines changed

7 files changed

+134
-25
lines changed

.github/workflows/ci.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,13 @@ jobs:
3131
secrets: inherit
3232
with:
3333
version: ${{ needs.basic.outputs.version }}
34+
35+
e2e-test:
36+
needs:
37+
- image
38+
- basic
39+
secrets: inherit
40+
uses: ./.github/workflows/e2e.yaml
41+
with:
42+
version: ${{ needs.basic.outputs.version }}
43+
golang_version: ${{ needs.basic.outputs.golang_version }}

.github/workflows/e2e.yaml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Copyright 2025 NVIDIA CORPORATION
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: End-to-end Tests
16+
17+
on:
18+
workflow_call:
19+
inputs:
20+
version:
21+
required: true
22+
type: string
23+
golang_version:
24+
required: true
25+
type: string
26+
secrets:
27+
AWS_ACCESS_KEY_ID:
28+
required: true
29+
AWS_SECRET_ACCESS_KEY:
30+
required: true
31+
AWS_SSH_KEY:
32+
required: true
33+
SLACK_BOT_TOKEN:
34+
required: true
35+
SLACK_CHANNEL_ID:
36+
required: true
37+
38+
jobs:
39+
e2e-tests:
40+
runs-on: linux-amd64-cpu4
41+
steps:
42+
- name: Check out code
43+
uses: actions/checkout@v4
44+
45+
- name: Install Go
46+
uses: actions/setup-go@v5
47+
with:
48+
go-version: ${{ inputs.golang_version }}
49+
50+
- name: Set up Holodeck
51+
uses: NVIDIA/[email protected]
52+
with:
53+
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
54+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
55+
aws_ssh_key: ${{ secrets.AWS_SSH_KEY }}
56+
holodeck_config: "tests/e2e/infra/holodeck.yaml"
57+
58+
- name: Run e2e tests
59+
env:
60+
KUBECONFIG: ${{ github.workspace }}/kubeconfig
61+
HELM_CHART: ${{ github.workspace }}/deployments/helm/k8s-dra-driver-gpu
62+
E2E_IMAGE_REPO: ghcr.io/nvidia/k8s-dra-driver-gpu
63+
E2E_IMAGE_TAG: ${{ inputs.version }}-ubi9
64+
E2E_IMAGE_PULL_POLICY: IfNotPresent
65+
LOG_ARTIFACTS_DIR: ${{ github.workspace }}/e2e_logs
66+
run: |
67+
make test-e2e
68+
69+
- name: Archive test logs
70+
if: ${{ failure() }}
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: e2e-test-logs
74+
path: ./e2e_logs/
75+
retention-days: 15
76+
77+
- name: Post text to a Slack channel
78+
uses: slackapi/[email protected]
79+
env:
80+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
81+
SUMMARY_URL: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
82+
with:
83+
method: chat.postMessage
84+
token: ${{ secrets.SLACK_BOT_TOKEN }}
85+
payload: |
86+
channel: ${{ secrets.SLACK_CHANNEL_ID }}
87+
text: ":x: On repository ${{ github.repository }} the Workflow *${{ github.workflow }}* has failed.
88+
89+
Details: ${{ env.SUMMARY_URL }}"

.github/workflows/image.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,22 @@ jobs:
2828
steps:
2929
- uses: actions/checkout@v4
3030
name: Check out code
31+
3132
- name: Set up QEMU
3233
uses: docker/setup-qemu-action@v3
3334
with:
3435
image: tonistiigi/binfmt:qemu-v7.0.0-28
36+
3537
- name: Set up Docker Buildx
3638
uses: docker/setup-buildx-action@v3
39+
3740
- name: Login to GitHub Container Registry
3841
uses: docker/login-action@v3
3942
with:
4043
registry: ghcr.io
4144
username: ${{ github.actor }}
4245
password: ${{ secrets.GITHUB_TOKEN }}
46+
4347
- name: Build image
4448
env:
4549
IMAGE_NAME: ghcr.io/nvidia/k8s-dra-driver-gpu

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CMDS := $(patsubst ./cmd/%/,%,$(sort $(dir $(wildcard ./cmd/*/))))
3131
CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS))
3232

3333
CHECK_TARGETS := golangci-lint check-generate
34-
MAKE_TARGETS := binaries build build-image check fmt lint-internal test examples cmds coverage generate vendor check-modules $(CHECK_TARGETS) ginkgo
34+
MAKE_TARGETS := binaries build build-image check fmt lint-internal test test-e2e ginkgo examples cmds coverage generate vendor check-modules $(CHECK_TARGETS)
3535

3636
TARGETS := $(MAKE_TARGETS) $(CMD_TARGETS)
3737

@@ -93,13 +93,6 @@ vendor:
9393
check-modules: vendor
9494
git diff --quiet HEAD -- go.mod go.sum vendor
9595

96-
ginkgo: $(CURDIR)/bin/ginkgo
97-
mkdir -p $(CURDIR)/bin
98-
GOBIN=$(CURDIR)/bin go install github.com/onsi/ginkgo/v2/ginkgo@latest
99-
100-
e2e-test: ginkgo
101-
./bin/ginkgo $(GINKGO_ARGS) -v --json-report ginkgo.json ./tests/e2e/...
102-
10396
COVERAGE_FILE := coverage.out
10497
test: build cmds
10598
go test -race -cover -v -coverprofile=$(COVERAGE_FILE) $(MODULE)/...
@@ -108,6 +101,13 @@ coverage: test
108101
cat $(COVERAGE_FILE) | grep -v "_mock.go" > $(COVERAGE_FILE).no-mocks
109102
go tool cover -func=$(COVERAGE_FILE).no-mocks
110103

104+
ginkgo:
105+
mkdir -p $(CURDIR)/bin
106+
GOBIN=$(CURDIR)/bin go install github.com/onsi/ginkgo/v2/ginkgo@latest
107+
108+
test-e2e: ginkgo
109+
./bin/ginkgo $(GINKGO_ARGS) -v --json-report $(LOG_ARTIFACTS_DIR)/ginkgo.json ./tests/e2e/...
110+
111111
generate: generate-crds generate-informers fmt
112112

113113
generate-crds: generate-deepcopy .remove-crds

hack/e2e-test.sh

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,15 @@ set -o pipefail
2121
SOURCE_DIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
2222
ROOT_DIR="$SOURCE_DIR/.."
2323

24-
GINKGO="$ROOT_DIR"/bin/ginkgo
25-
GINKGO_ARGS=${GINKGO_ARGS:-}
26-
27-
# Check if ginkgo binary is present
28-
if [ ! -f "$GINKGO" ]; then
29-
echo "ginkgo binary not found at $GINKGO, building it"
30-
make ginkgo
31-
fi
32-
3324
HELM_CHART=$ROOT_DIR/deployments/helm/nvidia-dra-driver-gpu
3425
E2E_IMAGE_REPO=${E2E_IMAGE_REPO:-"ghcr.io/nvidia/k8s-dra-driver-gpu"}
3526
E2E_IMAGE_TAG=${E2E_IMAGE_TAG:-"93cd4799-ubi9"}
3627
E2E_IMAGE_PULL_POLICY=${E2E_IMAGE_PULL_POLICY:-"IfNotPresent"}
3728
ENABLE_GFD=${ENABLE_GFD:-"true"}
3829
E2E_HOST_MANAGED_DRIVERS=${E2E_HOST_MANAGED_DRIVERS:-"true"}
30+
LOG_ARTIFACTS_DIR="$ROOT_DIR/e2e_artifacts"
3931

40-
export E2E_IMAGE_REPO HELM_CHART E2E_IMAGE_TAG E2E_IMAGE_PULL_POLICY ENABLE_GFD E2E_HOST_MANAGED_DRIVERS
32+
export E2E_IMAGE_REPO HELM_CHART E2E_IMAGE_TAG E2E_IMAGE_PULL_POLICY ENABLE_GFD E2E_HOST_MANAGED_DRIVERS LOG_ARTIFACTS_DIR
4133

4234
# shellcheck disable=SC2086
43-
make e2e-test
35+
make test-e2e

tests/e2e/e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func getTestEnv() {
214214
HelmChart = os.Getenv("HELM_CHART")
215215
Expect(HelmChart).NotTo(BeEmpty(), "HELM_CHART must be set")
216216

217-
LogArtifactDir = os.Getenv("LOG_ARTIFACT_DIR")
217+
LogArtifactDir = os.Getenv("LOG_ARTIFACTS_DIR")
218218

219219
ImageRepo = os.Getenv("E2E_IMAGE_REPO")
220220
Expect(ImageRepo).NotTo(BeEmpty(), "IMAGE_REPO must be set")

tests/e2e/infra/holodeck.yaml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,36 @@ spec:
77
provider: aws
88
auth:
99
keyName: cnt-ci
10-
privateKey: $AWS_PRIVATE_KEY
10+
privateKey: HOLODECK_PRIVATE_KEY
11+
instance:
12+
type: g4dn.xlarge
13+
region: us-west-1
14+
ingressIpRanges:
15+
- 18.190.12.32/32
16+
- 3.143.46.93/32
17+
- 52.15.119.136/32
18+
- 35.155.108.162/32
19+
- 35.162.190.51/32
20+
- 54.201.61.24/32
21+
- 52.24.205.48/32
22+
- 44.235.4.62/32
23+
- 44.230.241.223/32
1124
instance:
1225
type: g4dn.xlarge
1326
region: us-west-1
1427
ingressIpRanges:
1528
- 57.133.151.69/32
1629
image:
1730
architecture: amd64
31+
containerRuntime:
32+
install: true
33+
name: containerd
34+
version: 1.7.24
1835
nvidiaDriver:
1936
install: true
2037
nvidiaContainerToolkit:
2138
install: true
22-
containerRuntime:
23-
install: true
24-
name: containerd
25-
version: 2.0.0
39+
enableCDI: true
2640
kubernetes:
2741
install: true
2842
installer: kubeadm

0 commit comments

Comments
 (0)