Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
55 changes: 12 additions & 43 deletions .common-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,9 @@ trigger-pipeline:
- when: always

# The .dist- dummy steps set the DIST variable for the targeted distribution.
.dist-ubi8:
.dist-ubi9:
variables:
DIST: "ubi8"
rules:
- when: manual
allow_failure: false

.dist-ubuntu20.04:
variables:
DIST: "ubuntu20.04"
DIST: "ubi9"

# Define the platform targets
.platform-amd64:
Expand Down Expand Up @@ -133,39 +126,22 @@ trigger-pipeline:
- .scan-base

# Define the scan targets
scan-ubuntu20.04-amd64:
extends:
- .scan
- .dist-ubuntu20.04
- .platform-amd64
needs:
- image-ubuntu20.04

scan-ubuntu20.04-arm64:
scan-ubi9-amd64:
extends:
- .scan
- .dist-ubuntu20.04
- .platform-arm64
needs:
- image-ubuntu20.04
- scan-ubuntu20.04-amd64

scan-ubi8-amd64:
extends:
- .scan
- .dist-ubi8
- .dist-ubi9
- .platform-amd64
needs:
- image-ubi8
- image-ubi9

scan-ubi8-arm64:
scan-ubi9-arm64:
extends:
- .scan
- .dist-ubi8
- .dist-ubi9
- .platform-arm64
needs:
- image-ubi8
- scan-ubi8-amd64
- image-ubi9
- scan-ubi9-amd64

# Download the regctl binary for use in the release steps
.regctl-setup:
Expand Down Expand Up @@ -237,16 +213,9 @@ scan-ubi8-arm64:
- job: unit-tests
optional:

release:staging-ubi8:
extends:
- .release:staging
- .dist-ubi8
needs:
- image-ubi8

release:staging-ubuntu20.04:
release:staging-ubi9:
extends:
- .release:staging
- .dist-ubuntu20.04
- .dist-ubi9
needs:
- image-ubuntu20.04
- image-ubi9
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

version: 2
updates:
# main branch
- package-ecosystem: "gomod"
target-branch: main
directory: "/"
Expand All @@ -14,6 +15,18 @@ updates:
labels:
- dependencies

- package-ecosystem: "docker"
target-branch: main
directories:
# CUDA image
- "/deployments/container"
# Golang version
- "/deployments/devel"
schedule:
interval: "daily"
labels:
- dependencies

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
50 changes: 28 additions & 22 deletions .github/workflows/golang.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023-2024 NVIDIA CORPORATION
# 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.
Expand All @@ -16,6 +16,9 @@ name: Golang

on:
pull_request:
types:
- opened
- synchronize
branches:
- main
- release-*
Expand All @@ -33,8 +36,8 @@ jobs:
- name: Get Golang version
id: vars
run: |
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
GOLANG_VERSION=$(./hack/golang-version.sh)
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@v5
with:
Expand All @@ -46,32 +49,35 @@ jobs:
args: -v --timeout 5m
skip-cache: true
- name: Check golang modules
run: make check-vendor
run: |
make check-modules
make -C deployments/devel check-modules
test:
name: Unit test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get Golang version
id: vars
run: |
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOLANG_VERSION }}
- run: make test
name: Unit test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get Golang version
id: vars
run: |
GOLANG_VERSION=$(./hack/golang-version.sh)
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOLANG_VERSION }}
- run: make test
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout code
- name: Checkout code
uses: actions/checkout@v4
- name: Get Golang version
id: vars
run: |
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
GOLANG_VERSION=$(./hack/golang-version.sh)
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@v5
Expand Down
18 changes: 3 additions & 15 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,15 @@
name: Image

on:
pull_request:
types:
- opened
- synchronize
branches:
- main
- release-*
push:
branches:
- "pull-request/[0-9]+"
- main
- release-*

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dist: [ubuntu20.04, ubi8]
runs-on: linux-amd64-cpu4
steps:
- uses: actions/checkout@v4
name: Check out code
Expand All @@ -42,9 +33,6 @@ jobs:
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="false"
if [[ "${{ github.actor }}" == "dependabot[bot]" ]]; then
Expand Down Expand Up @@ -72,4 +60,4 @@ jobs:
VERSION: ${COMMIT_SHORT_SHA}
run: |
echo "${VERSION}"
make -f deployments/container/Makefile build-${{ matrix.dist }}
make -f deployments/container/Makefile build
9 changes: 2 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,7 @@ unit-tests:
needs:
- trigger-pipeline

image-ubi8:
image-ubi9:
extends:
- .image-build
- .dist-ubi8

image-ubuntu20.04:
extends:
- .image-build
- .dist-ubuntu20.04
- .dist-ubi9
18 changes: 4 additions & 14 deletions .nvidia-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,10 @@ variables:
- regctl registry login "${OUT_REGISTRY}" -u "${OUT_REGISTRY_USER}" -p "${OUT_REGISTRY_TOKEN}"
- make -f deployments/container/Makefile IMAGE=${IN_REGISTRY}/${IN_IMAGE_NAME}:${IN_VERSION}-${DIST} OUT_IMAGE=${OUT_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}-${DIST} push-${DIST}

image-ubi8:
image-ubi9:
extends:
- .image-pull
- .dist-ubi8

image-ubuntu20.04:
extends:
- .image-pull
- .dist-ubuntu20.04
- .dist-ubi9

# We skip the integration tests for the internal CI:
.integration:
Expand Down Expand Up @@ -118,12 +113,7 @@ image-ubuntu20.04:

# Define the external release targets
# Release to NGC
release:ngc-ubuntu20.04:
extends:
- .release:ngc
- .dist-ubuntu20.04

release:ngc-ubi8:
release:ngc-ubi9:
extends:
- .release:ngc
- .dist-ubi8
- .dist-ubi9
29 changes: 14 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ CMDS := $(patsubst ./cmd/%/,%,$(sort $(dir $(wildcard ./cmd/*/))))
CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS))

CHECK_TARGETS := golangci-lint
MAKE_TARGETS := binaries build build-image check fmt lint-internal test examples cmds coverage generate vendor check-vendor $(CHECK_TARGETS)
MAKE_TARGETS := binaries build build-image check fmt lint-internal test examples cmds coverage generate vendor check-modules $(CHECK_TARGETS)

TARGETS := $(MAKE_TARGETS) $(CMD_TARGETS)

DOCKER_TARGETS := $(patsubst %,docker-%, $(TARGETS))
.PHONY: $(TARGETS) $(DOCKER_TARGETS)
DOCKERFILE_DEVEL ?= "images/devel/Dockerfile"
DOCKERFILE_CONTEXT ?= "https://github.com/NVIDIA/k8s-test-infra.git"

GOOS ?= linux
GOARCH ?= $(shell uname -m | sed -e 's,aarch64,arm64,' -e 's,x86_64,amd64,')
Expand Down Expand Up @@ -90,7 +88,7 @@ vendor:
go mod vendor
go mod verify

check-vendor: vendor
check-modules: vendor
git diff --quiet HEAD -- go.mod go.sum vendor

COVERAGE_FILE := coverage.out
Expand All @@ -116,24 +114,24 @@ generate-deepcopy: .remove-deepcopy
rm -f $(CURDIR)/$${dir}/zz_generated.deepcopy.go; \
done

build-image:
$(DOCKER) build \
--progress=plain \
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
--build-arg CLIENT_GEN_VERSION="$(CLIENT_GEN_VERSION)" \
--build-arg CONTROLLER_GEN_VERSION="$(CONTROLLER_GEN_VERSION)" \
--build-arg GOLANGCI_LINT_VERSION="$(GOLANGCI_LINT_VERSION)" \
--build-arg MOQ_VERSION="$(MOQ_VERSION)" \
--tag $(BUILDIMAGE) \
-f $(DOCKERFILE_DEVEL) \
$(DOCKERFILE_CONTEXT)
# Generate an image for containerized builds
# Note: This image is local only
.PHONY: .build-image
.build-image:
make -f deployments/devel/Makefile .build-image

ifeq ($(BUILD_DEVEL_IMAGE),yes)
$(DOCKER_TARGETS): .build-image
.shell: .build-image
endif

$(DOCKER_TARGETS): docker-%:
@echo "Running 'make $(*)' in container image $(BUILDIMAGE)"
$(DOCKER) run \
--rm \
-e GOCACHE=/tmp/.cache/go \
-e GOMODCACHE=/tmp/.cache/gomod \
-e GOLANGCI_LINT_CACHE=/tmp/.cache/golangci-lint \
-v $(PWD):/work \
-w /work \
--user $$(id -u):$$(id -g) \
Expand All @@ -148,6 +146,7 @@ PHONY: .shell
-ti \
-e GOCACHE=/tmp/.cache/go \
-e GOMODCACHE=/tmp/.cache/gomod \
-e GOLANGCI_LINT_CACHE=/tmp/.cache/golangci-lint \
-v $(PWD):/work \
-w /work \
--user $$(id -u):$$(id -g) \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ cd k8s-dra-driver

### Setting up the infrastructure

Here's a demo showing how to install and configure DRA, and run a pod in a `kind` cluster on a Linux workstation.
Here's a demo showing how to install and configure DRA, and run a pod in a `kind` cluster on a Linux workstation.

<p align="center">
<img width="800" src="./demo/specs/quickstart/basic-demo.svg">
Expand Down Expand Up @@ -156,7 +156,7 @@ export VERSION=v0.1.0

REGISTRY=nvcr.io/nvidia/cloud-native
IMAGE=k8s-dra-driver
PLATFORM=ubi8
PLATFORM=ubi9

sudo true
make -f deployments/container/Makefile build-${PLATFORM}
Expand Down
2 changes: 1 addition & 1 deletion demo/clusters/kind/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ DRIVER_IMAGE_REGISTRY=$(from_versions_mk "REGISTRY")
DRIVER_IMAGE_VERSION=$(from_versions_mk "VERSION")

: ${DRIVER_IMAGE_NAME:=${DRIVER_NAME}}
: ${DRIVER_IMAGE_PLATFORM:="ubuntu20.04"}
: ${DRIVER_IMAGE_PLATFORM:="ubi9"}
: ${DRIVER_IMAGE_TAG:=${DRIVER_IMAGE_VERSION}}
# The derived name of the driver image to build
: ${DRIVER_IMAGE:="${DRIVER_IMAGE_REGISTRY}/${DRIVER_IMAGE_NAME}:${DRIVER_IMAGE_TAG}"}
Expand Down
Loading