Skip to content

Commit

Permalink
Merge pull request cloudflare#118 from cloudflare/ivan/release-binaries
Browse files Browse the repository at this point in the history
Publish binaries for x86_64 and aarch64
  • Loading branch information
bobrik authored Oct 18, 2021
2 parents faa6753 + baf17b0 commit 2c998d8
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 26 deletions.
71 changes: 54 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,63 @@ on:
pull_request:

jobs:
build-bcc:
name: Build BCC
build-bcc-x86_64:
name: Build BCC and ebpf_exporter (x86_64)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Build BCC
- name: Build BCC and ebpf_exporter
run: |
docker build -t ebpf-exporter-build .
docker run --rm ebpf-exporter-build cat /tmp/libbcc.deb > libbcc.deb
docker buildx build --progress plain --tag ebpf-exporter-build .
id=$(docker create ebpf-exporter-build)
docker cp $id:/tmp/libbcc.deb libbcc-x86_64.deb
docker cp $id:/root/go/bin/ebpf_exporter ebpf_exporter.x86_64
- name: Upload libbcc.deb
uses: actions/upload-artifact@v2
with:
name: libbcc.deb
path: libbcc.deb
name: libbcc-x86_64.deb
path: libbcc-x86_64.deb

test-ebpf-exporter:
name: Test
needs: build-bcc
- name: Upload ebpf_exporter
uses: actions/upload-artifact@v2
with:
name: ebpf_exporter.x86_64
path: ebpf_exporter.x86_64

build-bcc-aarch64:
name: Build BCC and ebpf_exporter (aarch64 emulated, be patient)
runs-on: ubuntu-20.04
steps:
- uses: dbhi/qus/action@main
with:
targets: aarch64

- uses: actions/checkout@v2

- name: Build BCC and ebpf_exporter
run: |
docker buildx build --progress plain --tag ebpf-exporter-build --platform linux/arm64 .
id=$(docker create ebpf-exporter-build)
docker cp $id:/tmp/libbcc.deb libbcc-x86_64.deb
docker cp $id:/root/go/bin/ebpf_exporter ebpf_exporter.aarch64
- name: Upload libbcc.deb
uses: actions/upload-artifact@v2
with:
name: libbcc-aarch64.deb
path: libbcc-aarch64.deb

- name: Upload ebpf_exporter
uses: actions/upload-artifact@v2
with:
name: ebpf_exporter.aarch64
path: ebpf_exporter.aarch64

test-ebpf-exporter-x86_64:
name: Test ebpf_exporter (x86_64)
needs: build-bcc-x86_64
runs-on: ubuntu-20.04
steps:
- uses: actions/setup-go@v2
Expand All @@ -40,11 +77,11 @@ jobs:
- name: Download libbcc.deb
uses: actions/download-artifact@v2
with:
name: libbcc.deb
name: libbcc-x86_64.deb

- name: Install libbcc
run: |
sudo dpkg -i libbcc.deb
sudo dpkg -i libbcc-x86_64.deb
- name: Check vendored dependencies
run: |
Expand All @@ -56,9 +93,9 @@ jobs:
- name: Test
run: go test -v ./...

lint-ebpf-exporter:
name: Lint
needs: build-bcc
lint-ebpf-exporter-x86_64:
name: Lint ebpf_exporter (x86_64)
needs: build-bcc-x86_64
runs-on: ubuntu-20.04
steps:
- uses: actions/setup-go@v2
Expand All @@ -70,11 +107,11 @@ jobs:
- name: Download libbcc.deb
uses: actions/download-artifact@v2
with:
name: libbcc.deb
name: libbcc-x86_64.deb

- name: Install libbcc
run: |
sudo dpkg -i libbcc.deb
sudo dpkg -i libbcc-x86_64.deb
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2
Expand Down
19 changes: 10 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
FROM ubuntu:20.04 as builder

ENV DEBIAN_FRONTEND=noninteractive
# Building on Ubuntu Bionic (18.04) and supporting glibc 2.27. This allows
# the following distros (and newer versions) to run the resulting binaries:
# * Ubuntu Bionic (2.27)
# * Debian Buster (2.28)
# * CentOS 8 (2.28)
FROM ubuntu:bionic as builder

RUN apt-get update && \
apt-get -y --no-install-recommends install build-essential pbuilder aptitude git openssh-client ca-certificates
apt-get -y --no-install-recommends install build-essential fakeroot pbuilder aptitude git openssh-client ca-certificates

RUN git clone --branch=v0.22.0 --depth=1 https://github.com/iovisor/bcc.git /root/bcc && \
git -C /root/bcc submodule update --init --recursive
Expand All @@ -12,12 +15,10 @@ RUN cd /root/bcc && \
/usr/lib/pbuilder/pbuilder-satisfydepends && \
PARALLEL=$(nproc) ./scripts/build-deb.sh release

FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive
FROM ubuntu:bionic

RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential software-properties-common
apt-get install -y --no-install-recommends build-essential libelf1 software-properties-common

RUN add-apt-repository ppa:longsleep/golang-backports && \
apt-get install -y --no-install-recommends golang-1.17-go
Expand All @@ -30,4 +31,4 @@ RUN dpkg -i /tmp/libbcc.deb

COPY ./ /go/ebpf_exporter

RUN cd /go/ebpf_exporter && GOPATH="" GOPROXY="off" GOFLAGS="-mod=vendor" go install -v ./...
RUN cd /go/ebpf_exporter && GOPROXY="off" GOFLAGS="-mod=vendor" go install -v ./...

0 comments on commit 2c998d8

Please sign in to comment.