Skip to content

Commit

Permalink
Merge pull request #5 from olcf/ci
Browse files Browse the repository at this point in the history
First pass at adding CI
  • Loading branch information
josephvoss authored May 13, 2021
2 parents a0b3046 + 29ec214 commit 94f60c3
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 33 deletions.
32 changes: 0 additions & 32 deletions .ci/buildconfig.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
24 changes: 24 additions & 0 deletions .github/workflows/build-dev-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: build-dev-image
on: [workflow_dispatch]
jobs:
build-dev-image:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to registry
uses: docker/login-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
- name: Build dev image
uses: docker/build-push-action@v2
with:
context: build/
pull: true
push: true
tags: ghcr.io/olcf/greggd/dev-image:8.3_20210513
19 changes: 19 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: build
on: [push]
jobs:
build-binary:
runs-on: ubuntu-20.04
container: ghcr.io/olcf/greggd/dev-image:8.3_20210513
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: go build -v ./cmd/greggd/
- name: Test
run: go test -v ./...
- name: Save artifact
uses: actions/upload-artifact@v2
with:
name: greggd
path: greggd
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: release
on: {push: {tags: ['*.*.*']}}
jobs:
release:
runs-on: ubuntu-20.04
container: ghcr.io/olcf/greggd/dev-image:8.3_20210513
steps:
- name: Checkout
uses: actions/checkout@v2
# No shallow clone
with:
fetch-depth: 0
- name: Export release vars
id: vars
shell: bash
run: |
echo "::set-output name=version::$(git describe --tags --abbrev=0)"
echo "::set-output name=release::$(git rev-parse --short HEAD)"
- name: Build
run: go build -v ./cmd/greggd/
- name: Test
run: go test -v ./...
- name: Build RPM
env:
VERSION: ${{ steps.vars.outputs.version }}
RELEASE: ${{ steps.vars.outputs.release }}
run: |
envsubst < build/nfpm-template.yaml > build/nfpm.yaml
nfpm -f build/nfpm.yaml pkg --packager rpm
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: greggd*.rpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ each program, parse it, and send output to a local socket on the host.
Current eBPF and bcc tooling that "works" as a sensor:

- opensnoop: file open() calls
- execsnoop: log exec() syscalls
- biolatency: block I/O latency histograms
- tcplife: tcp session lifetime and connection details

Expand Down
18 changes: 18 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Docker file for development image for greggd
#
# Builds image with all needed dependecies
#

FROM centos:8.3.2011

LABEL name="greggd-devel" \
version="centos8.3-297"

RUN dnf install --enablerepo=powertools -y \
@development git golang kernel-devel bcc-devel; \
yum clean all
RUN \
curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.5.1/nfpm_amd64.rpm; \
rpm -i nfpm_amd64.rpm; rm nfpm_amd64.rpm

CMD ["/bin/bash"]
17 changes: 17 additions & 0 deletions build/nfpm-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: "greggd"
arch: "amd64"
version: "${VERSION}"
release: "${RELEASE}"
homepage: "github.com/olcf/greggd"
description: |
Global runtime for eBPF-enabled gathering (w/ gumption) daemon
depends:
- bcc
contents:
- src: ./greggd
dst: /usr/sbin/greggd
- src: ./csrc/**
dst: /usr/share/greggd/c/
- src: ./init/greggd.service
dst: /usr/lib/systemd/system/greggd.service
2 changes: 1 addition & 1 deletion pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func TestParseConfigCompleteExample(t *testing.T) {
{Name: "id", Type: "u64"}, {Name: "fname", Type: "char[255]", IsTag: true}}}}},
},
}
f, err := os.Open("testdata/example_config.yaml")
f, err := os.Open("../../test/data/example_config.yaml")
if err != nil {
t.Errorf("Error thrown when opening config file test fixture: %v", err)
return
Expand Down
30 changes: 30 additions & 0 deletions test/data/example_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
globals:
socketPath: /run/greggd.sock
verboseFormat: influx
verbose: true
maxRetryCount: 1
retryDelay: 100ms
retryExponentialBackoff: true

# Hash of all programs to load
programs:
- source: /usr/share/greggd/c/opensnoop.c
# Events to bind program to
events:
- type: kprobe
loadFunc: trace_entry
attachTo: do_sys_open
- type: kretprobe
loadFunc: trace_return
attachTo: do_sys_open
# What should we read from
outputs:
- type: BPF_PERF_OUTPUT
id: opensnoop
format:
- name: id
type: u64
- name: fname
type: char[255]
isTag: true

0 comments on commit 94f60c3

Please sign in to comment.