Skip to content

Commit 4cd5d5b

Browse files
committed
Add support for SELinux Systems.
* Gave the false trail that the file does not exist.
1 parent ea449ae commit 4cd5d5b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Makefile

+11-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ GOPATH_GENDIR := $(GOPATH_DIR)/$(GENDIR)
55
# Find all .proto files.
66
PROTO_FILES := $(wildcard opentelemetry/proto/*/*/*.proto opentelemetry/proto/*/*/*/*.proto)
77

8+
# Make docker work when running on SELinux Enforcing Systems.
9+
# https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label
10+
ifeq ($(shell getenforce),Enforcing)
11+
USE_MOUNT_OPTION := :z
12+
else
13+
USE_MOUNT_OPTION :=
14+
endif
15+
816
# Function to execute a command. Note the empty line before endef to make sure each command
917
# gets executed separately instead of concatenated with previous one.
1018
# Accepts command to execute as first parameter.
@@ -23,8 +31,8 @@ gen-all: gen-cpp gen-csharp gen-go gen-java gen-kotlin gen-objc gen-openapi gen-
2331
OTEL_DOCKER_PROTOBUF ?= otel/build-protobuf:0.9.0
2432
BUF_DOCKER ?= bufbuild/buf:1.7.0
2533

26-
PROTOC := docker run --rm -u ${shell id -u} -v${PWD}:${PWD} -w${PWD} ${OTEL_DOCKER_PROTOBUF} --proto_path=${PWD}
27-
BUF := docker run --rm -v "${PWD}:/workspace" -w /workspace ${BUF_DOCKER}
34+
PROTOC := docker run --rm -u ${shell id -u} -v${PWD}:${PWD}$(USE_MOUNT_OPTION) -w${PWD} ${OTEL_DOCKER_PROTOBUF} --proto_path=${PWD}
35+
BUF := docker run --rm -v "${PWD}:/workspace${USE_MOUNT_OPTION}" -w /workspace ${BUF_DOCKER}
2836
# When checking for protobuf breaking changes, check against the latest release tag
2937
LAST_RELEASE_TAG := $(shell git tag --sort=committerdate | tail -1)
3038
# Options are described in https://docs.buf.build/breaking/usage#git
@@ -150,7 +158,7 @@ gen-ruby:
150158
$(PROTOC) --ruby_out=./$(PROTO_GEN_RUBY_DIR) --grpc-ruby_out=./$(PROTO_GEN_RUBY_DIR) opentelemetry/proto/collector/trace/v1/trace_service.proto
151159
$(PROTOC) --ruby_out=./$(PROTO_GEN_RUBY_DIR) --grpc-ruby_out=./$(PROTO_GEN_RUBY_DIR) opentelemetry/proto/collector/metrics/v1/metrics_service.proto
152160
$(PROTOC) --ruby_out=./$(PROTO_GEN_RUBY_DIR) --grpc-ruby_out=./$(PROTO_GEN_RUBY_DIR) opentelemetry/proto/collector/logs/v1/logs_service.proto
153-
161+
154162
.PHONY: breaking-change
155163
breaking-change:
156164
$(BUF) breaking --against $(BUF_AGAINST) $(BUF_FLAGS)

0 commit comments

Comments
 (0)