Skip to content

Commit

Permalink
Merge pull request #34 from cloudflare/release-binary
Browse files Browse the repository at this point in the history
Add release infrastructure for pre-built binaries
  • Loading branch information
bobrik authored Aug 20, 2018
2 parents ca5feb8 + c364568 commit 9fefbc2
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.10.3-stretch

# Doing mostly what CI is doing here
RUN apt-get update && \
apt-get install -y apt-transport-https && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648A4A16A23015EEF4A66B8E4052245BD4284CDD && \
echo "deb https://repo.iovisor.org/apt/xenial xenial main" > /etc/apt/sources.list.d/iovisor.list && \
apt-get update && \
apt-get install -y libbcc=0.6.1-1 linux-headers-amd64

ENV GO_PACKAGE=github.com/cloudflare/ebpf_exporter

COPY ./ /go/src/$GO_PACKAGE

RUN go install -v $GO_PACKAGE/cmd/...
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
RELEASE := $(shell git describe --tags --always --dirty=-dev | sed s'/^v//g')

RELEASES_DIR := release

RELEASE_AMD64_DIR := ebpf_exporter-$(RELEASE)
RELEASE_AMD64_BINARY := $(RELEASES_DIR)/$(RELEASE_AMD64_DIR)/ebpf_exporter

.PHONY: release-binaries
release-binaries:
rm -rf $(RELEASES_DIR)/*
mkdir -p $(RELEASES_DIR)/$(RELEASE_AMD64_DIR)
docker build -t ebpf-exporter-build .
docker run --rm --entrypoint cat ebpf-exporter-build /go/bin/ebpf_exporter > $(RELEASE_AMD64_BINARY)
chmod +x $(RELEASE_AMD64_BINARY)
cd $(RELEASES_DIR) && tar -czf $(RELEASE_AMD64_DIR).tar.gz $(RELEASE_AMD64_DIR)
cd $(RELEASES_DIR) && shasum -a 256 *.tar.gz > sha256sums.txt
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ To build, you need to have `libbcc` installed:

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

You can use pre-compiled binary from Releases:

* https://github.com/cloudflare/ebpf_exporter/releases

That still requires you to have `libbcc`. To build release binaries yourself:

```
$ make release-binaries
```

To build a package from latest sources:

```
$ mkdir /tmp/ebpf_exporter
$ cd /tmp/ebpf_exporter
Expand Down
2 changes: 2 additions & 0 deletions release/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*
!/.gitignore

0 comments on commit 9fefbc2

Please sign in to comment.