Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,38 @@ jobs:
with:
arguments: contractTests -PlocalDocker=true

application-signals-lambda-layer-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Build Application Signals Lambda Layer
working-directory: lambda-layer
run: |
./build-layer.sh
- name: Upload layer zip to GitHub Actions
uses: actions/upload-artifact@v3
with:
name: aws-opentelemetry-java-layer.zip
path: lambda-layer/build/distributions/aws-opentelemetry-java-layer.zip
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }}:role/${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }}
aws-region: us-east-1
- name: Upload layer zip to S3
working-directory: lambda-layer
run: |
aws s3 cp ./build/distributions/aws-opentelemetry-java-layer.zip s3://adot-main-build-staging-jar/adot-java-lambda-layer-${{ github.run_id }}.zip


application-signals-e2e-test:
needs: [build]
needs: [build, application-signals-lambda-layer-build]
uses: ./.github/workflows/application-signals-e2e-test.yml
secrets: inherit
with:
Expand All @@ -247,3 +277,4 @@ jobs:
region: us-east-1
secrets:
roleArn: ${{ secrets.METRICS_ROLE_ARN }}

15 changes: 15 additions & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,18 @@ jobs:
arguments: build --stacktrace -PenableCoverage=true
- uses: codecov/codecov-action@v3

build-lambda:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin

- name: Build layer
working-directory: lambda-layer
run: ./build-layer.sh
2 changes: 1 addition & 1 deletion lambda-layer/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
build

# Ignore Terraform state files
.terraform
.terraform/
*.tfstate
*.tfstate.backup
*.lock.hcl
13 changes: 8 additions & 5 deletions lambda-layer/build-layer.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e

SOURCEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

Expand Down Expand Up @@ -27,8 +28,6 @@ patch -p1 < "$SOURCEDIR"/../.github/patches/opentelemetry-java-instrumentation.p
# This patch is for Lambda related context propagation
patch -p1 < "$SOURCEDIR"/patches/opentelemetry-java-instrumentation.patch

git add -A
git commit -m "Create patch version"
./gradlew publishToMavenLocal
popd
rm -rf opentelemetry-java-instrumentation
Expand All @@ -46,8 +45,12 @@ popd
echo "Info: Building ADOT Lambda Java SDK Layer Code"
./gradlew build -PotelVersion=${version}


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

## Cleanup
# revert the patch applied since it is only needed while building the layer.
git restore ../dependencyManagement/build.gradle.kts
2 changes: 1 addition & 1 deletion lambda-layer/otel-instrument
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export OTEL_PROPAGATORS="${OTEL_PROPAGATORS:-xray,tracecontext,b3,b3multi}"

export OTEL_SERVICE_NAME=${OTEL_SERVICE_NAME:-${AWS_LAMBDA_FUNCTION_NAME}}

export JAVA_TOOL_OPTIONS="-javaagent:/opt/opentelemetry-javaagent.jar ${JAVA_TOOL_OPTIONS}"
export JAVA_TOOL_OPTIONS="-javaagent:/opt/aws-opentelemetry-javaagent.jar ${JAVA_TOOL_OPTIONS}"

if [[ $OTEL_RESOURCE_ATTRIBUTES != *"service.name="* ]]; then
export OTEL_RESOURCE_ATTRIBUTES="service.name=${AWS_LAMBDA_FUNCTION_NAME},${OTEL_RESOURCE_ATTRIBUTES}"
Expand Down
Loading