github.com/csi-driver/blobfuse-csi-driver@v0.5.0/Makefile (about) 1 # Copyright 2017 The Kubernetes Authors. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 PKG = sigs.k8s.io/blobfuse-csi-driver 16 GIT_COMMIT ?= $(shell git rev-parse HEAD) 17 REGISTRY ?= andyzhangx 18 IMAGE_NAME = blobfuse-csi 19 IMAGE_VERSION ?= v0.5.0 20 # Use a custom version for E2E tests if we are in Prow 21 ifdef AZURE_CREDENTIALS 22 override IMAGE_VERSION := e2e-$(GIT_COMMIT) 23 endif 24 IMAGE_TAG = $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_VERSION) 25 IMAGE_TAG_LATEST = $(REGISTRY_NAME)/$(IMAGE_NAME):latest 26 BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ") 27 LDFLAGS ?= "-X ${PKG}/pkg/blobfuse.driverVersion=${IMAGE_VERSION} -X ${PKG}/pkg/blobfuse.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/blobfuse.buildDate=${BUILD_DATE} -s -w -extldflags '-static'" 28 GINKGO_FLAGS = -ginkgo.noColor -ginkgo.v 29 GO111MODULE = off 30 export GO111MODULE 31 32 all: blobfuse 33 34 .PHONY: verify 35 verify: unit-test 36 hack/verify-all.sh 37 38 .PHONY: unit-test 39 unit-test: 40 go test -covermode=count -coverprofile=profile.cov ./pkg/... ./test/utils/credentials 41 42 .PHONY: sanity-test 43 sanity-test: blobfuse 44 go test -v -timeout=30m ./test/sanity 45 46 .PHONY: integration-test 47 integration-test: blobfuse 48 go test -v -timeout=30m ./test/integration 49 50 .PHONY: e2e-test 51 e2e-test: 52 go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS} 53 54 .PHONY: e2e-bootstrap 55 e2e-bootstrap: install-helm 56 # Only build and push the image if it does not exist in the registry 57 docker pull $(IMAGE_TAG) || make blobfuse-container push 58 helm install charts/latest/blobfuse-csi-driver -n blobfuse-csi-driver --namespace kube-system --wait \ 59 --set image.blobfuse.pullPolicy=IfNotPresent \ 60 --set image.blobfuse.repository=$(REGISTRY)/$(IMAGE_NAME) \ 61 --set image.blobfuse.tag=$(IMAGE_VERSION) 62 63 .PHONY: install-helm 64 install-helm: 65 # Use v2.11.0 helm to match tiller's version in clusters made by aks-engine 66 curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | DESIRED_VERSION=v2.11.0 bash 67 # Make sure tiller is ready 68 kubectl wait pod -l name=tiller --namespace kube-system --for condition=ready --timeout 5m 69 helm version 70 71 .PHONY: e2e-teardown 72 e2e-teardown: 73 helm delete --purge blobfuse-csi-driver 74 75 .PHONY: blobfuse 76 blobfuse: 77 if [ ! -d ./vendor ]; then dep ensure -vendor-only; fi 78 CGO_ENABLED=0 GOOS=linux go build -a -ldflags ${LDFLAGS} -o _output/blobfuseplugin ./pkg/blobfuseplugin 79 80 .PHONY: blobfuse-windows 81 blobfuse-windows: 82 if [ ! -d ./vendor ]; then dep ensure -vendor-only; fi 83 CGO_ENABLED=0 GOOS=windows go build -a -ldflags ${LDFLAGS} -o _output/blobfuseplugin.exe ./pkg/blobfuseplugin 84 85 .PHONY: container 86 container: blobfuse 87 docker build --no-cache -t $(IMAGE_TAG) -f ./pkg/blobfuseplugin/Dockerfile . 88 89 .PHONY: blobfuse-container 90 blobfuse-container: blobfuse 91 docker build --no-cache -t $(IMAGE_TAG) -f ./pkg/blobfuseplugin/Dockerfile . 92 93 .PHONY: push 94 push: blobfuse-container 95 docker push $(IMAGE_TAG) 96 97 .PHONY: push-latest 98 push-latest: blobfuse-container 99 docker push $(IMAGE_TAG) 100 docker tag $(IMAGE_TAG) $(IMAGE_TAG_LATEST) 101 docker push $(IMAGE_TAG_LATEST) 102 103 .PHONY: clean 104 clean: 105 go clean -r -x 106 -rm -rf _output