Skip to content

Commit 6d803fc

Browse files
authored
Merge pull request #233 from elezar/add-image-ci
Update dockerfile and actions for CI
2 parents da6b835 + 7b66227 commit 6d803fc

File tree

1,354 files changed

+613451
-224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,354 files changed

+613451
-224
lines changed

.common-ci.yml

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,9 @@ trigger-pipeline:
7575
- when: always
7676

7777
# The .dist- dummy steps set the DIST variable for the targeted distribution.
78-
.dist-ubi8:
78+
.dist-ubi9:
7979
variables:
80-
DIST: "ubi8"
81-
rules:
82-
- when: manual
83-
allow_failure: false
84-
85-
.dist-ubuntu20.04:
86-
variables:
87-
DIST: "ubuntu20.04"
80+
DIST: "ubi9"
8881

8982
# Define the platform targets
9083
.platform-amd64:
@@ -133,39 +126,22 @@ trigger-pipeline:
133126
- .scan-base
134127

135128
# Define the scan targets
136-
scan-ubuntu20.04-amd64:
137-
extends:
138-
- .scan
139-
- .dist-ubuntu20.04
140-
- .platform-amd64
141-
needs:
142-
- image-ubuntu20.04
143-
144-
scan-ubuntu20.04-arm64:
129+
scan-ubi9-amd64:
145130
extends:
146131
- .scan
147-
- .dist-ubuntu20.04
148-
- .platform-arm64
149-
needs:
150-
- image-ubuntu20.04
151-
- scan-ubuntu20.04-amd64
152-
153-
scan-ubi8-amd64:
154-
extends:
155-
- .scan
156-
- .dist-ubi8
132+
- .dist-ubi9
157133
- .platform-amd64
158134
needs:
159-
- image-ubi8
135+
- image-ubi9
160136

161-
scan-ubi8-arm64:
137+
scan-ubi9-arm64:
162138
extends:
163139
- .scan
164-
- .dist-ubi8
140+
- .dist-ubi9
165141
- .platform-arm64
166142
needs:
167-
- image-ubi8
168-
- scan-ubi8-amd64
143+
- image-ubi9
144+
- scan-ubi9-amd64
169145

170146
# Download the regctl binary for use in the release steps
171147
.regctl-setup:
@@ -237,16 +213,9 @@ scan-ubi8-arm64:
237213
- job: unit-tests
238214
optional:
239215

240-
release:staging-ubi8:
241-
extends:
242-
- .release:staging
243-
- .dist-ubi8
244-
needs:
245-
- image-ubi8
246-
247-
release:staging-ubuntu20.04:
216+
release:staging-ubi9:
248217
extends:
249218
- .release:staging
250-
- .dist-ubuntu20.04
219+
- .dist-ubi9
251220
needs:
252-
- image-ubuntu20.04
221+
- image-ubi9

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
version: 2
55
updates:
6+
# main branch
67
- package-ecosystem: "gomod"
78
target-branch: main
89
directory: "/"
@@ -14,6 +15,18 @@ updates:
1415
labels:
1516
- dependencies
1617

18+
- package-ecosystem: "docker"
19+
target-branch: main
20+
directories:
21+
# CUDA image
22+
- "/deployments/container"
23+
# Golang version
24+
- "/deployments/devel"
25+
schedule:
26+
interval: "daily"
27+
labels:
28+
- dependencies
29+
1730
- package-ecosystem: "github-actions"
1831
directory: "/"
1932
schedule:

.github/workflows/golang.yaml

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023-2024 NVIDIA CORPORATION
1+
# Copyright 2024 NVIDIA CORPORATION
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -16,6 +16,9 @@ name: Golang
1616

1717
on:
1818
pull_request:
19+
types:
20+
- opened
21+
- synchronize
1922
branches:
2023
- main
2124
- release-*
@@ -33,8 +36,8 @@ jobs:
3336
- name: Get Golang version
3437
id: vars
3538
run: |
36-
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
37-
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
39+
GOLANG_VERSION=$(./hack/golang-version.sh)
40+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV
3841
- name: Install Go
3942
uses: actions/setup-go@v5
4043
with:
@@ -46,32 +49,35 @@ jobs:
4649
args: -v --timeout 5m
4750
skip-cache: true
4851
- name: Check golang modules
49-
run: make check-vendor
52+
run: |
53+
make check-modules
54+
make -C deployments/devel check-modules
5055
test:
51-
name: Unit test
52-
runs-on: ubuntu-latest
53-
steps:
54-
- name: Checkout code
55-
uses: actions/checkout@v4
56-
- name: Get Golang version
57-
id: vars
58-
run: |
59-
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
60-
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
61-
- name: Install Go
62-
uses: actions/setup-go@v5
63-
with:
64-
go-version: ${{ env.GOLANG_VERSION }}
65-
- run: make test
56+
name: Unit test
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Checkout code
60+
uses: actions/checkout@v4
61+
- name: Get Golang version
62+
id: vars
63+
run: |
64+
GOLANG_VERSION=$(./hack/golang-version.sh)
65+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
66+
- name: Install Go
67+
uses: actions/setup-go@v5
68+
with:
69+
go-version: ${{ env.GOLANG_VERSION }}
70+
- run: make test
6671
build:
72+
name: Build
6773
runs-on: ubuntu-latest
6874
steps:
69-
- uses: actions/checkout@v4
70-
name: Checkout code
75+
- name: Checkout code
76+
uses: actions/checkout@v4
7177
- name: Get Golang version
7278
id: vars
7379
run: |
74-
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
80+
GOLANG_VERSION=$(./hack/golang-version.sh)
7581
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
7682
- name: Install Go
7783
uses: actions/setup-go@v5

.github/workflows/image.yaml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,15 @@
1616
name: Image
1717

1818
on:
19-
pull_request:
20-
types:
21-
- opened
22-
- synchronize
23-
branches:
24-
- main
25-
- release-*
2619
push:
2720
branches:
21+
- "pull-request/[0-9]+"
2822
- main
2923
- release-*
3024

3125
jobs:
3226
build:
33-
runs-on: ubuntu-latest
34-
strategy:
35-
matrix:
36-
dist: [ubuntu20.04, ubi8]
27+
runs-on: linux-amd64-cpu4
3728
steps:
3829
- uses: actions/checkout@v4
3930
name: Check out code
@@ -42,9 +33,6 @@ jobs:
4233
run: |
4334
echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
4435
echo "LOWERCASE_REPO_OWNER=$(echo "${GITHUB_REPOSITORY_OWNER}" | awk '{print tolower($0)}')" >> $GITHUB_ENV
45-
REPO_FULL_NAME="${{ github.event.pull_request.head.repo.full_name }}"
46-
echo "${REPO_FULL_NAME}"
47-
echo "LABEL_IMAGE_SOURCE=https://github.com/${REPO_FULL_NAME}" >> $GITHUB_ENV
4836
4937
GENERATE_ARTIFACTS="false"
5038
if [[ "${{ github.actor }}" == "dependabot[bot]" ]]; then
@@ -72,4 +60,4 @@ jobs:
7260
VERSION: ${COMMIT_SHORT_SHA}
7361
run: |
7462
echo "${VERSION}"
75-
make -f deployments/container/Makefile build-${{ matrix.dist }}
63+
make -f deployments/container/Makefile build

.gitlab-ci.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,7 @@ unit-tests:
7272
needs:
7373
- trigger-pipeline
7474

75-
image-ubi8:
75+
image-ubi9:
7676
extends:
7777
- .image-build
78-
- .dist-ubi8
79-
80-
image-ubuntu20.04:
81-
extends:
82-
- .image-build
83-
- .dist-ubuntu20.04
78+
- .dist-ubi9

.nvidia-ci.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,10 @@ variables:
6565
- regctl registry login "${OUT_REGISTRY}" -u "${OUT_REGISTRY_USER}" -p "${OUT_REGISTRY_TOKEN}"
6666
- 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}
6767

68-
image-ubi8:
68+
image-ubi9:
6969
extends:
7070
- .image-pull
71-
- .dist-ubi8
72-
73-
image-ubuntu20.04:
74-
extends:
75-
- .image-pull
76-
- .dist-ubuntu20.04
71+
- .dist-ubi9
7772

7873
# We skip the integration tests for the internal CI:
7974
.integration:
@@ -118,12 +113,7 @@ image-ubuntu20.04:
118113

119114
# Define the external release targets
120115
# Release to NGC
121-
release:ngc-ubuntu20.04:
122-
extends:
123-
- .release:ngc
124-
- .dist-ubuntu20.04
125-
126-
release:ngc-ubi8:
116+
release:ngc-ubi9:
127117
extends:
128118
- .release:ngc
129-
- .dist-ubi8
119+
- .dist-ubi9

Makefile

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

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

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

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

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

93-
check-vendor: vendor
91+
check-modules: vendor
9492
git diff --quiet HEAD -- go.mod go.sum vendor
9593

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

119-
build-image:
120-
$(DOCKER) build \
121-
--progress=plain \
122-
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
123-
--build-arg CLIENT_GEN_VERSION="$(CLIENT_GEN_VERSION)" \
124-
--build-arg CONTROLLER_GEN_VERSION="$(CONTROLLER_GEN_VERSION)" \
125-
--build-arg GOLANGCI_LINT_VERSION="$(GOLANGCI_LINT_VERSION)" \
126-
--build-arg MOQ_VERSION="$(MOQ_VERSION)" \
127-
--tag $(BUILDIMAGE) \
128-
-f $(DOCKERFILE_DEVEL) \
129-
$(DOCKERFILE_CONTEXT)
117+
# Generate an image for containerized builds
118+
# Note: This image is local only
119+
.PHONY: .build-image
120+
.build-image:
121+
make -f deployments/devel/Makefile .build-image
122+
123+
ifeq ($(BUILD_DEVEL_IMAGE),yes)
124+
$(DOCKER_TARGETS): .build-image
125+
.shell: .build-image
126+
endif
130127

131128
$(DOCKER_TARGETS): docker-%:
132129
@echo "Running 'make $(*)' in container image $(BUILDIMAGE)"
133130
$(DOCKER) run \
134131
--rm \
135132
-e GOCACHE=/tmp/.cache/go \
136133
-e GOMODCACHE=/tmp/.cache/gomod \
134+
-e GOLANGCI_LINT_CACHE=/tmp/.cache/golangci-lint \
137135
-v $(PWD):/work \
138136
-w /work \
139137
--user $$(id -u):$$(id -g) \
@@ -148,6 +146,7 @@ PHONY: .shell
148146
-ti \
149147
-e GOCACHE=/tmp/.cache/go \
150148
-e GOMODCACHE=/tmp/.cache/gomod \
149+
-e GOLANGCI_LINT_CACHE=/tmp/.cache/golangci-lint \
151150
-v $(PWD):/work \
152151
-w /work \
153152
--user $$(id -u):$$(id -g) \

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ cd k8s-dra-driver
5454

5555
### Setting up the infrastructure
5656

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

5959
<p align="center">
6060
<img width="800" src="./demo/specs/quickstart/basic-demo.svg">
@@ -156,7 +156,7 @@ export VERSION=v0.1.0
156156
157157
REGISTRY=nvcr.io/nvidia/cloud-native
158158
IMAGE=k8s-dra-driver
159-
PLATFORM=ubi8
159+
PLATFORM=ubi9
160160
161161
sudo true
162162
make -f deployments/container/Makefile build-${PLATFORM}

demo/clusters/kind/scripts/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ DRIVER_IMAGE_REGISTRY=$(from_versions_mk "REGISTRY")
3030
DRIVER_IMAGE_VERSION=$(from_versions_mk "VERSION")
3131

3232
: ${DRIVER_IMAGE_NAME:=${DRIVER_NAME}}
33-
: ${DRIVER_IMAGE_PLATFORM:="ubuntu20.04"}
33+
: ${DRIVER_IMAGE_PLATFORM:="ubi9"}
3434
: ${DRIVER_IMAGE_TAG:=${DRIVER_IMAGE_VERSION}}
3535
# The derived name of the driver image to build
3636
: ${DRIVER_IMAGE:="${DRIVER_IMAGE_REGISTRY}/${DRIVER_IMAGE_NAME}:${DRIVER_IMAGE_TAG}"}

0 commit comments

Comments
 (0)