Skip to content

Commit

Permalink
Merge pull request #66 from digitalocean/makefile-improvements
Browse files Browse the repository at this point in the history
Makefile: various improvements
  • Loading branch information
fatih authored Aug 27, 2018
2 parents b73826b + ecdd4ad commit d677728
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## unreleased

* Makefile improvements. Please check the GH link for more information.
[[GH-66]](https://github.com/digitalocean/csi-digitalocean/pull/66)

## v0.1.4 - 2018.08.23

* Add logs to mount operations
Expand Down
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ else
GIT_TREE_STATE=dirty
endif
COMMIT ?= $(shell git rev-parse HEAD)
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
LDFLAGS ?= -X github.com/digitalocean/csi-digitalocean/driver.version=${VERSION} -X github.com/digitalocean/csi-digitalocean/driver.commit=${COMMIT} -X github.com/digitalocean/csi-digitalocean/driver.gitTreeState=${GIT_TREE_STATE}
PKG ?= github.com/digitalocean/csi-digitalocean/cmd/do-csi-plugin

Expand Down Expand Up @@ -35,9 +36,14 @@ compile:
@echo "==> Building the project"
@env CGO_ENABLED=0 GOOS=${OS} GOARCH=amd64 go build -o cmd/do-csi-plugin/${NAME} -ldflags "$(LDFLAGS)" ${PKG}

compile-dev:
@echo "==> Building the project"
$(eval VERSION = dev)
@env CGO_ENABLED=0 GOOS=${OS} GOARCH=amd64 go build -o cmd/do-csi-plugin/${NAME} -ldflags "$(LDFLAGS)" ${PKG}

test:
@echo "==> Testing all packages"
@go test ./...
@go test -v ./...


build:
Expand All @@ -46,14 +52,15 @@ build:


push:

ifneq ($(BRANCH),master)
@echo "ERROR: Publishing image with a SEMVER version '$(VERSION)' is only allowed from master"
else
@echo "==> Publishing digitalocean/do-csi-plugin:$(VERSION)"
@docker push digitalocean/do-csi-plugin:$(VERSION)
@echo "==> Your image is now available at digitalocean/do-csi-plugin:$(VERSION)"
endif

compile-dev:
@echo "==> Building the project"
$(eval VERSION = dev)
@env CGO_ENABLED=0 go build -o cmd/do-csi-plugin/${NAME} -ldflags "$(LDFLAGS)" ${PKG}

build-dev:
@echo "==> Building the docker image"
Expand Down

0 comments on commit d677728

Please sign in to comment.