-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
61 lines (49 loc) · 2.12 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
55
56
57
58
59
60
61
.PHONY: all
PROJECT_DIR=/go/src/github.com/cloudradar-monitoring/cagent
ifeq ($(RELEASE_MODE),)
RELEASE_MODE=release-candidate
endif
ifeq ($(RELEASE_MODE),release-candidate)
SELF_UPDATES_FEED_URL="https://repo.cloudradar.io/windows/cagent/feed/rolling"
PROPRIETARY_SELF_UPDATES_FEED_URL="https://repo.cloudradar.io/windows/cagent/feed/plus-rolling"
endif
ifeq ($(RELEASE_MODE),stable)
SELF_UPDATES_FEED_URL="https://repo.cloudradar.io/windows/cagent/feed/stable"
PROPRIETARY_SELF_UPDATES_FEED_URL="https://repo.cloudradar.io/windows/cagent/feed/plus-stable"
endif
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARIES=cagent csender jobmon
all: test build
build:
$(foreach BINARY,$(BINARIES),$(GOBUILD) -o $(BINARY) -v ./cmd/$(BINARY)/...;)
test:
$(GOTEST) -v ./...
clean:
$(GOCLEAN)
rm -f $(BINARIES)
goreleaser-precheck:
@if [ -z ${SELF_UPDATES_FEED_URL} ]; then echo "SELF_UPDATES_FEED_URL is empty"; exit 1; fi
@if [ -z ${PROPRIETARY_SELF_UPDATES_FEED_URL} ]; then echo "PROPRIETARY_SELF_UPDATES_FEED_URL is empty"; exit 1; fi
goreleaser-rm-dist: goreleaser-precheck
GORELEASER_CURRENT_TAG=$(GORELEASER_CURRENT_TAG) SELF_UPDATES_FEED_URL=$(SELF_UPDATES_FEED_URL) PROPRIETARY_SELF_UPDATES_FEED_URL=$(PROPRIETARY_SELF_UPDATES_FEED_URL) goreleaser --rm-dist
goreleaser-snapshot: goreleaser-precheck
GORELEASER_CURRENT_TAG=$(GORELEASER_CURRENT_TAG) SELF_UPDATES_FEED_URL=$(SELF_UPDATES_FEED_URL) PROPRIETARY_SELF_UPDATES_FEED_URL=$(PROPRIETARY_SELF_UPDATES_FEED_URL) goreleaser --snapshot --rm-dist
docker-goreleaser: goreleaser-precheck
docker run -it --rm --privileged \
-v ${PWD}:${PROJECT_DIR} \
-v $(shell go env GOCACHE):/root/.cache/go-build \
-v /var/run/docker.sock:/var/run/docker.sock \
-w ${PROJECT_DIR} \
-e SELF_UPDATES_FEED_URL=$(SELF_UPDATES_FEED_URL) \
-e PROPRIETARY_SELF_UPDATES_FEED_URL=$(SELF_UPDATES_FEED_URL) \
goreleaser/goreleaser:v0.126 --snapshot --rm-dist --skip-publish
docker-golangci-lint:
docker run -it --rm \
-v ${PWD}:${PROJECT_DIR} \
-w ${PROJECT_DIR} \
golangci/golangci-lint:v1.17 golangci-lint -c .golangci.yml run