Skip to content

Commit 9fefbc2

Browse files
authored
Merge pull request #34 from cloudflare/release-binary
Add release infrastructure for pre-built binaries
2 parents ca5feb8 + c364568 commit 9fefbc2

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM golang:1.10.3-stretch
2+
3+
# Doing mostly what CI is doing here
4+
RUN apt-get update && \
5+
apt-get install -y apt-transport-https && \
6+
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648A4A16A23015EEF4A66B8E4052245BD4284CDD && \
7+
echo "deb https://repo.iovisor.org/apt/xenial xenial main" > /etc/apt/sources.list.d/iovisor.list && \
8+
apt-get update && \
9+
apt-get install -y libbcc=0.6.1-1 linux-headers-amd64
10+
11+
ENV GO_PACKAGE=github.com/cloudflare/ebpf_exporter
12+
13+
COPY ./ /go/src/$GO_PACKAGE
14+
15+
RUN go install -v $GO_PACKAGE/cmd/...

Makefile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
RELEASE := $(shell git describe --tags --always --dirty=-dev | sed s'/^v//g')
2+
3+
RELEASES_DIR := release
4+
5+
RELEASE_AMD64_DIR := ebpf_exporter-$(RELEASE)
6+
RELEASE_AMD64_BINARY := $(RELEASES_DIR)/$(RELEASE_AMD64_DIR)/ebpf_exporter
7+
8+
.PHONY: release-binaries
9+
release-binaries:
10+
rm -rf $(RELEASES_DIR)/*
11+
mkdir -p $(RELEASES_DIR)/$(RELEASE_AMD64_DIR)
12+
docker build -t ebpf-exporter-build .
13+
docker run --rm --entrypoint cat ebpf-exporter-build /go/bin/ebpf_exporter > $(RELEASE_AMD64_BINARY)
14+
chmod +x $(RELEASE_AMD64_BINARY)
15+
cd $(RELEASES_DIR) && tar -czf $(RELEASE_AMD64_DIR).tar.gz $(RELEASE_AMD64_DIR)
16+
cd $(RELEASES_DIR) && shasum -a 256 *.tar.gz > sha256sums.txt

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ To build, you need to have `libbcc` installed:
2929

3030
* https://github.com/iovisor/bcc/blob/master/INSTALL.md
3131

32+
You can use pre-compiled binary from Releases:
33+
34+
* https://github.com/cloudflare/ebpf_exporter/releases
35+
36+
That still requires you to have `libbcc`. To build release binaries yourself:
37+
38+
```
39+
$ make release-binaries
40+
```
41+
42+
To build a package from latest sources:
43+
3244
```
3345
$ mkdir /tmp/ebpf_exporter
3446
$ cd /tmp/ebpf_exporter

release/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/*
2+
!/.gitignore

0 commit comments

Comments
 (0)