-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
49 lines (42 loc) · 1.46 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
ELASTICSEARCH_VERSION = 6.6.0
BEAT_NAME=openconfigbeat
BEAT_DIR=github.com/aristanetworks
BEAT_PATH=$(BEAT_DIR)/$(BEAT_NAME)
SYSTEM_TESTS=false
TEST_ENVIRONMENT=false
ES_BEATS=./vendor/github.com/elastic/beats
GOIMPORTS_LOCAL_PREFIX=github.com/aristanetworks
PREFIX ?= .
DOCKER = docker
ELASTICSEARCH_HOST ?= 127.0.0.1
DOCKER_IMAGE = docker.elastic.co/elasticsearch/elasticsearch:$(ELASTICSEARCH_VERSION)
DOCKER_CONTAINER = openconfigbeat-elasticsearch
GO = go
GOPKGVERSION := $(shell git describe --tags --match "[0-9]*" --abbrev=7 HEAD)
ifndef GOPKGVERSION
$(error unable to determine git version)
endif
GOBUILD_FLAGS ?= -ldflags "-s -w -X github.com/aristanetworks/openconfigbeat/cmd.Version=$(GOPKGVERSION)"
# Path to the libbeat Makefile
CHECK_HEADERS_DISABLED=1
-include $(ES_BEATS)/libbeat/scripts/Makefile
.PHONY: collect
.PHONY: update-deps
update-deps:
dep ensure -update
# This is called by the beats packer before building starts
.PHONY: before-build
before-build:
.PHONY: docker-start
docker-start:
@$(MAKE) docker-stop || true
$(DOCKER) run --name $(DOCKER_CONTAINER) -d -p $(ELASTICSEARCH_HOST):9200:9200 $(DOCKER_IMAGE)
echo "Waiting for elasticsearch to be reachable..." && time sh -c "until curl -sf http://$(ELASTICSEARCH_HOST):9200; do sleep 1; done"
.PHONY: docker-stop
docker-stop:
$(DOCKER) stop $(DOCKER_CONTAINER) && $(DOCKER) rm $(DOCKER_CONTAINER)
.PHONY: beater-test
beater-test: $(BEAT_NAME)
$(MAKE) docker-start
$(MAKE) unit-tests
$(MAKE) docker-stop