Skip to content

Commit

Permalink
[SEMANTIC CONVENTIONS] Code generation script fails on SELINUX (#2455)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Dec 15, 2023
1 parent 03f2a69 commit ebb45c6
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions buildscripts/semantic-convention/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,29 @@ git fetch origin "$SPEC_VERSION"
git reset --hard FETCH_HEAD
cd ${SCRIPT_DIR}

# SELINUX
# https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label

USE_MOUNT_OPTION=""

if [ -x "$(command -v getenforce)" ]; then
SELINUXSTATUS=$(getenforce);
if [ "${SELINUXSTATUS}" == "Enforcing" ]; then
echo "Detected SELINUX"
USE_MOUNT_OPTION=":z"
fi;
fi

# echo "Help ..."

# docker run --rm otel/semconvgen:$GENERATOR_VERSION -h

echo "Generating semantic conventions for traces ..."

docker run --rm \
-v ${SCRIPT_DIR}/tmp-semconv/model:/source \
-v ${SCRIPT_DIR}/templates:/templates \
-v ${ROOT_DIR}/api/include/opentelemetry/trace/:/output \
-v ${SCRIPT_DIR}/tmp-semconv/model:/source${USE_MOUNT_OPTION} \
-v ${SCRIPT_DIR}/templates:/templates${USE_MOUNT_OPTION} \
-v ${ROOT_DIR}/api/include/opentelemetry/trace/:/output${USE_MOUNT_OPTION} \
otel/semconvgen:$GENERATOR_VERSION \
--only span,event,attribute_group,scope \
-f /source code \
Expand All @@ -62,9 +75,9 @@ docker run --rm \
echo "Generating semantic conventions for resources ..."

docker run --rm \
-v ${SCRIPT_DIR}/tmp-semconv/model:/source \
-v ${SCRIPT_DIR}/templates:/templates \
-v ${ROOT_DIR}/sdk/include/opentelemetry/sdk/resource/:/output \
-v ${SCRIPT_DIR}/tmp-semconv/model:/source${USE_MOUNT_OPTION} \
-v ${SCRIPT_DIR}/templates:/templates${USE_MOUNT_OPTION} \
-v ${ROOT_DIR}/sdk/include/opentelemetry/sdk/resource/:/output${USE_MOUNT_OPTION} \
otel/semconvgen:$GENERATOR_VERSION \
--only resource \
-f /source code \
Expand Down

0 comments on commit ebb45c6

Please sign in to comment.