Skip to content

Commit d662fe9

Browse files
committed
get otel version from .github/patches/versions file
1 parent a602679 commit d662fe9

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lambda-layer/build-layer.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@
33
SOURCEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
44

55

6-
## revert https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/7970
7-
OTEL_VERSION="1.32.1"
8-
ADOT_VERSION="1.32.1"
6+
## Get OTel version
7+
file="$SOURCEDIR/../.github/patches/versions"
8+
version=$(awk -F'=v' '/OTEL_JAVA_INSTRUMENTATION_VERSION/ {print $2}' "$file")
9+
echo "Found OTEL Version: ${version}"
10+
# Exit if the version is empty or null
11+
if [[ -z "$version" ]]; then
12+
echo "Error: Version could not be found in ${file}."
13+
exit 1
14+
fi
915

1016

1117
## Clone and Patch the OpenTelemetry Java Instrumentation Repository
1218
git clone https://github.com/open-telemetry/opentelemetry-java-instrumentation.git
1319
pushd opentelemetry-java-instrumentation
14-
git checkout v${OTEL_VERSION} -b tag-v${OTEL_VERSION}
20+
git checkout v${version} -b tag-v${version}
1521

1622
# This patch is for Lambda related context propagation
1723
patch -p1 < "$SOURCEDIR"/patches/opentelemetry-java-instrumentation.patch
@@ -29,7 +35,7 @@ rm -rf opentelemetry-java-instrumentation
2935
## Build the ADOT Java from current source
3036
pushd "$SOURCEDIR"/..
3137
patch -p1 < "${SOURCEDIR}"/patches/aws-otel-java-instrumentation.patch
32-
CI=false ./gradlew publishToMavenLocal -Prelease.version=${ADOT_VERSION}-adot-lambda1
38+
CI=false ./gradlew publishToMavenLocal -Prelease.version=${version}-adot-lambda1
3339
popd
3440

3541

0 commit comments

Comments
 (0)