@@ -101,6 +101,68 @@ include Makefile.tools
101
101
include Makefile.containers
102
102
include Makefile.packaging
103
103
104
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
105
+ # https://github.com/open-telemetry/weaver #
106
+ # These images are for invoking weaver #
107
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
108
+
109
+ # From where to resolve the containers (e.g. "otel/weaver").
110
+ CONTAINER_REPOSITORY =docker.io
111
+
112
+ # Per container overrides for the repository resolution.
113
+ WEAVER_CONTAINER_REPOSITORY =$(CONTAINER_REPOSITORY )
114
+ SEMCONVGEN_CONTAINER_REPOSITORY =$(CONTAINER_REPOSITORY )
115
+ OPA_CONTAINER_REPOSITORY =$(CONTAINER_REPOSITORY )
116
+
117
+ CHECK_TARGETS =install-tools markdownlint
118
+
119
+ # Versioned, non-qualified references to containers used in this Makefile.
120
+ # These are parsed from dependencies.Dockerfile so dependabot will autoupdate
121
+ # the versions of docker files we use.
122
+ VERSIONED_WEAVER_CONTAINER_NO_REPO =$(shell cat dependencies.Dockerfile | awk '$$4=="weaver" {print $$2}')
123
+ VERSIONED_SEMCONVGEN_CONTAINER_NO_REPO =$(shell cat dependencies.Dockerfile | awk '$$4=="semconvgen" {print $$2}')
124
+ VERSIONED_OPA_CONTAINER_NO_REPO =$(shell cat dependencies.Dockerfile | awk '$$4=="opa" {print $$2}')
125
+
126
+ # Fully qualified references to containers used in this Makefile. These
127
+ # include the container repository, so that the build will work with tools
128
+ # like "podman" with a default "/etc/containers/registries.conf", where
129
+ # a default respository of "docker.io" is not assumed. This is intended to
130
+ # eliminate errors from podman such as:
131
+ #
132
+ # Error: short-name "otel/weaver:v1.2.3" did not resolve to an alias
133
+ # and no unqualified-search registries are defined in "/etc/containers/registries.conf"
134
+ WEAVER_CONTAINER =$(WEAVER_CONTAINER_REPOSITORY ) /$(VERSIONED_WEAVER_CONTAINER_NO_REPO )
135
+ SEMCONVGEN_CONTAINER =$(SEMCONVGEN_CONTAINER_REPOSITORY ) /$(VERSIONED_SEMCONVGEN_CONTAINER_NO_REPO )
136
+ OPA_CONTAINER =$(OPA_CONTAINER_REPOSITORY ) /$(VERSIONED_OPA_CONTAINER_NO_REPO )
137
+
138
+ # Determine if "docker" is actually podman
139
+ DOCKER_VERSION_OUTPUT := $(shell docker --version 2>&1)
140
+ DOCKER_IS_PODMAN := $(shell echo $(DOCKER_VERSION_OUTPUT ) | grep -c podman)
141
+
142
+ ifeq ($(DOCKER_IS_PODMAN ) ,0)
143
+ DOCKER_COMMAND := docker
144
+ else
145
+ DOCKER_COMMAND := podman
146
+ endif
147
+
148
+ # Debug printing
149
+ ifdef DEBUG
150
+ $(info Docker version output : $(DOCKER_VERSION_OUTPUT ) )
151
+ $(info Is Docker actually Podman? $(DOCKER_IS_PODMAN))
152
+ $(info Using command : $(DOCKER_COMMAND ) )
153
+ endif
154
+
155
+ DOCKER_RUN =$(DOCKER_COMMAND ) run
156
+ DOCKER_USER =$(shell id -u) :$(shell id -g)
157
+ DOCKER_USER_IS_HOST_USER_ARG =-u $(DOCKER_USER )
158
+ ifeq ($(DOCKER_COMMAND ) ,podman)
159
+ # On podman, additional arguments are needed to make "-u" work
160
+ # correctly with the host user ID and host group ID.
161
+ #
162
+ # Error: OCI runtime error: crun: setgroups: Invalid argument
163
+ DOCKER_USER_IS_HOST_USER_ARG=--userns =keep-id -u $(DOCKER_USER )
164
+ endif
165
+
104
166
.PHONY : help clean no-local-changes build lint format unit-test integration-test run dev run-mock-management-grpc-server generate generate-mocks local-apk-package local-deb-package local-rpm-package
105
167
106
168
help : # # Show help message
@@ -238,6 +300,27 @@ stop-mock-management-otel-collector: ## Stop running mock management plane OTel
238
300
@echo " Stopping mock management plane OTel collector"
239
301
AGENT_IMAGE_WITH_NGINX_PLUS=nginx_plus_$(IMAGE_TAG ) :latest AGENT_IMAGE_WITH_NGINX_OSS=nginx_oss_$(IMAGE_TAG ) :latest AGENT_IMAGE_WITH_NGINX_PLUS_AND_NAP=nginx_plus_and_nap_$(IMAGE_TAG ) :latest $(CONTAINER_COMPOSE ) -f ./test/mock/collector/docker-compose.yaml down
240
302
303
+ # Generate attribute registry metadata for mdatagen.
304
+ # Example uses:
305
+ # make nginxplus-metadata-gen
306
+ # make nginxoss-metadata-gen
307
+ .PHONY : % -metadata-gen
308
+ % -metadata-gen :
309
+ $(DOCKER_RUN ) --rm \
310
+ $(DOCKER_USER_IS_HOST_USER_ARG ) \
311
+ --mount ' type=bind,source=$(PWD)/templates,target=/home/weaver/templates,readonly' \
312
+ --mount ' type=bind,source=$(PWD)/catalog/$*,target=/home/weaver/source/,readonly' \
313
+ --mount ' type=bind,source=$(PWD)/internal/collector,target=/home/weaver/target' \
314
+ $(WEAVER_CONTAINER ) registry generate \
315
+ --registry=/home/weaver/source \
316
+ --templates=/home/weaver/templates \
317
+ metadata \
318
+ /home/weaver/target/$* receiver
319
+ cat $(PWD ) /internal/collector/$* receiver/* _metadata.yaml > $(PWD ) /internal/collector/$* receiver/metadata.yaml
320
+ rm $(PWD ) /internal/collector/$* receiver/* _metadata.yaml
321
+ @echo " 🗃️ Generating go files"
322
+ @$(GOGEN ) $(PWD ) /internal/collector/$* receiver/...
323
+
241
324
generate : # # Generate golang code
242
325
@echo " 🗄️ Generating proto files"
243
326
@cd api/grpc && $(GORUN ) $(BUF ) generate
0 commit comments