-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
67 lines (53 loc) · 1.96 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
BUILD_DIR=$(shell pwd)/bin
COMPONENT="$1"
DOCKER_REPO_BASE=gcr.io/run-ai-lab/fake-gpu-operator
DOCKER_REPO_FULL=${DOCKER_REPO_BASE}/${COMPONENT}
DOCKER_TAG?=0.0.0-dev
DOCKER_IMAGE_NAME=${DOCKER_REPO_FULL}:${DOCKER_TAG}
NAMESPACE=gpu-operator
SHOULD_PUSH?=false
DOCKER_BUILDX_PUSH_FLAG=$(if $(filter true,$(SHOULD_PUSH)),--push,)
DOCKER_BUILDX_PLATFORMS?=linux/amd64,linux/arm64
DOCKER_BUILDX_BUILDER?=fgo-multi-platform
OS?=linux
ARCH?=amd64
build:
env GOOS=${OS} GOARCH=${ARCH} go build -o ${BUILD_DIR}/ ./cmd/${COMPONENT}
.PHONY: build
build-preloader:
mkdir -p ${BUILD_DIR}
gcc -fPIC -shared -o ${BUILD_DIR}/preloader ./cmd/preloader/main.c
.PHONY: build
clean:
rm -rf ${BUILD_DIR}
.PHONY: clean
init-buildx:
docker buildx inspect fgo-multi-platform > /dev/null || docker buildx create --name=fgo-multi-platform
.PHONY: init-buildx
image: init-buildx
docker buildx --builder=fgo-multi-platform build -t ${DOCKER_IMAGE_NAME} --target ${COMPONENT} --platform ${DOCKER_BUILDX_PLATFORMS} ${DOCKER_BUILDX_PUSH_FLAG} .
.PHONY: image
images:
make image COMPONENT=device-plugin
make image COMPONENT=status-updater
make image COMPONENT=kwok-gpu-device-plugin
make image COMPONENT=status-exporter
make image COMPONENT=topology-server
make image COMPONENT=mig-faker
make image COMPONENT=jupyter-notebook
.PHONY: images
restart:
kubectl delete pod -l component=${COMPONENT} --force -n ${NAMESPACE}
.PHONY: restart
image-test:
mkdir -p /tmp/artifacts/test-results
mkdir -p /tmp/artifacts/test-results/unit-tests
mkdir -p /tmp/artifacts/test-results/service-tests
docker build -t test-image --target test .
.PHONY: image-test
GINKGO=$(BUILD_DIR)/ginkgo
$(GINKGO):
GOBIN=${BUILD_DIR} go install github.com/onsi/ginkgo/v2/[email protected]
test-all: $(GINKGO)
$(GINKGO) -r --procs=1 --output-dir=/tmp/artifacts/test-results/service-tests --compilers=1 --randomize-all --randomize-suites --fail-on-pending --keep-going --timeout=5m --race --trace --json-report=report.json
.PHONY: test-all