-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
55 lines (40 loc) · 1.48 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
OS ?= $(shell go env GOOS)
ARCH ?= $(shell go env GOARCH)
ALL_PLATFORM = linux/amd64,linux/arm/v7,linux/arm64
BUILD_DATE ?= $(shell date -Is)
GOPATH ?= $(GOPATH)
REGISTRY ?= scaleway
IMAGE ?= scaleway-csi
FULL_IMAGE ?= $(REGISTRY)/$(IMAGE)
TAG ?= $(shell git rev-parse HEAD)
IMAGE_TAG ?= $(shell git rev-parse HEAD)
COMMIT_SHA ?= $(shell git rev-parse HEAD)
DOCKER_CLI_EXPERIMENTAL ?= enabled
.PHONY: default
default: test compile
.PHONY: clean
clean:
go clean -i -x ./...
.PHONY: test
test:
go test -timeout=1m -v -race -short `go list ./... | grep -v /test`
.PHONY: test-sanity
test-sanity:
go test -count=1 -v -timeout 10m github.com/scaleway/scaleway-csi/test/sanity
.PHONY: fmt
fmt:
find . -type f -name "*.go" | grep -v "./vendor/*" | xargs gofmt -s -w -l
.PHONY: compile
compile:
go build -v -o scaleway-csi -ldflags "-X driver.driverVersion=$(TAG)" ./cmd/scaleway-csi
.PHONY: docker-build
docker-build:
@echo "Building scaleway-csi for ${ARCH}"
docker build . --platform=linux/$(ARCH) --build-arg ARCH=$(ARCH) --build-arg TAG=$(TAG) --build-arg COMMIT_SHA=$(COMMIT_SHA) --build-arg BUILD_DATE=$(BUILD_DATE) -f Dockerfile -t ${FULL_IMAGE}:${IMAGE_TAG}-$(ARCH)
.PHONY: docker-buildx-all
docker-buildx-all:
@echo "Making release for tag $(IMAGE_TAG)"
docker buildx build --build-arg TAG=$(TAG) --build-arg COMMIT_SHA=$(COMMIT_SHA) --build-arg BUILD_DATE=$(BUILD_DATE) --platform=$(ALL_PLATFORM) --push -t $(FULL_IMAGE):$(IMAGE_TAG) .
## Release
.PHONY: release
release: docker-buildx-all