From cf09a9166fd842f7a34080a24bb9be9021fe3c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= <69143962+pmalek-sumo@users.noreply.github.com> Date: Wed, 14 Apr 2021 18:00:46 +0200 Subject: [PATCH] Add opentelemetry-collector-builder with Makefile and Github Action to build on PR (#1300) --- .../opentelemetry-collector-builder.yaml | 49 +++++++++++++++++++ otelcolbuilder/.gitignore | 1 + otelcolbuilder/.otelcol-builder.yaml | 28 +++++++++++ otelcolbuilder/Makefile | 8 +++ 4 files changed, 86 insertions(+) create mode 100644 .github/workflows/opentelemetry-collector-builder.yaml create mode 100644 otelcolbuilder/.gitignore create mode 100644 otelcolbuilder/.otelcol-builder.yaml create mode 100644 otelcolbuilder/Makefile diff --git a/.github/workflows/opentelemetry-collector-builder.yaml b/.github/workflows/opentelemetry-collector-builder.yaml new file mode 100644 index 000000000000..d7a4618e34e2 --- /dev/null +++ b/.github/workflows/opentelemetry-collector-builder.yaml @@ -0,0 +1,49 @@ +name: OpenTelemetry Collector Builder + +on: + pull_request: + branches: + - main + +jobs: + # otelcolbuilder_post_go1_16: + # runs-on: ubuntu-20.04 + # strategy: + # matrix: + # go: [ '1.16' ] + # steps: + # - uses: actions/checkout@v2 + # - name: Setup go + # uses: actions/setup-go@v2 + # with: + # go-version: ${{ matrix.go }} + # - name: Print go version + # run: go version + # - name: Build OpenTelemetry distro + # working-directory: ./otelcolbuilder/ + # run: | + # go install github.com/open-telemetry/opentelemetry-collector-builder@v0.24.0 + # make build + + # Just build on 1.15 for now because of a weird issue: + # https://github.com/actions/setup-go/issues/107 + otelcolbuilder_pre_go1_16: + runs-on: ubuntu-20.04 + strategy: + matrix: + go: [ '1.15' ] + steps: + - uses: actions/checkout@v2 + - name: Setup go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + - name: Print go version + run: go version + - name: Print go env + run: go env + - name: Build OpenTelemetry distro + working-directory: ./otelcolbuilder/ + run: | + make install-prego1.16 + make build diff --git a/otelcolbuilder/.gitignore b/otelcolbuilder/.gitignore new file mode 100644 index 000000000000..b3087b09750d --- /dev/null +++ b/otelcolbuilder/.gitignore @@ -0,0 +1 @@ +cmd/ diff --git a/otelcolbuilder/.otelcol-builder.yaml b/otelcolbuilder/.otelcol-builder.yaml new file mode 100644 index 000000000000..ef9dcbc27bf7 --- /dev/null +++ b/otelcolbuilder/.otelcol-builder.yaml @@ -0,0 +1,28 @@ +dist: + name: otelcol-sumo + description: Sumo Logic OpenTelemetry Collector distribution + + # the module name for the new distribution, following Go mod conventions. Optional, but recommended. + module: github.com/SumoLogic/opentelemetry-collector-builder + + otelcol_version: 0.24.0 # the OpenTelemetry Collector version to use as base for the distribution. + output_path: ./cmd/ # the path to write the output (sources and binary). + +processors: + - gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/processor/cascadingfilterprocessor v0.24.0" + - gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sprocessor v0.24.0" + - gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/processor/sourceprocessor v0.24.0" + +exporters: + - gomod: "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sumologicexporter v0.24.0" + +# Replacement paths are relative to the output_path (location of source files) +replaces: + - github.com/open-telemetry/opentelemetry-collector-contrib/processor/cascadingfilterprocessor => ./../../processor/cascadingfilterprocessor + + - github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sprocessor => ./../../processor/k8sprocessor + - github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig => ./../../internal/k8sconfig + + - github.com/open-telemetry/opentelemetry-collector-contrib/processor/sourceprocessor => ./../../processor/sourceprocessor + + - go.opentelemetry.io/collector => github.com/SumoLogic/opentelemetry-collector v0.24.0-sumo diff --git a/otelcolbuilder/Makefile b/otelcolbuilder/Makefile new file mode 100644 index 000000000000..3f4b7cdbd717 --- /dev/null +++ b/otelcolbuilder/Makefile @@ -0,0 +1,8 @@ +install: + go install github.com/open-telemetry/opentelemetry-collector-builder@v0.24.0 + +install-prego1.16: + GO111MODULE=on go get github.com/open-telemetry/opentelemetry-collector-builder@v0.24.0 + +build: + opentelemetry-collector-builder --config .otelcol-builder.yaml