Skip to content

Commit e8b1299

Browse files
committed
Add Github Actions workflow to run e2e tests
Signed-off-by: Christopher Desiniotis <[email protected]>
1 parent 25b2931 commit e8b1299

File tree

5 files changed

+155
-0
lines changed

5 files changed

+155
-0
lines changed

.github/workflows/e2e.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Copyright 2024 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_run:
19+
workflows: [Image]
20+
types:
21+
- completed
22+
23+
jobs:
24+
e2e-tests-containerd:
25+
runs-on: ubuntu-latest
26+
if: ${{ github.event.workflow_run.conclusion == 'success' }} && (${{ github.event.workflow_run.event == 'push' }} || ${{ github.event.workflow_run.event == 'pull-request' }})
27+
steps:
28+
- uses: actions/checkout@v4
29+
name: Check out code
30+
- name: Set up Holodeck
31+
uses: NVIDIA/holodeck@main
32+
with:
33+
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
34+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
35+
aws_ssh_key: ${{ secrets.AWS_SSH_KEY }}
36+
holodeck_config: "tests/holodeck.yaml"
37+
- name: Get public dns name
38+
id: get_public_dns_name
39+
uses: mikefarah/yq@master
40+
with:
41+
cmd: yq '.status.properties[] | select(.name == "public-dns-name") | .value' ${{ github.workspace }}/.cache/holodeck.yaml
42+
- name: Calculate test vars
43+
id: vars
44+
run: |
45+
echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
46+
echo "instance_hostname=ubuntu@${{ steps.get_public_dns_name.outputs.result }}" >> $GITHUB_ENV
47+
echo "private_key=${{ github.workspace }}/.cache/key.pem" >> $GITHUB_ENV
48+
- name: Run e2e tests
49+
env:
50+
OPERATOR_VERSION: "${COMMIT_SHORT_SHA}-ubi8"
51+
OPERATOR_IMAGE: "ghcr.io/${LOWERCASE_REPO_OWNER}/gpu-operator"
52+
VALIDATOR_VERSION: "${COMMIT_SHORT_SHA}-ubi8"
53+
VALIDATOR_IMAGE: "ghcr.io/${LOWERCASE_REPO_OWNER}/gpu-operator/gpu-operator-validator"
54+
GPU_PRODUCT_NAME: "Tesla-T4"
55+
SKIP_LAUNCH: "true"
56+
CONTAINER_RUNTIME: "containerd"
57+
TEST_CASE: "./tests/cases/defaults.sh"
58+
run: |
59+
./tests/ci-run-e2e.sh {OPERATOR_IMAGE} ${OPERATOR_VERSION} ${VALIDATOR_IMAGE} ${VALIDATOR_VERSION} ${GPU_PRODUCT_NAME} ${TEST_CASE} || rc=$?
60+
./tests/scripts/pull.sh /tmp/logs logs
61+
exit $rc
62+
- name: Archive test logs
63+
if: ${{ failure() }}
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: e2e-test-logs
67+
path: ./logs/
68+
retention-days: 15

.github/workflows/image.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,60 @@ jobs:
117117
run: |
118118
echo "${VERSION}"
119119
make build-${{ matrix.dist }}
120+
121+
e2e-tests-containerd:
122+
needs: [build-gpu-operator, build-gpu-operator-validator]
123+
runs-on: ubuntu-latest
124+
steps:
125+
- uses: actions/checkout@v4
126+
name: Check out code
127+
- name: Set up Holodeck
128+
uses: NVIDIA/holodeck@main
129+
with:
130+
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
131+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
132+
aws_ssh_key: ${{ secrets.AWS_SSH_KEY }}
133+
holodeck_config: "tests/holodeck.yaml"
134+
- name: Get public dns name
135+
id: get_public_dns_name
136+
uses: mikefarah/yq@master
137+
with:
138+
cmd: yq '.status.properties[] | select(.name == "public-dns-name") | .value' /github/workspace/.cache/holodeck.yaml
139+
- name: Calculate test vars
140+
id: vars
141+
run: |
142+
COMMIT_SHORT_SHA=${GITHUB_SHA:0:8}
143+
echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
144+
LOWERCASE_REPO_OWNER=$(echo "${GITHUB_REPOSITORY_OWNER}" | awk '{print tolower($0)}')
145+
echo "LOWERCASE_REPO_OWNER=$(echo "${GITHUB_REPOSITORY_OWNER}" | awk '{print tolower($0)}')" >> $GITHUB_ENV
146+
147+
echo "OPERATOR_VERSION=${COMMIT_SHORT_SHA}-ubi8" >> $GITHUB_ENV
148+
echo "OPERATOR_IMAGE=ghcr.io/${LOWERCASE_REPO_OWNER}/gpu-operator" >> $GITHUB_ENV
149+
echo "VALIDATOR_VERSION=${COMMIT_SHORT_SHA}-ubi8" >> $GITHUB_ENV
150+
echo "VALIDATOR_IMAGE=ghcr.io/${LOWERCASE_REPO_OWNER}/gpu-operator/gpu-operator-validator" >> $GITHUB_ENV
151+
152+
echo "instance_hostname=ubuntu@${{ steps.get_public_dns_name.outputs.result }}" >> $GITHUB_ENV
153+
echo "private_key=${{ github.workspace }}/key.pem" >> $GITHUB_ENV
154+
- name: Run e2e tests
155+
env:
156+
#OPERATOR_VERSION: ${COMMIT_SHORT_SHA}-ubi8
157+
#OPERATOR_IMAGE: ghcr.io/${LOWERCASE_REPO_OWNER}/gpu-operator
158+
#VALIDATOR_VERSION: ${COMMIT_SHORT_SHA}-ubi8
159+
#VALIDATOR_IMAGE: ghcr.io/${LOWERCASE_REPO_OWNER}/gpu-operator/gpu-operator-validator
160+
GPU_PRODUCT_NAME: "Tesla-T4"
161+
SKIP_LAUNCH: "true"
162+
CONTAINER_RUNTIME: "containerd"
163+
TEST_CASE: "./tests/cases/defaults.sh"
164+
run: |
165+
echo "${{ secrets.AWS_SSH_KEY }}" > ${private_key} && chmod 400 ${private_key}
166+
echo "${OPERATOR_IMAGE}:${OPERATOR_VERSION}\n${VALIDATOR_IMAGE}:${VALIDATOR_VERSION}\n${GPU_PRODUCT_NAME}\n${TEST_CASE}"
167+
./tests/ci-run-e2e.sh ${OPERATOR_IMAGE} ${OPERATOR_VERSION} ${VALIDATOR_IMAGE} ${VALIDATOR_VERSION} ${GPU_PRODUCT_NAME} ${TEST_CASE} || rc=$?
168+
./tests/scripts/pull.sh /tmp/logs logs
169+
exit $rc
170+
- name: Archive test logs
171+
if: ${{ failure() }}
172+
uses: actions/upload-artifact@v4
173+
with:
174+
name: e2e-test-logs
175+
path: ./logs/
176+
retention-days: 15

tests/holodeck.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: holodeck.nvidia.com/v1alpha1
2+
kind: Environment
3+
metadata:
4+
name: HOLODECK_NAME
5+
description: "end-to-end test infrastructure"
6+
spec:
7+
provider: aws
8+
auth:
9+
keyName: cdesiniotis
10+
privateKey: HOLODECK_PRIVATE_KEY
11+
instance:
12+
type: g4dn.xlarge
13+
region: us-west-1
14+
ingressIpRanges:
15+
- 0.0.0.0/0
16+
image:
17+
architecture: amd64
18+
imageId: ami-0ce2cb35386fc22e9
19+
containerRuntime:
20+
install: true
21+
name: containerd
22+
kubernetes:
23+
install: true
24+
installer: kubeadm
25+
version: v1.28.5

tests/scripts/.rsync-excludes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ vendor/
22
.git
33
aws-kube-ci
44
cnt-ci
5+
key.pem

tests/scripts/install-operator.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,13 @@ if [[ "${GPU_MODE}" == "vgpu" ]]; then
4848
-n "${TEST_NAMESPACE}"
4949
fi
5050

51+
set -x
52+
5153
# Run the helm install command
5254
${HELM} install ${PROJECT_DIR}/deployments/gpu-operator --generate-name \
5355
-n "${TEST_NAMESPACE}" \
5456
${OPERATOR_OPTIONS} \
5557
${TOOLKIT_CONTAINER_OPTIONS} \
5658
--wait
59+
60+
set +x

0 commit comments

Comments
 (0)