Skip to content

Commit

Permalink
Merge pull request #52 from castai/bump-golang-version
Browse files Browse the repository at this point in the history
Bump go version to 1.23.2
  • Loading branch information
davidcastai authored Nov 28, 2024
2 parents cc6b57a + 6178e6b commit d38f41e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Go 1.22
- name: Setup Go 1.23.2
uses: actions/setup-go@v5
with:
go-version: 1.22

- name: Install dependencies
run: |
go install go.opentelemetry.io/collector/cmd/builder@latest
go install github.com/open-telemetry/opentelemetry-collector-contrib/cmd/mdatagen@latest
go-version: 1.23.2

- name: Install dependency
run: go install go.opentelemetry.io/collector/cmd/[email protected]

- name: Get release tag
if: github.event_name == 'release'
run: echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Prepare release
run: builder --skip-compilation --config builder-config.yaml
run: builder --skip-compilation --config builder-config.yaml

- name: Build Go binary amd64
run: cd castai-collector && go build -ldflags "-s -w -X main.GitCommit=$GITHUB_SHA -X main.GitRef=$GITHUB_REF -X main.Version=${RELEASE_TAG:-commit-$GITHUB_SHA}" -o castai-collector-amd64
Expand Down Expand Up @@ -114,4 +112,4 @@ jobs:
uses: fossas/fossa-action@v1
with:
api-key: ${{ secrets.FOSSA_API_KEY }}
container: us-docker.pkg.dev/castai-hub/library/audit-logs-receiver:${{ env.RELEASE_TAG }}
container: us-docker.pkg.dev/castai-hub/library/audit-logs-receiver:${{ env.RELEASE_TAG }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ bin
*.out
# generated componenet test
generated_component_test.go
# opentelemetry collector
opentelemetry-collector
# Go workspace file
go.work.sum

Expand Down
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ GOARCH := $(shell go env GOARCH)

.PHONY: setup # Set up required tools (builder, mdatagen)
setup:
go install go.opentelemetry.io/collector/cmd/builder@latest
go install github.com/open-telemetry/opentelemetry-collector-contrib/cmd/mdatagen@latest
git clone https://github.com/open-telemetry/opentelemetry-collector.git ./opentelemetry-collector
cd ./opentelemetry-collector && git checkout v0.104.0
cd ./opentelemetry-collector/cmd/builder && go build -o builder .
cd ./opentelemetry-collector/cmd/mdatagen && go build -o mdatagen .

.PHONY: audit-logs-metadata # Generating Audit Logs receiver's metadata
audit-logs-metadata:
cd auditlogsreceiver && mdatagen metadata.yaml
cd auditlogsreceiver && ../opentelemetry-collector/cmd/mdatagen/mdatagen metadata.yaml

.PHONY: build # Generate and build collector
build: audit-logs-metadata
$(BUILD_ARGS) builder --config builder-config.yaml
$(BUILD_ARGS) ./opentelemetry-collector/cmd/builder/builder --config builder-config.yaml

.PHONY: run # Run a default collector that outputs everything to console
run:
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ The first step in building a custom Collector is installing required tools, whic
make setup
```

It installs:
- [Open Telemetry Metadata Generator](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/cmd/mdatagen) -
required to generate receiver's definition (metadata about receiver itself); for example, stability level, is this a logs or metrics receiver, etc. Audit Logs Exporter's [metadata is defined here](./auditlogsreceiver/metadata.yaml).
- [Open Telemetry Collector Builder](https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/builder) -
required to generate a code that bootstraps selected components so compilation may produce an executable binary. Builder's [configuration is defined here](./builder-config.yaml)
It clones:
- [Open Telemetry Collector](https://github.com/open-telemetry/opentelemetry-collector)
and builds required tools
- [Open Telemetry Metadata Generator](https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/mdatagen)
required to generate receiver's definition (metadata about receiver itself); for example, stability level, is this a logs or metrics receiver, etc. Audit Logs Exporter's [metadata is defined here](./auditlogsreceiver/metadata.yaml)
- [Open Telemetry Collector Builder](https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/builder) -
required to generate a code that bootstraps selected components so compilation may produce an executable binary. Builder's [configuration is defined here](./builder-config.yaml)

Cloning the repository is required due to open telemetry having replace directives in go.mod file that point to local directories.

Collector can be customized (what gets included in a binary artifact) as needed by tailoring `builder-config.yaml`.
Refer to OpenTelemetry Collector Contrib Distro's (for example, [the manifest](https://github.com/open-telemetry/opentelemetry-collector-releases/blob/main/distributions/otelcol-contrib/manifest.yaml) for a full list of available components.
Expand Down
2 changes: 1 addition & 1 deletion auditlogsreceiver/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/castai/audit-logs-receiver/audit-logs

go 1.22
go 1.23.2

require (
github.com/go-resty/resty/v2 v2.7.0
Expand Down

0 comments on commit d38f41e

Please sign in to comment.