diff --git a/.ci/publish-aws.sh b/.ci/publish-aws.sh
index 407363079b..b83bb4e990 100755
--- a/.ci/publish-aws.sh
+++ b/.ci/publish-aws.sh
@@ -21,9 +21,9 @@ ALL_AWS_REGIONS=$(aws ec2 describe-regions --output json --no-cli-pager | jq -r
rm -rf "${AWS_FOLDER}"
mkdir -p "${AWS_FOLDER}"
-zip_file="./elastic-apm-agent/target/${FULL_LAYER_NAME}.zip"
+zip_file="./apm-agent-lambda-layer/target/${FULL_LAYER_NAME}.zip"
-mv ./elastic-apm-agent/target/elastic-apm-java-aws-lambda-layer-*.zip "${zip_file}"
+mv ./apm-agent-lambda-layer/target/elastic-apm-java-aws-lambda-layer-*.zip "${zip_file}"
for region in $ALL_AWS_REGIONS; do
echo "Publish ${FULL_LAYER_NAME} in ${region}"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7e23485ada..b5fb3fb5a6 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -102,9 +102,6 @@ jobs:
pipelineVersion: ${{ env.TAG_NAME }}
waitFor: true
printBuildLogs: false
- artifactName: lambda-zip
- artifactPath: "elastic-apm-agent/target/elastic-apm-java-aws-lambda-layer-*.zip"
- artifactIfNoFilesFound: error
# The action fails with .github/actions/buildkite/run.sh: line 24: 3: parameter missing.
# Which is an unexpected bug.
# Adding a random buildEnvVar to circumvent the behaviour.
@@ -220,10 +217,14 @@ jobs:
- uses: actions/checkout@v3
with:
ref: ${{ env.TAG_NAME }}
- - uses: actions/download-artifact@v3
+ - name: Set up JDK ${{ env.JAVA_VERSION }}
+ uses: actions/setup-java@v3
with:
- name: lambda-zip
- path: elastic-apm-agent/target
+ java-version: ${{ env.JAVA_VERSION }}
+ distribution: ${{ env.JAVA_DIST }}
+ cache: 'maven'
+ - name: Build Lambda-layer zip using agent from maven-central
+ run: ./mvnw dependency:purge-local-repository package -pl apm-agent-lambda-layer
- uses: hashicorp/vault-action@v2.4.2
with:
url: ${{ secrets.VAULT_ADDR }}
diff --git a/apm-agent-common/src/test/java/co/elastic/apm/agent/test/AgentFileAccessor.java b/apm-agent-common/src/test/java/co/elastic/apm/agent/test/AgentFileAccessor.java
index 16c2194a42..efa328bab0 100644
--- a/apm-agent-common/src/test/java/co/elastic/apm/agent/test/AgentFileAccessor.java
+++ b/apm-agent-common/src/test/java/co/elastic/apm/agent/test/AgentFileAccessor.java
@@ -51,7 +51,7 @@ public static Path getPathToJavaagent(Variant agentBuild) {
}
public static Path getPathToAwsLambdaLayer() {
- return getArtifactPath(Path.of("elastic-apm-agent"), "elastic-apm-java-aws-lambda-layer", "", ".zip");
+ return getArtifactPath(Path.of("apm-agent-lambda-layer"), "elastic-apm-java-aws-lambda-layer", "", ".zip");
}
diff --git a/apm-agent-lambda-layer/pom.xml b/apm-agent-lambda-layer/pom.xml
new file mode 100644
index 0000000000..73378e4487
--- /dev/null
+++ b/apm-agent-lambda-layer/pom.xml
@@ -0,0 +1,104 @@
+
+
+
+ apm-agent-parent
+ co.elastic.apm
+ 1.40.1-SNAPSHOT
+
+ 4.0.0
+
+ apm-agent-lambda-layer
+ ${project.groupId}:${project.artifactId}
+
+
+ true
+ ${project.basedir}/..
+
+
+
+
+
+ ${project.groupId}
+ elastic-apm-agent
+ ${project.version}
+
+
+
+
+
+
+ maven-dependency-plugin
+
+
+ copy
+ prepare-package
+
+ copy
+
+
+
+
+
+
+ ${project.groupId}
+ elastic-apm-agent
+ elastic-apm-agent.jar
+
+
+ ${project.build.directory}
+
+
+
+ maven-resources-plugin
+
+
+ prepare-package
+
+ copy-resources
+
+
+ ${project.build.directory}/aws-lambda
+
+
+ src/main/assembly
+ true
+
+ elastic-apm-handler
+
+
+
+
+ [[*]]
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+ false
+
+ src/main/assembly/aws-lambda-layer.xml
+
+ elastic-apm-java-aws-lambda-layer-${project.version}
+
+
+
+
+
+
+
+
diff --git a/elastic-apm-agent/src/main/assembly/aws-lambda-layer.xml b/apm-agent-lambda-layer/src/main/assembly/aws-lambda-layer.xml
similarity index 88%
rename from elastic-apm-agent/src/main/assembly/aws-lambda-layer.xml
rename to apm-agent-lambda-layer/src/main/assembly/aws-lambda-layer.xml
index 07788d6e8a..f38cc4aa41 100644
--- a/elastic-apm-agent/src/main/assembly/aws-lambda-layer.xml
+++ b/apm-agent-lambda-layer/src/main/assembly/aws-lambda-layer.xml
@@ -14,7 +14,7 @@
-
+
/
elastic-apm-agent.jar
@@ -23,4 +23,4 @@
/
-
\ No newline at end of file
+
diff --git a/elastic-apm-agent/src/main/assembly/elastic-apm-handler b/apm-agent-lambda-layer/src/main/assembly/elastic-apm-handler
similarity index 100%
rename from elastic-apm-agent/src/main/assembly/elastic-apm-handler
rename to apm-agent-lambda-layer/src/main/assembly/elastic-apm-handler
diff --git a/elastic-apm-agent/pom.xml b/elastic-apm-agent/pom.xml
index 638b589705..f934328459 100644
--- a/elastic-apm-agent/pom.xml
+++ b/elastic-apm-agent/pom.xml
@@ -284,51 +284,6 @@
-
- maven-resources-plugin
-
-
- validate
-
- copy-resources
-
-
- ${project.build.directory}/aws-lambda
-
-
- src/main/assembly
- true
-
- elastic-apm-handler
-
-
-
-
- [[*]]
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
-
-
- package
-
- single
-
-
- false
-
- src/main/assembly/aws-lambda-layer.xml
-
- elastic-apm-java-aws-lambda-layer-${project.version}
-
-
-
-
diff --git a/pom.xml b/pom.xml
index 755552b4aa..d946938428 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,6 +60,7 @@
apm-agent-core
elastic-apm-agent
+ apm-agent-lambda-layer
elastic-apm-agent-premain
elastic-apm-agent-java8
apm-agent-benchmarks