forked from hwameistor/hwameistor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.variables
72 lines (58 loc) · 3.01 KB
/
Makefile.variables
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
67
68
69
70
71
72
# [ COMMON ]
#----------------
MODULE_NAME = "hwameistor"
PROJECT_SOURCE_CODE_DIR ?= $(CURDIR)
BINS_DIR = ${PROJECT_SOURCE_CODE_DIR}/_build
CMDS_DIR = ${PROJECT_SOURCE_CODE_DIR}/cmd
# [ IMAGE ]
#----------------
# image_registry/image_tag/release_tag will be applied to all the images
IMAGE_REGISTRY ?= ghcr.io/hwameistor
IMAGE_TAG ?= 99.9-dev
RELEASE_TAG ?= $(shell tagged="$$(git describe --tags --match='v*' --abbrev=0 2> /dev/null)"; if [ "$$tagged" ] && [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 $$tagged)" ]; then echo $$tagged; fi)
# [ IMAGE/LDM ]
LDM_IMAGE_NAME = ${IMAGE_REGISTRY}/${LDM_MODULE_NAME}
LDM_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${LDM_MODULE_NAME}/Dockerfile
# [ IMAGE/LS ]
LS_IMAGE_NAME = ${IMAGE_REGISTRY}/${LS_MODULE_NAME}
LS_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${LS_MODULE_NAME}/Dockerfile
# [ IMAGE/SCHEDULER ]
SCHEDULER_IMAGE_NAME = ${IMAGE_REGISTRY}/${SCHEDULER_MODULE_NAME}
SCHEDULER_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${SCHEDULER_MODULE_NAME}/Dockerfile
# [ IMAGE/ADMISSION ]
ADMISSION_IMAGE_NAME = ${IMAGE_REGISTRY}/${ADMISSION_MODULE_NAME}
ADMISSION_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${ADMISSION_MODULE_NAME}/Dockerfile
# [ BUILD ]
#----------------
# Common build tools and build flags
GO_VERSION = $(shell go version)
BUILD_TIME = ${shell date +%Y-%m-%dT%H:%M:%SZ}
BUILD_VERSION = ${shell git rev-parse --short "HEAD^{commit}" 2>/dev/null}
BUILD_ENVS = CGO_ENABLED=0 GOOS=linux
BUILD_FLAGS = -X 'main.BUILDVERSION=${BUILD_VERSION}' -X 'main.BUILDTIME=${BUILD_TIME}' -X 'main.GOVERSION=${GO_VERSION}'
BUILD_OPTIONS = -a -mod vendor -installsuffix cgo -ldflags "${BUILD_FLAGS}"
BUILD_CMD = go build
DOCKER_SOCK_PATH=/var/run/docker.sock
DOCKER_MAKE_CMD = docker run --rm -v ${PROJECT_SOURCE_CODE_DIR}:${BUILDER_MOUNT_DST_DIR} -v ${DOCKER_SOCK_PATH}:${DOCKER_SOCK_PATH} -w ${BUILDER_MOUNT_DST_DIR} -i ${BUILDER_NAME}:${BUILDER_TAG}
DOCKER_DEBUG_CMD = docker run --rm -v ${PROJECT_SOURCE_CODE_DIR}:${BUILDER_MOUNT_DST_DIR} -v ${DOCKER_SOCK_PATH}:${DOCKER_SOCK_PATH} -w ${BUILDER_MOUNT_DST_DIR} -it ${BUILDER_NAME}:${BUILDER_TAG}
MUILT_ARCH_PUSH_CMD = ${PROJECT_SOURCE_CODE_DIR}/build/util/docker-push-with-multi-arch.sh
DOCKER_BUILDX_CMD_AMD64 = DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform=linux/amd64 -o type=docker
DOCKER_BUILDX_CMD_ARM64 = DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform=linux/arm64 -o type=docker
# [ BUILD/LDM ]
LDM_BUILD_OUTPUT = ${BINS_DIR}/${LDM_MODULE_NAME}
# [ BUILD/LS ]
LS_BUILD_OUTPUT = ${BINS_DIR}/${LS_MODULE_NAME}
# [ BUILD/SCHEDULER ]
SCHEDULER_BUILD_OUTPUT = ${BINS_DIR}/${SCHEDULER_MODULE_NAME}
# [ BUILD/ADMISSION ]
ADMISSION_BUILD_OUTPUT = ${BINS_DIR}/${ADMISSION_MODULE_NAME}
# [ BUILDER ]
#----------------
BUILDER_NAME = ${IMAGE_REGISTRY}/${MODULE_NAME}-builder
BUILDER_TAG = latest
BUILDER_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/builder/Dockerfile
BUILDER_MOUNT_DST_DIR = /go/src/github.com/hwameistor/
# [OPERATOR]
#----------------
# Operator tools
OPERATOR_CMD = operator-sdk