Skip to content

Commit

Permalink
Add e2e github action
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
  • Loading branch information
ArangoGutierrez committed Mar 4, 2024
1 parent aee007e commit b66e8ed
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 8 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Copyright 2024 NVIDIA CORPORATION
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: e2e

on:
pull_request:
types:
- opened
- synchronize
- labeled
branches:
- main
- release-*
push:
branches:
- main
- release-*

jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
name: Check out code
- name: Calculate build vars
id: vars
run: |
echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
echo "LOWERCASE_REPO_OWNER=$(echo "${GITHUB_REPOSITORY_OWNER}" | awk '{print tolower($0)}')" >> $GITHUB_ENV
REPO_FULL_NAME="${{ github.event.pull_request.head.repo.full_name }}"
echo "${REPO_FULL_NAME}"
echo "LABEL_IMAGE_SOURCE=https://github.com/${REPO_FULL_NAME}" >> $GITHUB_ENV
GENERATE_ARTIFACTS="true"
if [[ "${{ github.actor }}" == "dependabot[bot]" ]]; then
GENERATE_ARTIFACTS="false"
fi
echo "PUSH_ON_BUILD=${GENERATE_ARTIFACTS}" >> $GITHUB_ENV
echo "BUILD_MULTI_ARCH_IMAGES=false" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
env:
IMAGE_NAME: ghcr.io/${LOWERCASE_REPO_OWNER}/k8s-device-plugin
VERSION: ${COMMIT_SHORT_SHA}
run: |
echo "${VERSION}"
make -f deployments/container/Makefile build-ubuntu20.04
7 changes: 7 additions & 0 deletions .github/workflows/golang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ name: Golang

on:
pull_request:
types:
- opened
- synchronize
- labeled
branches:
- main
- release-*
Expand All @@ -27,6 +31,7 @@ on:
jobs:
check:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'ok-to-test') || github.event_name == 'push'
steps:
- uses: actions/checkout@v4
name: Checkout code
Expand All @@ -50,6 +55,7 @@ jobs:
test:
name: Unit test
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'ok-to-test') || github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -65,6 +71,7 @@ jobs:
- run: make test
build:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'ok-to-test') || github.event_name == 'push'
steps:
- uses: actions/checkout@v4
name: Checkout code
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Run this workflow on pull requests or merge to main/release branches
name: image
name: Image

on:
pull_request:
types:
- opened
- synchronize
- labeled
branches:
- main
- release-*
Expand All @@ -31,6 +31,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'ok-to-test') || github.event_name == 'push'
strategy:
matrix:
dist: [ubuntu20.04, ubi8]
Expand Down
13 changes: 7 additions & 6 deletions tests/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@
GO_CMD ?= go
GO_FMT ?= gofmt

DRIVER_ENABLED ?= true
include $(CURDIR)/versions.mk

E2E_IMAGE_REPO ?= nvcr.io/nvidia/k8s-device-plugin
E2E_IMAGE_TAG ?= v0.14.3
E2E_IMAGE_PULL_POLICY ?= Always
DRIVER_ENABLED ?= true

HELM_CHART ?= $(CURDIR)/../../deployments/helm/nvidia-device-plugin
E2E_IMAGE_REPO ?= $(REGISTRY)/$(DRIVER_NAME)
E2E_IMAGE_TAG ?= $(VERSION)
E2E_IMAGE_PULL_POLICY ?= IfNotPresent
HELM_CHART ?= $(CURDIR)/deployments/helm/nvidia-device-plugin

.PHONY: e2e-test
e2e-test:
@if [ -z ${KUBECONFIG} ]; then \
echo "[ERR] KUBECONFIG missing, must be defined"; \
exit 1; \
fi
$(GO_CMD) test -v . -args \
$(GO_CMD) test -v $(CURDIR)/tests/e2e -args \
-kubeconfig=$(KUBECONFIG) \
-driver-enabled=$(DRIVER_ENABLED) \
-image.repo=$(E2E_IMAGE_REPO) \
Expand Down
29 changes: 29 additions & 0 deletions tests/e2e/holodeck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: holodeck.nvidia.com/v1alpha1
kind: Environment
metadata:
name: HOLODECK_NAME
description: "Devel infra environment"
spec:
provider: aws
auth:
keyName: cnt-ci
privateKey: HOLODECK_PRIVATE_KEY
instance:
type: g4dn.xlarge
region: us-west-1
ingressIpRanges:
- 0.0.0.0/0
image:
architecture: amd64
imageId: ami-0ce2cb35386fc22e9
containerRuntime:
install: true
name: containerd
nvidiaContainerToolkit:
install: true
nvidiaDriver:
install: true
kubernetes:
install: true
installer: kubeadm
version: v1.28.5

0 comments on commit b66e8ed

Please sign in to comment.