diff --git a/.drone/drone.yml b/.drone/drone.yml index d6e9f33fd0..72f0e9e766 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -10,10 +10,17 @@ steps: - make lint image: grafana/alloy-build-image:v0.1.8 name: Lint + volumes: + - name: docker + path: /var/run/docker.sock trigger: event: - pull_request type: docker +volumes: +- host: + path: /var/run/docker.sock + name: docker --- kind: pipeline name: Test @@ -25,10 +32,17 @@ steps: - make GO_TAGS="nodocker" test image: grafana/alloy-build-image:v0.1.8 name: Run Go tests + volumes: + - name: docker + path: /var/run/docker.sock trigger: event: - pull_request type: docker +volumes: +- host: + path: /var/run/docker.sock + name: docker --- kind: pipeline name: Test (Full) @@ -579,6 +593,6 @@ kind: secret name: updater_private_key --- kind: signature -hmac: 26b5613cbd5e5cd42656c10c372d44dc93af565ec2ae212d3b27c2fe366c6aeb +hmac: e6b3e9929f79eab8e5e454b543705e080893abe81ebbd7f47b67dcb6981b0fa8 ... diff --git a/.drone/pipelines/test.jsonnet b/.drone/pipelines/test.jsonnet index d64e8238f4..d2e0aff306 100644 --- a/.drone/pipelines/test.jsonnet +++ b/.drone/pipelines/test.jsonnet @@ -9,11 +9,21 @@ local pipelines = import '../util/pipelines.jsonnet'; steps: [{ name: 'Lint', image: build_image.linux, + volumes: [{ + name: 'docker', + path: '/var/run/docker.sock', + }], commands: [ 'apt-get update -y && apt-get install -y libsystemd-dev', 'make lint', ], }], + volumes: [{ + name: 'docker', + host: { + path: '/var/run/docker.sock', + }, + }], }, pipelines.linux('Test') { @@ -23,11 +33,21 @@ local pipelines = import '../util/pipelines.jsonnet'; steps: [{ name: 'Run Go tests', image: build_image.linux, + volumes: [{ + name: 'docker', + path: '/var/run/docker.sock', + }], commands: [ 'make GO_TAGS="nodocker" test', ], }], + volumes: [{ + name: 'docker', + host: { + path: '/var/run/docker.sock', + }, + }], }, pipelines.linux('Test (Full)') { diff --git a/Dockerfile b/Dockerfile index 1a74e8052e..495e65ed6a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ RELEASE_BUILD=${RELEASE_BUILD} VERSION=${VERSION} \ GO_TAGS="netgo builtinassets promtail_journal_enabled" \ GOEXPERIMENT=${GOEXPERIMENT} \ - make alloy + make alloy-for-image FROM public.ecr.aws/ubuntu/ubuntu:noble diff --git a/Makefile b/Makefile index 17fef35c51..0844751b5a 100644 --- a/Makefile +++ b/Makefile @@ -173,6 +173,9 @@ else $(GO_ENV) go build $(GO_FLAGS) -o $(ALLOY_BINARY) . endif +alloy-for-image: + $(GO_ENV) go build $(GO_FLAGS) -o $(ALLOY_BINARY) . + # alloy-service is not included in binaries since it's Windows-only. alloy-service: ifeq ($(USE_CONTAINER),1) @@ -278,13 +281,14 @@ drone: generate-drone # Required by vendored Beyla to build eBPF artifacts prior to building the # Alloy binary -# go mod vendor is require for GH workflows, as we cannot mount directories +# go mod vendor is required for GH workflows, as we cannot mount directories # outside of the source dir inside the beyla ebpf builder image +# GOHOSTOS and GOHOSTARCH are required to ensure that the tool runs on the +# host context, rather than building target binaries when cross-compiling .PHONY: generate-beyla generate-beyla: - if [ -n "$$GITHUB_WORKSPACE" ]; then go mod vendor; fi; \ - MODULE_ROOT=$$(go list -tags beyla_bpf -f '{{.Dir}}' github.com/grafana/beyla/v2/bpf); \ - GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go generate $$MODULE_ROOT/build_ebpf.go + if [ -n "$$GITHUB_WORKSPACE" ] || [ -n "$$DRONE_SYSTEM_HOST" ]; then go mod vendor; fi; \ + GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go run github.com/grafana/beyla/v2/cmd/beyla-genfiles@generate_tool .PHONY: clean clean: clean-dist clean-build-container-cache diff --git a/go.mod b/go.mod index 5cd0c99b94..6d2a734ed9 100644 --- a/go.mod +++ b/go.mod @@ -574,6 +574,7 @@ require ( github.com/grafana/go-offsets-tracker v0.1.7 // indirect github.com/grafana/gomemcache v0.0.0-20240229205252-cd6a66d6fb56 // indirect github.com/grafana/jfr-parser v0.9.2 // indirect + github.com/grafana/jvmtools v0.0.3 // indirect github.com/grobie/gomemcache v0.0.0-20230213081705-239240bbc445 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.0 // indirect @@ -892,7 +893,7 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) -require github.com/grafana/beyla/v2 v2.0.1-0.20250227003200-4100d20b606e +require github.com/grafana/beyla/v2 v2.0.1-0.20250228221137-faa829a3ecb3 // NOTE: replace directives below must always be *temporary*. // diff --git a/go.sum b/go.sum index 7ea564cd97..d2826bedd2 100644 --- a/go.sum +++ b/go.sum @@ -1246,10 +1246,12 @@ github.com/gosnmp/gosnmp v1.38.0/go.mod h1:FE+PEZvKrFz9afP9ii1W3cprXuVZ17ypCcyyf github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY= github.com/grafana/alloy-remote-config v0.0.10 h1:1Ge7lz2mjXI1rd6SmiZpFHyXeLehBuCi43+XTkdqgV4= github.com/grafana/alloy-remote-config v0.0.10/go.mod h1:kHE1usYo2WAVCikQkIXuoG1Clz8BSdiz3kF+DZSCQ4k= -github.com/grafana/beyla/v2 v2.0.1-0.20250226224816-4aa2d9529c02 h1:XEzD03HJkN2HE1iKeHx91EQj0+H6pexxWd73Crxn8Vw= -github.com/grafana/beyla/v2 v2.0.1-0.20250226224816-4aa2d9529c02/go.mod h1:MK9DL2NL9JoFKqs31CCoNToryajkUxSr7W0krbaIZhU= -github.com/grafana/beyla/v2 v2.0.1-0.20250227003200-4100d20b606e h1:/9+0yWRlYQxNBMa24wEWTFv9mawllixMUdqbplqK1kU= -github.com/grafana/beyla/v2 v2.0.1-0.20250227003200-4100d20b606e/go.mod h1:MK9DL2NL9JoFKqs31CCoNToryajkUxSr7W0krbaIZhU= +github.com/grafana/beyla/v2 v2.0.1-0.20250228181844-8db4ab92d492 h1:4J1yKVr7Att990TfkUiVbaBQavJVxZmTM7ODJYumPPs= +github.com/grafana/beyla/v2 v2.0.1-0.20250228181844-8db4ab92d492/go.mod h1:TBliYCPmQIPzUdW325AJDIXReB7kk13HtgUy9BidLIc= +github.com/grafana/beyla/v2 v2.0.1-0.20250228191524-b9d12092ec96 h1:Klloqg3yBljXzaNYShgSh3EDpkmMQjbNlNMHafsWDoE= +github.com/grafana/beyla/v2 v2.0.1-0.20250228191524-b9d12092ec96/go.mod h1:TBliYCPmQIPzUdW325AJDIXReB7kk13HtgUy9BidLIc= +github.com/grafana/beyla/v2 v2.0.1-0.20250228221137-faa829a3ecb3 h1:aFPqI3R5Km/3cHCpeXECQth87hlCFKLJrruXFeeH2zg= +github.com/grafana/beyla/v2 v2.0.1-0.20250228221137-faa829a3ecb3/go.mod h1:TBliYCPmQIPzUdW325AJDIXReB7kk13HtgUy9BidLIc= github.com/grafana/cadvisor v0.0.0-20240729082359-1f04a91701e2 h1:ju6EcY2aEobeBg185ETtFCKj5WzaQ48qfkbsSRRQrF4= github.com/grafana/cadvisor v0.0.0-20240729082359-1f04a91701e2/go.mod h1:8sLW/G7rcFe1CKMaA4pYT4mX3P1xQVGqM6luzEzx/2g= github.com/grafana/catchpoint-prometheus-exporter v0.0.0-20250218151502-6e97feaee761 h1:dPJOIEwtQ8uR3Qa79pb/lsSFJQ6j4P9vpCUQ4fKimG4= @@ -1273,6 +1275,8 @@ github.com/grafana/jfr-parser/pprof v0.0.3 h1:GbhF9vVbfSUTpn0TPSdOBnDW8cKFQ3lqgi github.com/grafana/jfr-parser/pprof v0.0.3/go.mod h1:MccKegViSw2NsyXNww1yuIcaQlw6LxP/DT0CHlsfRgw= github.com/grafana/jsonparser v0.0.0-20240425183733-ea80629e1a32 h1:NznuPwItog+rwdVg8hAuGKP29ndRSzJAwhxKldkP8oQ= github.com/grafana/jsonparser v0.0.0-20240425183733-ea80629e1a32/go.mod h1:796sq+UcONnSlzA3RtlBZ+b/hrerkZXiEmO8oMjyRwY= +github.com/grafana/jvmtools v0.0.3 h1:4uPquep5v+54Z04OQYOCldrv2SR42IRagHQXrNHsc4g= +github.com/grafana/jvmtools v0.0.3/go.mod h1:b0tiPI5zNyIuPUz2DwvxUCI+5bFoG7A4i47F9sc8w98= github.com/grafana/kafka_exporter v0.0.0-20240409084445-5e3488ad9f9a h1:jqM4NNdx8LSquKo8bPx+XWn91S2b+sgNvEcFfSJQtHY= github.com/grafana/kafka_exporter v0.0.0-20240409084445-5e3488ad9f9a/go.mod h1:ZXGGyeTUMenf/H1CDBK9lv3azjswfa0nVzLoQAYmnDc= github.com/grafana/loki/pkg/push v0.0.0-20250218135905-f078e0e3f9b6 h1:s4B8mN2RvfKEd3TQRHRMQlfuUAyQ4if8UXnzysH4NSY=