Skip to content

Commit e00a0c1

Browse files
committed
reordering patches to avoid conflict + some refactoring
1 parent d83fdd0 commit e00a0c1

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

lambda-layer/build-layer.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ SOURCEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
44

55

66
## Get OTel version
7+
echo "Info: Getting OTEL Version"
78
file="$SOURCEDIR/../.github/patches/versions"
89
version=$(awk -F'=v' '/OTEL_JAVA_INSTRUMENTATION_VERSION/ {print $2}' "$file")
910
echo "Found OTEL Version: ${version}"
@@ -15,16 +16,17 @@ fi
1516

1617

1718
## Clone and Patch the OpenTelemetry Java Instrumentation Repository
19+
echo "Info: Cloning and Patching OpenTelemetry Java Instrumentation Repository"
1820
git clone https://github.com/open-telemetry/opentelemetry-java-instrumentation.git
1921
pushd opentelemetry-java-instrumentation
2022
git checkout v${version} -b tag-v${version}
2123

22-
# This patch is for Lambda related context propagation
23-
patch -p1 < "$SOURCEDIR"/patches/opentelemetry-java-instrumentation.patch
24-
2524
# There is another patch in the .github/patches directory for other changes. We should apply them too for consistency.
2625
patch -p1 < "$SOURCEDIR"/../.github/patches/opentelemetry-java-instrumentation.patch
2726

27+
# This patch is for Lambda related context propagation
28+
patch -p1 < "$SOURCEDIR"/patches/opentelemetry-java-instrumentation.patch
29+
2830
git add -A
2931
git commit -m "Create patch version"
3032
./gradlew publishToMavenLocal
@@ -33,16 +35,19 @@ rm -rf opentelemetry-java-instrumentation
3335

3436

3537
## Build the ADOT Java from current source
38+
echo "Info: Building ADOT Java from current source"
3639
pushd "$SOURCEDIR"/..
3740
patch -p1 < "${SOURCEDIR}"/patches/aws-otel-java-instrumentation.patch
3841
CI=false ./gradlew publishToMavenLocal -Prelease.version=${version}-adot-lambda1
3942
popd
4043

4144

4245
## Build ADOT Lambda Java SDK Layer Code
43-
./gradlew build
46+
echo "Info: Building ADOT Lambda Java SDK Layer Code"
47+
./gradlew build -PotelVersion=${version}
4448

4549

4650
## Copy ADOT Java Agent downloaded using Gradle task and bundle it with the Lambda handler script
51+
echo "Info: Creating the layer artifact"
4752
cp "$SOURCEDIR"/build/javaagent/aws-opentelemetry-agent*.jar ./opentelemetry-javaagent.jar
4853
zip -qr opentelemetry-javaagent-layer.zip opentelemetry-javaagent.jar otel-instrument

lambda-layer/build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ val javaagentDependency by configurations.creating {
2727
extendsFrom()
2828
}
2929

30+
val otelVersion: String by project
31+
3032
dependencies {
31-
compileOnly(platform("io.opentelemetry:opentelemetry-bom:1.32.1"))
32-
compileOnly(platform("io.opentelemetry:opentelemetry-bom-alpha:1.32.1-alpha"))
33+
compileOnly(platform("io.opentelemetry:opentelemetry-bom:$otelVersion"))
34+
compileOnly(platform("io.opentelemetry:opentelemetry-bom-alpha:$otelVersion-alpha"))
3335
// Already included in wrapper so compileOnly
3436
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
3537
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-aws")
36-
javaagentDependency("software.amazon.opentelemetry:aws-opentelemetry-agent:1.32.1-adot-lambda1")
38+
javaagentDependency("software.amazon.opentelemetry:aws-opentelemetry-agent:$otelVersion-adot-lambda1")
3739
}
3840

3941
tasks.register<Copy>("download") {

lambda-layer/patches/opentelemetry-java-instrumentation.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,8 @@ index cc1414c0bf..db8a59b046 100644
636636
--- a/version.gradle.kts
637637
+++ b/version.gradle.kts
638638
@@ -1,5 +1,5 @@
639-
-val stableVersion = "1.33.6"
640-
-val alphaVersion = "1.33.6-alpha"
639+
-val stableVersion = "1.33.6-adot1"
640+
-val alphaVersion = "1.33.6-adot1-alpha"
641641
+val stableVersion = "1.33.6-adot-lambda1"
642642
+val alphaVersion = "1.33.6-adot-lambda1-alpha"
643643

0 commit comments

Comments
 (0)