forked from hwameistor/hwameistor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.variables
111 lines (92 loc) · 5.1 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# [ COMMON ]
#----------------
MODULE_NAME = hwameistor
PROJECT_SOURCE_CODE_DIR ?= $(CURDIR)
BINS_DIR = ${PROJECT_SOURCE_CODE_DIR}/_build
CMDS_DIR = ${PROJECT_SOURCE_CODE_DIR}/cmd
SCAN_IMAGE = ${SCAN_IMAGES}
# [ 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
LDM_BUILD_OUTPUT = ${BINS_DIR}/${LDM_MODULE_NAME}
# [ IMAGE/LS ]
LS_IMAGE_NAME = ${IMAGE_REGISTRY}/${LS_MODULE_NAME}
LS_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${LS_MODULE_NAME}/Dockerfile
LS_BUILD_OUTPUT = ${BINS_DIR}/${LS_MODULE_NAME}
# [ IMAGE/SCHEDULER ]
SCHEDULER_IMAGE_NAME = ${IMAGE_REGISTRY}/${SCHEDULER_MODULE_NAME}
SCHEDULER_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${SCHEDULER_MODULE_NAME}/Dockerfile
SCHEDULER_BUILD_OUTPUT = ${BINS_DIR}/${SCHEDULER_MODULE_NAME}
# [ IMAGE/ADMISSION ]
ADMISSION_IMAGE_NAME = ${IMAGE_REGISTRY}/${ADMISSION_MODULE_NAME}
ADMISSION_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${ADMISSION_MODULE_NAME}/Dockerfile
ADMISSION_BUILD_OUTPUT = ${BINS_DIR}/${ADMISSION_MODULE_NAME}
# [ IMAGE/EVICTOR ]
EVICTOR_IMAGE_NAME = ${IMAGE_REGISTRY}/${EVICTOR_MODULE_NAME}
EVICTOR_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${EVICTOR_MODULE_NAME}/Dockerfile
EVICTOR_BUILD_OUTPUT = ${BINS_DIR}/${EVICTOR_MODULE_NAME}
# [ IMAGE/EXPORTER ]
EXPORTER_IMAGE_NAME = ${IMAGE_REGISTRY}/${EXPORTER_MODULE_NAME}
EXPORTER_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${EXPORTER_MODULE_NAME}/Dockerfile
EXPORTER_BUILD_OUTPUT = ${BINS_DIR}/${EXPORTER_MODULE_NAME}
# [ IMAGE/APISERVER ]
APISERVER_IMAGE_NAME = ${IMAGE_REGISTRY}/${APISERVER_MODULE_NAME}
APISERVER_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${APISERVER_MODULE_NAME}/Dockerfile
APISERVER_BUILD_OUTPUT = ${BINS_DIR}/${APISERVER_MODULE_NAME}
# [ IMAGE/FAILOVER ]
FAILOVER_IMAGE_NAME = ${IMAGE_REGISTRY}/${FAILOVER_MODULE_NAME}
FAILOVER_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${FAILOVER_MODULE_NAME}/Dockerfile
FAILOVER_BUILD_OUTPUT = ${BINS_DIR}/${FAILOVER_MODULE_NAME}
# [ IMAGE/AUDITOR ]
AUDITOR_IMAGE_NAME = ${IMAGE_REGISTRY}/${AUDITOR_MODULE_NAME}
AUDITOR_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${AUDITOR_MODULE_NAME}/Dockerfile
AUDITOR_BUILD_OUTPUT = ${BINS_DIR}/${AUDITOR_MODULE_NAME}
# [ IMAGE/PVC-AUTORESIZER ]
PVC-AUTORESIZER_IMAGE_NAME = ${IMAGE_REGISTRY}/${PVC-AUTORESIZER_MODULE_NAME}
PVC-AUTORESIZER_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${PVC-AUTORESIZER_MODULE_NAME}/Dockerfile
PVC-AUTORESIZER_BUILD_OUTPUT = ${BINS_DIR}/${PVC-AUTORESIZER_MODULE_NAME}
# [ IMAGE/LDA ]
LDA_CONTROLLER_IMAGE_NAME = ${IMAGE_REGISTRY}/${LDA_CONTROLLER_MODULE_NAME}
LDA_CONTROLLER_IMAGE_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/${LDA_CONTROLLER_MODULE_NAME}/Dockerfile
LDA_CONTROLLER_BUILD_OUTPUT = ${BINS_DIR}/${LDA_CONTROLLER_MODULE_NAME}
# [ 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 --privileged --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 --privileged -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 -s ${SCAN_IMAGE}
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
# [ 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/hwameistor
# [ JUICESYNC ]
#----------------
JUICESYNC_NAME = ${IMAGE_REGISTRY}/${MODULE_NAME}-juicesync
JUICESYNC_TAG = v1.0.4-01
JUICESYNC_DOCKERFILE = ${PROJECT_SOURCE_CODE_DIR}/build/juicesync/Dockerfile
JUICESYNC_MOUNT_DST_DIR = /go/src/github.com/hwameistor/hwameistor
# [OPERATOR]
#----------------
# Operator tools
OPERATOR_CMD = operator-sdk
# [ CHART ]
#----------------
RENDER_CHART_VALUES = ${PROJECT_SOURCE_CODE_DIR}/build/util/render-chart-values.sh