-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
131 lines (105 loc) · 3.78 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
RELEASE?=master
BRANCH?=master
DATE:=$(shell date +%y%m%d%H%M%S)
BUILDID?=$(DATE)
.PHONY: all
all: packetbeat/deb packetbeat/rpm packetbeat/darwin packetbeat/win packetbeat/bin \
topbeat/deb topbeat/rpm topbeat/darwin topbeat/win topbeat/bin \
filebeat/deb filebeat/rpm filebeat/darwin filebeat/win filebeat/bin \
winlogbeat/win \
build/upload/build_id.txt latest
.PHONY: packetbeat topbeat filebeat
packetbeat topbeat filebeat winlogbeat: build/upload
# cross compile on ubuntu
cd build && xgo -image=tudorg/beats-builder \
-before-build=../xgo-scripts/$@_before_build.sh \
-branch $(BRANCH) \
-pkg $@ \
github.com/elastic/beats
# linux builds on debian 6
cd build && xgo -image=tudorg/beats-builder-deb6 \
-before-build=../xgo-scripts/$@_before_build.sh \
-branch $(BRANCH) \
-pkg $@ \
github.com/elastic/beats
%/deb: % build/god-linux-386 build/god-linux-amd64 fpm-image
ARCH=386 RELEASE=$(RELEASE) BEAT=$(@D) BUILDID=$(BUILDID) ./platforms/debian/build.sh
ARCH=amd64 RELEASE=$(RELEASE) BEAT=$(@D) BUILDID=$(BUILDID) ./platforms/debian/build.sh
%/rpm: % build/god-linux-386 build/god-linux-amd64 fpm-image
ARCH=386 RELEASE=$(RELEASE) BEAT=$(@D) BUILDID=$(BUILDID) ./platforms/centos/build.sh
ARCH=amd64 RELEASE=$(RELEASE) BEAT=$(@D) BUILDID=$(BUILDID) ./platforms/centos/build.sh
%/darwin: %
ARCH=amd64 RELEASE=$(RELEASE) BEAT=$(@D) BUILDID=$(BUILDID) ./platforms/darwin/build.sh
%/win: %
ARCH=amd64 RELEASE=$(RELEASE) BEAT=$(@D) BUILDID=$(BUILDID) ./platforms/windows/build.sh
%/bin: %
ARCH=386 RELEASE=$(RELEASE) BEAT=$(@D) BUILDID=$(BUILDID) ./platforms/binary/build.sh
ARCH=amd64 RELEASE=$(RELEASE) BEAT=$(@D) BUILDID=$(BUILDID) ./platforms/binary/build.sh
.PHONY: deps
deps:
go get github.com/tsg/xgo
go get github.com/tsg/gotpl
.PHONY: xgo-image
xgo-image:
cd docker/xgo-image/; ./build.sh
cd docker/xgo-image-deb6/; ./build.sh
.PHONY: fpm-image
fpm-image:
docker build --rm=true -t tudorg/fpm docker/fpm-image/
.PHONY: go-daemon-image
go-daemon-image:
docker build --rm=true -t tudorg/go-daemon docker/go-daemon/
build/god-linux-386 build/god-linux-amd64:
docker run -v $(shell pwd)/build:/build tudorg/go-daemon
build/upload:
mkdir -p build/upload
build/upload/build_id.txt:
echo $(BUILDID) > build/upload/build_id.txt
.PHONY: s3-nightlies-upload
s3-nightlies-upload: all
aws s3 cp --recursive --acl public-read build/upload s3://beats-nightlies
# Build the image required for package-upload.
.PHONY: deb-rpm-s3
deb-rpm-s3:
docker/deb-rpm-s3/build.sh
# Run after building to sign packages and publish to APT and YUM repos.
.PHONY: package-upload
package-upload:
# You must export AWS_ACCESS_KEY=<AWS access> and export AWS_SECRET_KEY=<secret>
# before running this make target.
docker/deb-rpm-s3/deb-rpm-s3.sh
.PHONY: release-upload
release-upload:
aws s3 cp --recursive --acl public-read build/upload s3://download.elasticsearch.org/beats/
.PHONY: run-interactive
run-interactive:
docker run -t -i -v $(shell pwd)/build:/build \
-v $(shell pwd)/xgo-scripts/:/scripts \
--entrypoint=bash tudorg/beats-builder-deb6
.PHONY: images
images: xgo-image fpm-image go-daemon-image
.PHONY: push-images
push-images:
docker push tudorg/beats-builder
docker push tudorg/beats-builder-deb6
docker push tudorg/fpm
docker push tudorg/go-daemon
.PHONY: pull-images
pull-images:
docker pull tudorg/beats-builder
docker pull tudorg/beats-builder-deb6
docker pull tudorg/fpm
docker pull tudorg/go-daemon
.PHONY: clean
clean:
rm -rf build/ || true
-docker rm -v build-image
# Creates a latest file for the most recent build
.PHONY: latest
latest:
BUILDID=${BUILDID} \
./xgo-scripts/latest.sh
# Prints the download URLs. Only works after building
.PHONY: list-urls
list-urls:
find build/binary/upload/ -type f | grep -v sha | sed 's!build/binary/upload/!https://download.elastic.co/beats/!'