Skip to content

Commit 3fd71e5

Browse files
authored
Fix OBI generator image (#249)
1 parent 193ec55 commit 3fd71e5

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

.github/workflows/generator-image.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
inputs:
55
override_image_tag:
66
type: string
7-
description: Override image tag (empty for current timestamp)
7+
description: "Override image tag (empty: SemVer patch + 1)"
88

99
# Set restrictive permissions at workflow level
1010
permissions:
@@ -96,3 +96,4 @@ jobs:
9696
labels: ${{ steps.meta.outputs.labels }}
9797
tags: |
9898
"${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ steps.image_tag.outputs.imgtag }}"
99+
"${{ env.REGISTRY }}/${{ env.IMAGE }}:latest"

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ IMG = $(IMG_REGISTRY)/$(IMG_ORG)/$(IMG_NAME):$(VERSION)
2828
# The generator is a container image that provides a reproducible environment for
2929
# building eBPF binaries
3030
GEN_IMG ?= ghcr.io/grafana/beyla-ebpf-generator:main
31+
#TODO: GEN_IMG ?= ghcr.io/open-telemetry/obi-generator:latest
3132

3233
COMPOSE_ARGS ?= -f test/integration/docker-compose.yml
3334

@@ -42,7 +43,7 @@ CLANG_TIDY ?= clang-tidy
4243
CILIUM_EBPF_VER ?= $(call gomod-version,cilium/ebpf)
4344

4445
# regular expressions for excluded file patterns
45-
EXCLUDE_COVERAGE_FILES="(_bpfel.go)|(/opentelemetry-ebpf-instrumentation/test/)|(/opentelemetry-ebpf-instrumentation/configs/)|(.pb.go)|(/pkg/export/otel/metric/)|(/cmd/ebpf-instrument-genfiles)"
46+
EXCLUDE_COVERAGE_FILES="(_bpfel.go)|(/opentelemetry-ebpf-instrumentation/test/)|(/opentelemetry-ebpf-instrumentation/configs/)|(.pb.go)|(/pkg/export/otel/metric/)|(/cmd/obi-genfiles)"
4647

4748
.DEFAULT_GOAL := all
4849

@@ -154,12 +155,12 @@ generate: export BPF_CFLAGS := $(CFLAGS)
154155
generate: export BPF2GO := $(BPF2GO)
155156
generate: bpf2go
156157
@echo "### Generating files..."
157-
@OTEL_EBPF_GENFILES_RUN_LOCALLY=1 go generate cmd/beyla-genfiles/beyla_genfiles.go
158+
@OTEL_EBPF_GENFILES_RUN_LOCALLY=1 go generate cmd/obi-genfiles/obi_genfiles.go
158159

159160
.PHONY: docker-generate
160161
docker-generate:
161162
@echo "### Generating files (docker)..."
162-
@OTEL_EBPF_GENFILES_GEN_IMG=$(GEN_IMG) go generate cmd/beyla-genfiles/beyla_genfiles.go
163+
@OTEL_EBPF_GENFILES_GEN_IMG=$(GEN_IMG) go generate cmd/obi-genfiles/obi_genfiles.go
163164

164165
.PHONY: verify
165166
verify: prereqs lint test
@@ -218,16 +219,18 @@ coverage-report-html: cov-exclude-generated
218219
@echo "### Generating HTML coverage report"
219220
go tool cover --html=$(TEST_OUTPUT)/cover.txt
220221

222+
# image-build is only used for local development. GH actions that build and publish the image don't make use of it
221223
.PHONY: image-build
222224
image-build:
223225
@echo "### Building and pushing the auto-instrumenter image"
224226
$(call check_defined, IMG_ORG, Your Docker repository user name)
225-
$(OCI_BIN) buildx build --platform linux/amd64,linux/arm64 -t ${IMG} .
227+
$(OCI_BIN) buildx build --load -t ${IMG} .
226228

229+
# generator-image-build is only used for local development. GH actions that build and publish the image don't make use of it
227230
.PHONY: generator-image-build
228231
generator-image-build:
229232
@echo "### Creating the image that generates the eBPF binaries"
230-
$(OCI_BIN) buildx build --build-arg EBPF_VER="$(CILIUM_EBPF_VER)" --platform linux/amd64,linux/arm64 -t $(GEN_IMG) -f generator.Dockerfile .
233+
$(OCI_BIN) buildx build --load -t $(GEN_IMG) -f generator.Dockerfile .
231234

232235

233236
.PHONY: prepare-integration-test

cmd/beyla-genfiles/beyla_genfiles.go renamed to cmd/obi-genfiles/obi_genfiles.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:generate go run beyla_genfiles.go
1+
//go:generate go run obi_genfiles.go
22

33
package main
44

@@ -34,8 +34,7 @@ type config struct {
3434
HostPrefix string `env:"OTEL_EBPF_GENFILES_HOST_PREFIX" envDefault:"/home/runner/work/"`
3535
Package string `env:"OTEL_EBPF_GENFILES_PKG" envDefault:"github.com/open-telemetry/opentelemetry-ebpf-instrumentation/pkg/beyla"`
3636
OCIBin string `env:"OTEL_EBPF_GENFILES_OCI_BIN" envDefault:"docker"`
37-
// TODO: replace by OTEL image once we publish them
38-
GenImage string `env:"OTEL_EBPF_GENFILES_GEN_IMG" envDefault:"ghcr.io/grafana/beyla-ebpf-generator:main"`
37+
GenImage string `env:"OTEL_EBPF_GENFILES_GEN_IMG"`
3938
}
4039

4140
var cfg config

generator.Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ FROM base AS builder
33

44
WORKDIR /build
55

6-
COPY cmd/beyla-genfiles/beyla_genfiles.go .
6+
COPY cmd/obi-genfiles/obi_genfiles.go .
77
COPY go.mod go.mod
88
COPY go.sum go.sum
9-
RUN go build -o beyla_genfiles beyla_genfiles.go
9+
RUN go build -o obi_genfiles obi_genfiles.go
1010

1111
FROM base AS dist
1212

1313
WORKDIR /src
1414

1515
ENV EBPF_VER=v0.19.0
1616

17-
RUN apk add clang llvm19 wget
17+
RUN apk add clang llvm20 wget
1818
RUN apk cache purge
1919
RUN go install github.com/cilium/ebpf/cmd/bpf2go@$EBPF_VER
20-
COPY --from=builder /build/beyla_genfiles /go/bin
20+
COPY --from=builder /build/obi_genfiles /go/bin
2121

2222
RUN cat <<EOF > /generate.sh
2323
#!/bin/sh
@@ -26,9 +26,9 @@ export GOMODCACHE=/tmp/go-mod-cache
2626
export BPF2GO=bpf2go
2727
export BPF_CLANG=clang
2828
export BPF_CFLAGS="-O2 -g -Wall -Werror"
29-
export BEYLA_GENFILES_RUN_LOCALLY=1
30-
export BEYLA_GENFILES_MODULE_ROOT="/src"
31-
beyla_genfiles
29+
export OTEL_EBPF_GENFILES_RUN_LOCALLY=1
30+
export OTEL_EBPF_GENFILES_MODULE_ROOT="/src"
31+
obi_genfiles
3232
EOF
3333

3434
RUN chmod +x /generate.sh

0 commit comments

Comments
 (0)