Skip to content

Commit 74eba92

Browse files
authored
Setup NodeJS Lambda Layer E2E Test (#87)
*Description of changes:* Setup Node JS Lambda layer E2E tests. Current the data validation steps are failing due to the known quality issue. This changes are mainly for `main-build` validation in https://github.com/aws-observability/aws-otel-js-instrumentation . it will not trigger any alarm or block anything. #### Test workflow * https://github.com/mxiamxia/aws-otel-js-instrumentation/actions/runs/11190639442/job/31113369923 EMF validation failed as expected due to the known EMF data quality issue WIP. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent d3b5825 commit 74eba92

File tree

11 files changed

+89
-3469
lines changed

11 files changed

+89
-3469
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build and Push Staging AWSOpenTelemetryDistroJs Layer
2+
description: |
3+
This action assumes that the repo was checked out. Builds and push Lambda Layer and sample app to S3 bucket for
4+
the further end to end tests.
5+
6+
inputs:
7+
aws-region:
8+
required: false
9+
description: 'AWS Region, required only if push_image is true'
10+
node_version:
11+
required: true
12+
description: 'The node version used in actions'
13+
layer_directory:
14+
required: true
15+
description: 'The role use to publish lambda layer'
16+
staging_s3_bucket:
17+
required: true
18+
description: 'S3 bucket holds SDK artifact tarball'
19+
staging_tarball:
20+
required: true
21+
description: 'tarball file for building'
22+
23+
runs:
24+
using: 'composite'
25+
steps:
26+
- name: Download Tarball to GitHub Actions
27+
uses: actions/download-artifact@v3
28+
with:
29+
name: ${{ inputs.staging_tarball}}
30+
path: ./aws-distro-opentelemetry-node-autoinstrumentation/
31+
- name: Setup Layer Tools
32+
shell: bash
33+
run: npm install
34+
working-directory: ${{ inputs.layer_directory }}
35+
- name: Build Lambda Layer
36+
shell: bash
37+
run: npm install
38+
working-directory: ${{ inputs.layer_directory }}/packages/layer
39+
- name: Build Lambda Sample App
40+
shell: bash
41+
run: npm install
42+
working-directory: ${{ inputs.layer_directory }}/sample-apps/aws-sdk
43+
- name: Upload Layer to S3
44+
shell: bash
45+
run: |
46+
aws s3 cp ./build/layer.zip s3://${{ env.STAGING_S3_BUCKET }}/layer-${{ github.run_id }}.zip
47+
working-directory: ${{ inputs.layer_directory }}/packages/layer
48+
- name: Upload Sample App to S3
49+
shell: bash
50+
run: |
51+
aws s3 cp ./build/function.zip s3://${{ env.STAGING_S3_BUCKET }}/function-${{ github.run_id }}.zip
52+
working-directory: ${{ inputs.layer_directory }}/sample-apps/aws-sdk

.github/workflows/application-signals-e2e-test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,9 @@ jobs:
7575
aws-region: us-east-1
7676
adot-image-name: ${{ inputs.adot-image-name }}
7777
caller-workflow-name: 'main-build'
78+
79+
lambda:
80+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/node-lambda-test.yml@main
81+
with:
82+
aws-region: us-east-1
83+
caller-workflow-name: 'main-build'

.github/workflows/main-build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ jobs:
7676
with:
7777
name: ${{ steps.staging_tarball_output.outputs.STAGING_TARBALL}}
7878
path: aws-distro-opentelemetry-node-autoinstrumentation/${{ steps.staging_tarball_output.outputs.STAGING_TARBALL}}
79+
80+
- name: Build and Publish Lambda Staging Layer
81+
uses: ./.github/actions/lambda_artifacts_build
82+
with:
83+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
84+
node_version: "20"
85+
layer_directory: lambda-layer
86+
staging_s3_bucket: ${{ env.STAGING_S3_BUCKET }}
87+
staging_tarball: ${{ steps.staging_tarball_output.outputs.STAGING_TARBALL}}
7988
# TODO - implement contract tests in NodeJS
8089
# - name: Set up and run contract tests with pytest
8190
# run: |

.github/workflows/pr-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
run: npm ci
3939
- name: Compile all NPM projects
4040
run: npm run compile
41+
- name: Build Lambda Layer
42+
run: npm run build-lambda
4143
- name: Unit tests (Full)
4244
run: npm run test:coverage
4345
- name: Report Coverage

0 commit comments

Comments
 (0)