From 88fda88fb18af63b83d1ffc625971180a4b09ffa Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 26 Oct 2023 09:29:24 +0200 Subject: [PATCH] add apm-server mock and tear down --- .buildkite/scripts/opentelemetry-benchmark.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.buildkite/scripts/opentelemetry-benchmark.sh b/.buildkite/scripts/opentelemetry-benchmark.sh index caa605a53a..9bf914f11e 100755 --- a/.buildkite/scripts/opentelemetry-benchmark.sh +++ b/.buildkite/scripts/opentelemetry-benchmark.sh @@ -1,6 +1,17 @@ #!/usr/bin/env bash set -eo pipefail +CONTAINER_NAME=mock-apm-server + +function cleanup { + echo "--- Tear down the environment" + MOCK_APM_SERVER=$(docker ps | grep $CONTAINER_NAME | awk '{print $1}') + docker stop $MOCK_APM_SERVER + docker rm $MOCK_APM_SERVER +} + +trap cleanup EXIT + echo "--- Download the latest elastic-agent.zip" # run earlier so gh can use the current github repository. run_id=$(gh run list --branch main --status success --workflow main.yml -L 1 --json databaseId --jq '.[].databaseId') @@ -10,6 +21,13 @@ ELASTIC_SNAPSHOT_JAR=$(ls -1 elastic-apm-agent-*.jar) ELASTIC_SNAPSHOT_JAR_FILE="$(pwd)/$ELASTIC_SNAPSHOT_JAR" echo "$ELASTIC_SNAPSHOT_JAR_FILE has been downloaded." +echo "--- Download the latest elastic-agent.zip" +git clone https://github.com/elastic/apm-mutating-webhook.git +pushd apm-mutating-webhook/test/mock +docker build -t $CONTAINER_NAME . +docker run -dp 127.0.0.1:8027:8027 $CONTAINER_NAME +popd + echo "--- Build opentelemetry-java-instrumentation" git clone https://github.com/open-telemetry/opentelemetry-java-instrumentation.git --depth 1 --branch main cd opentelemetry-java-instrumentation/