From 41bc0a50196b89e70d60bcfc1484884a7c37996e Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 10:08:37 -0400 Subject: [PATCH 01/25] First pass at adding CI --- .github/dependabot.yml | 8 ++++++++ .github/workflows/build-dev-image.yml | 16 ++++++++++++++++ .github/workflows/package.yml | 19 +++++++++++++++++++ .github/workflows/release.yml | 20 ++++++++++++++++++++ README.md | 1 + build/Dockerfile | 14 ++++++++++++++ 6 files changed, 78 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build-dev-image.yml create mode 100644 .github/workflows/package.yml create mode 100644 .github/workflows/release.yml create mode 100644 build/Dockerfile diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..8e85703 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +--- +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/build-dev-image.yml b/.github/workflows/build-dev-image.yml new file mode 100644 index 0000000..c92c1ca --- /dev/null +++ b/.github/workflows/build-dev-image.yml @@ -0,0 +1,16 @@ +--- +name: build-dev-image +on: workflow_dispatch +jobs: + build-dev-image: + runs-on: ubuntu-20.04 + steps: + - name: Build dev image + uses: docker/build-push-action@v1 + with: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + repository: olcf/greggd/dev-image + tag_with_ref: true + context: build/ diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..97dae3f --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,19 @@ +--- +name: build +on: [push] +jobs: + build-binary: + runs-on: ubuntu-20.04 + container: ghcr.io/olcf/greggd/dev-image:latest + 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..65651df --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,20 @@ +--- +name: release +on: {push: {tags: ['v*.*.*']}} +jobs: + release: + runs-on: ubuntu-20.04 + container: ghcr.io/olcf/greggd/dev-image:latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build + run: go build -v ./cmd/greggd/ + - name: Test + run: go test -v ./... + - name: Build RPM + run: nfpm -f build/nfpm.yaml pkg --packager rpm + - name: Release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index c9f571a..80da3ce 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/build/Dockerfile b/build/Dockerfile new file mode 100644 index 0000000..594be45 --- /dev/null +++ b/build/Dockerfile @@ -0,0 +1,14 @@ +# Docker file for development image for greggd +# +# Builds image with all needed dependecies +# + +FROM registry.access.redhat.com/ubi8/ubi:8.3-297 + +LABEL name="greggd-devel" \ + version="rhel8.3-297" + +RUN yum install -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"] From fc0ec7f1262bc406b0739f48114ee15d6030f809 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 11:02:54 -0400 Subject: [PATCH 02/25] Add push event to build-dev-image for testing --- .github/workflows/build-dev-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-dev-image.yml b/.github/workflows/build-dev-image.yml index c92c1ca..2244c72 100644 --- a/.github/workflows/build-dev-image.yml +++ b/.github/workflows/build-dev-image.yml @@ -1,6 +1,6 @@ --- name: build-dev-image -on: workflow_dispatch +on: [workflow_dispatch, push] jobs: build-dev-image: runs-on: ubuntu-20.04 From a1661529a9264e0574f35884c33651e264f4ecd1 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 11:04:32 -0400 Subject: [PATCH 03/25] Update build-push-action, add checkout --- .github/workflows/build-dev-image.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-dev-image.yml b/.github/workflows/build-dev-image.yml index 2244c72..5e2b280 100644 --- a/.github/workflows/build-dev-image.yml +++ b/.github/workflows/build-dev-image.yml @@ -5,8 +5,10 @@ jobs: build-dev-image: runs-on: ubuntu-20.04 steps: + - name: Checkout + uses: actions/checkout@v2 - name: Build dev image - uses: docker/build-push-action@v1 + uses: docker/build-push-action@v2 with: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} From 69d6f0ce5cf12ee625cfca7c819c297d61f4a6c9 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 13:18:26 -0400 Subject: [PATCH 04/25] Change dockerfile to use centos --- build/Dockerfile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index 594be45..b93500b 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -3,12 +3,16 @@ # Builds image with all needed dependecies # -FROM registry.access.redhat.com/ubi8/ubi:8.3-297 +FROM centos:8.3.2011 LABEL name="greggd-devel" \ - version="rhel8.3-297" + version="centos8.3-297" -RUN yum install -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 +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"] From 51fd090c465afb860e3ff56b9654be301186b52f Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 13:25:46 -0400 Subject: [PATCH 05/25] Fix issues w/ build-push-action@v2 --- .github/workflows/build-dev-image.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-dev-image.yml b/.github/workflows/build-dev-image.yml index 5e2b280..d91634a 100644 --- a/.github/workflows/build-dev-image.yml +++ b/.github/workflows/build-dev-image.yml @@ -7,12 +7,19 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Build dev image - uses: docker/build-push-action@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 repository: olcf/greggd/dev-image - tag_with_ref: true + - name: Build dev image + uses: docker/build-push-action@v2 + with: context: build/ + pull: true + push: true + tag_with_ref: true From b461477dba8c9a1d61147dcf925586b2fbfc6c90 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 13:28:50 -0400 Subject: [PATCH 06/25] Tag dev image --- .github/workflows/build-dev-image.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-dev-image.yml b/.github/workflows/build-dev-image.yml index d91634a..d2cca5c 100644 --- a/.github/workflows/build-dev-image.yml +++ b/.github/workflows/build-dev-image.yml @@ -15,11 +15,10 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io - repository: olcf/greggd/dev-image - name: Build dev image uses: docker/build-push-action@v2 with: context: build/ pull: true push: true - tag_with_ref: true + tags: olcf/greggd/dev-image:8.3_20210513 From c7ff0c4bc0857368f2cababed32b2a5c7c395510 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 13:32:08 -0400 Subject: [PATCH 07/25] Remove && from nfpm install --- build/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index b93500b..6e1e6ae 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -12,7 +12,7 @@ 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 + 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"] From 443486667f913f78207ccc7dd4efef23476b32b9 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 13:39:53 -0400 Subject: [PATCH 08/25] Need to specify github registry in tag --- .github/workflows/build-dev-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-dev-image.yml b/.github/workflows/build-dev-image.yml index d2cca5c..7476525 100644 --- a/.github/workflows/build-dev-image.yml +++ b/.github/workflows/build-dev-image.yml @@ -21,4 +21,4 @@ jobs: context: build/ pull: true push: true - tags: olcf/greggd/dev-image:8.3_20210513 + tags: ghcr.io/olcf/greggd/dev-image:8.3_20210513 From e91f06cd7fcd38ce0600685ebea84bf105d9864e Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 13:52:56 -0400 Subject: [PATCH 09/25] Add nfpm-template --- .github/workflows/release.yml | 14 +++++++++++++- build/nfpm-template.yaml | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 build/nfpm-template.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65651df..827ef53 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,12 +8,24 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - 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 - run: nfpm -f build/nfpm.yaml pkg --packager rpm + env: + VERSION: ${{ steps.vars.outputs.version }} + RELEASE: ${{ steps.vars.outputs.release }} + run: | + cd build + envsubst < nfpm-template.yaml > nfpm.yaml + nfpm pkg --packager rpm - name: Release uses: softprops/action-gh-release@v1 env: diff --git a/build/nfpm-template.yaml b/build/nfpm-template.yaml new file mode 100644 index 0000000..a3bdc79 --- /dev/null +++ b/build/nfpm-template.yaml @@ -0,0 +1,14 @@ +--- +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 +files: + ./cmd/greggd/greggd: "/usr/sbin/greggd" + ./csrc/**: "/usr/share/greggd/c/" + ./init/greggd.service: "/usr/lib/systemd/system/greggd.service" From fca7ef7904710cc8ffc85691a5207fb90f4aaa8e Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 13:59:44 -0400 Subject: [PATCH 10/25] Remove push event on build-dev-image --- .github/workflows/build-dev-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-dev-image.yml b/.github/workflows/build-dev-image.yml index 7476525..4c0cd08 100644 --- a/.github/workflows/build-dev-image.yml +++ b/.github/workflows/build-dev-image.yml @@ -1,6 +1,6 @@ --- name: build-dev-image -on: [workflow_dispatch, push] +on: [workflow_dispatch] jobs: build-dev-image: runs-on: ubuntu-20.04 From 7ac087359059c635a2d5b97e3da74ff79161ef90 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 14:02:09 -0400 Subject: [PATCH 11/25] Rename tag in build workflow --- .github/workflows/{package.yml => build.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{package.yml => build.yml} (86%) diff --git a/.github/workflows/package.yml b/.github/workflows/build.yml similarity index 86% rename from .github/workflows/package.yml rename to .github/workflows/build.yml index 97dae3f..d83b276 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: [push] jobs: build-binary: runs-on: ubuntu-20.04 - container: ghcr.io/olcf/greggd/dev-image:latest + container: ghcr.io/olcf/greggd/dev-image:8.3_20210513 steps: - name: Checkout uses: actions/checkout@v2 From cbf9f77866732d5e7fea57ea8351250390c5a50d Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 14:04:45 -0400 Subject: [PATCH 12/25] Fix path to test fixture --- pkg/config/config_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 7776505..4a33f92 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -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 From 5aa938fc50230e695a21d06ca99c71e007a70ca1 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 14:06:21 -0400 Subject: [PATCH 13/25] Save test fixture --- test/data/example_config.yaml | 97 +++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 test/data/example_config.yaml diff --git a/test/data/example_config.yaml b/test/data/example_config.yaml new file mode 100644 index 0000000..2b58cfe --- /dev/null +++ b/test/data/example_config.yaml @@ -0,0 +1,97 @@ +--- +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: pid + type: u32 + isTag: true + - name: ret + type: int32 + - name: fname + type: char[255] + isTag: true + filter: + "or": + - "have-prefix": "\"/proc" + - "have-prefix": "\"/sys" + - name: flag + type: int32 + formatString: "%#o" + - source: /usr/share/greggd/c/tcplife.c + # Events to bind program to + events: + - type: kprobe + loadFunc: kprobe__tcp_set_state + attachTo: tcp_set_state + # ipv6 is left as an exercise to the reader + # What should we read from + outputs: + - type: BPF_PERF_OUTPUT + id: ipv4_events + format: + - name: pid + type: u32 + isTag: true + - name: laddr + type: u32 + isIP: true + - name: raddr + type: u32 + isIP: true + - source: /usr/share/greggd/c/tcplife.c + # Events to bind program to + events: + - type: kprobe + loadFunc: kprobe__tcp_set_state + attachTo: tcp_set_state + # ipv6 is left as an exercise to the reader + # What should we read from + outputs: + - type: BPF_PERF_OUTPUT + id: ipv4_events + format: + - name: pid + type: u32 + isTag: true + - name: laddr + type: u32 + isIP: true + - name: raddr + type: u32 + isIP: true + - source: /ccs/home/jvoss/greggd/csrc/ldist.c + outputs: + - type: BPF_HASH + id: ldist_hist + poll: 10s + clear: true + format: + - name: slot + type: u64 + key: + name: keyy + type: u32 + formatString: "%x" From 5850482f96aecc506dec869e4ee1b59cb3abd13d Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 14:13:38 -0400 Subject: [PATCH 14/25] Simplify config fixture --- pkg/config/config_test.go | 2 +- test/data/example_config.yaml | 67 ----------------------------------- 2 files changed, 1 insertion(+), 68 deletions(-) diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 4a33f92..2d74df5 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -115,7 +115,7 @@ func TestParseConfigCompleteExample(t *testing.T) { {Name: "id", Type: "u64"}, {Name: "fname", Type: "char[255]", IsTag: true}}}}}, }, } - f, err := os.Open("test/data/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 diff --git a/test/data/example_config.yaml b/test/data/example_config.yaml index 2b58cfe..740c5ee 100644 --- a/test/data/example_config.yaml +++ b/test/data/example_config.yaml @@ -25,73 +25,6 @@ programs: format: - name: id type: u64 - - name: pid - type: u32 - isTag: true - - name: ret - type: int32 - name: fname type: char[255] isTag: true - filter: - "or": - - "have-prefix": "\"/proc" - - "have-prefix": "\"/sys" - - name: flag - type: int32 - formatString: "%#o" - - source: /usr/share/greggd/c/tcplife.c - # Events to bind program to - events: - - type: kprobe - loadFunc: kprobe__tcp_set_state - attachTo: tcp_set_state - # ipv6 is left as an exercise to the reader - # What should we read from - outputs: - - type: BPF_PERF_OUTPUT - id: ipv4_events - format: - - name: pid - type: u32 - isTag: true - - name: laddr - type: u32 - isIP: true - - name: raddr - type: u32 - isIP: true - - source: /usr/share/greggd/c/tcplife.c - # Events to bind program to - events: - - type: kprobe - loadFunc: kprobe__tcp_set_state - attachTo: tcp_set_state - # ipv6 is left as an exercise to the reader - # What should we read from - outputs: - - type: BPF_PERF_OUTPUT - id: ipv4_events - format: - - name: pid - type: u32 - isTag: true - - name: laddr - type: u32 - isIP: true - - name: raddr - type: u32 - isIP: true - - source: /ccs/home/jvoss/greggd/csrc/ldist.c - outputs: - - type: BPF_HASH - id: ldist_hist - poll: 10s - clear: true - format: - - name: slot - type: u64 - key: - name: keyy - type: u32 - formatString: "%x" From b960131dc258888f2a2aa8d34574392b594b8746 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 14:19:30 -0400 Subject: [PATCH 15/25] Test release workflow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 827ef53..df9eb9f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,6 @@ --- name: release -on: {push: {tags: ['v*.*.*']}} +on: [push] jobs: release: runs-on: ubuntu-20.04 From 415a486edadc1324a20a2a0469feb3056776b4c4 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 14:24:58 -0400 Subject: [PATCH 16/25] Fix image tag in release --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df9eb9f..bb3fb3e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,7 @@ on: [push] jobs: release: runs-on: ubuntu-20.04 - container: ghcr.io/olcf/greggd/dev-image:latest + container: ghcr.io/olcf/greggd/dev-image:8.3_20210513 steps: - name: Checkout uses: actions/checkout@v2 From 512b73036f36c0193b99b9b2363a01e01892e66d Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 14:28:05 -0400 Subject: [PATCH 17/25] Build RPM from top level dir --- .github/workflows/release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bb3fb3e..19651f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,9 +23,8 @@ jobs: VERSION: ${{ steps.vars.outputs.version }} RELEASE: ${{ steps.vars.outputs.release }} run: | - cd build - envsubst < nfpm-template.yaml > nfpm.yaml - nfpm pkg --packager rpm + envsubst < build/nfpm-template.yaml > build/nfpm.yaml + nfpm -f build/nfpm.yaml pkg --packager rpm - name: Release uses: softprops/action-gh-release@v1 env: From 89e4dcef7c2be58c708eb41ad897088532044b23 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 14:42:44 -0400 Subject: [PATCH 18/25] No shallow clone in release --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 19651f1..b55a2e8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + # No shallow clone + with: + fetch-depth: 0 - name: Export release vars id: vars shell: bash From 578d843b49c4961558725f3454059f83817969a0 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 14:47:30 -0400 Subject: [PATCH 19/25] Fix path to local binary in nfpm --- build/nfpm-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/nfpm-template.yaml b/build/nfpm-template.yaml index a3bdc79..e15eb76 100644 --- a/build/nfpm-template.yaml +++ b/build/nfpm-template.yaml @@ -9,6 +9,6 @@ description: | depends: - bcc files: - ./cmd/greggd/greggd: "/usr/sbin/greggd" + ./greggd: "/usr/sbin/greggd" ./csrc/**: "/usr/share/greggd/c/" ./init/greggd.service: "/usr/lib/systemd/system/greggd.service" From cd34905e64969ef31cb87f0752a8e2c0c78fdf67 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 14:50:20 -0400 Subject: [PATCH 20/25] Convert to new nfpm config format --- build/nfpm-template.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build/nfpm-template.yaml b/build/nfpm-template.yaml index e15eb76..cf6a9ba 100644 --- a/build/nfpm-template.yaml +++ b/build/nfpm-template.yaml @@ -8,7 +8,10 @@ description: | Global runtime for eBPF-enabled gathering (w/ gumption) daemon depends: - bcc -files: - ./greggd: "/usr/sbin/greggd" - ./csrc/**: "/usr/share/greggd/c/" - ./init/greggd.service: "/usr/lib/systemd/system/greggd.service" +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 From 754c303f6fe82718f06e44d020e0039415b60e72 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 14:54:30 -0400 Subject: [PATCH 21/25] Test dummy release --- .github/workflows/release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b55a2e8..c64ab2d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,5 +30,9 @@ jobs: 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 + tag: 0.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c6b4372bba1decada3e4310e2a1781c066de3ad6 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 14:56:14 -0400 Subject: [PATCH 22/25] Use right syntax for action-gh-release --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c64ab2d..31911a8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,6 +33,6 @@ jobs: #if: startsWith(github.ref, 'refs/tags/') with: files: greggd*.rpm - tag: 0.0.0 + tag_name: 0.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b5566e90b9560b1ff71973f882334a8b149bb5e2 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 14:59:20 -0400 Subject: [PATCH 23/25] Remove testing params for release job --- .github/workflows/release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31911a8..7ff1e64 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,9 +30,8 @@ jobs: nfpm -f build/nfpm.yaml pkg --packager rpm - name: Release uses: softprops/action-gh-release@v1 - #if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') with: files: greggd*.rpm - tag_name: 0.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1c0fd55861a2e443eabcbb63c93059693e0e9af2 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 15:05:59 -0400 Subject: [PATCH 24/25] Change tag syntax --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ff1e64..aa83774 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,6 @@ --- name: release -on: [push] +on: {push: {tags: ['*.*.*']}} jobs: release: runs-on: ubuntu-20.04 From 29ec214f045cbd13eafd947b44664cc3504db7a2 Mon Sep 17 00:00:00 2001 From: Joseph Voss Date: Thu, 13 May 2021 15:08:47 -0400 Subject: [PATCH 25/25] Removing old buildconfig now that we have a dockerfile --- .ci/buildconfig.yaml | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .ci/buildconfig.yaml diff --git a/.ci/buildconfig.yaml b/.ci/buildconfig.yaml deleted file mode 100644 index 431b3e1..0000000 --- a/.ci/buildconfig.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -apiVersion: image.openshift.io/v1 -kind: ImageStream -metadata: - name: greggd-golang-amd64 - ---- -apiVersion: build.openshift.io/v1 -kind: BuildConfig -metadata: - name: greggd-golang-amd64 -spec: - output: - to: - kind: ImageStreamTag - name: greggd-golang-amd64:v1.13 - runPolicy: Serial - source: - dockerfile: | - FROM rhel7-base-amd64:latest - - RUN cat /etc/yum.repos.d/*; \ - yum install -y ruby ruby-devel rubygem-bundler make gcc rpm-build git; \ - yum install -y golang-1.13 bcc bcc-devel; \ - gem install fpm; \ - yum clean all - - CMD /bin/bash - strategy: - type: Docker - dockerStrategy: - noCache: true