mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
Update driver version during build time
update driver version and add git commit to the image. This will help us to identify what latest git commit image contains. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
12
Makefile
12
Makefile
@ -21,6 +21,16 @@ CSI_IMAGE_VERSION=$(if $(ENV_CSI_IMAGE_VERSION),$(ENV_CSI_IMAGE_VERSION),canary)
|
||||
|
||||
$(info cephcsi image settings: $(CSI_IMAGE_NAME) version $(CSI_IMAGE_VERSION))
|
||||
|
||||
GIT_COMMIT=$(shell git rev-list -1 HEAD)
|
||||
|
||||
GO_PROJECT=github.com/ceph/ceph-csi
|
||||
|
||||
# go build flags
|
||||
LDFLAGS ?=
|
||||
LDFLAGS += -X $(GO_PROJECT)/pkg/util.GitCommit=$(GIT_COMMIT)
|
||||
# CSI_IMAGE_VERSION will be considered as the driver version
|
||||
LDFLAGS += -X $(GO_PROJECT)/pkg/util.DriverVersion=$(CSI_IMAGE_VERSION)
|
||||
|
||||
all: cephcsi
|
||||
|
||||
test: go-test static-check
|
||||
@ -38,7 +48,7 @@ func-test:
|
||||
.PHONY: cephcsi
|
||||
cephcsi:
|
||||
if [ ! -d ./vendor ]; then dep ensure -vendor-only; fi
|
||||
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o _output/cephcsi ./cmd/
|
||||
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '$(LDFLAGS) -extldflags "-static"' -o _output/cephcsi ./cmd/
|
||||
|
||||
image-cephcsi: cephcsi
|
||||
cp _output/cephcsi deploy/cephcsi/image/cephcsi
|
||||
|
Reference in New Issue
Block a user