Skip to content

Commit b08b885

Browse files
committed
mend
1 parent f7c326b commit b08b885

File tree

5 files changed

+131
-3542
lines changed

5 files changed

+131
-3542
lines changed

.github/actions/lambda_artifacts_build/action.yml

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ inputs:
1010
node_version:
1111
required: true
1212
description: 'The node version used in actions'
13-
iam-role:
14-
required: true
15-
description: 'The role use to publish lambda layer'
1613
layer_directory:
1714
required: true
1815
description: 'The role use to publish lambda layer'
@@ -25,49 +22,37 @@ inputs:
2522
staging_s3_bucket:
2623
required: true
2724
description: 'S3 bucket holds SDK artifact tarball'
25+
staging_tarball:
26+
required: true
27+
description: 'tarball file for building'
2828

2929
runs:
3030
using: 'composite'
3131
steps:
32-
- name: Download SDK Tarball from S3
33-
shell: bash
34-
run: |
35-
aws s3 cp s3://${{ inputs.staging_s3_bucket }} ./aws-distro-opentelemetry-node-autoinstrumentation/
36-
- name: Build layers
32+
- name: Download Tarball to GitHub Actions
33+
uses: actions/download-artifact@v3
34+
with:
35+
name: ${{ inputs.staging_tarball}}
36+
path: ./aws-distro-opentelemetry-node-autoinstrumentation/
37+
- name: Setup Layer Tools
3738
shell: bash
3839
run: npm install
3940
working-directory: ${{ inputs.layer_directory }}
40-
- name: Build lambda sample app
41+
- name: Build Lambda Layer
4142
shell: bash
4243
run: npm install
43-
working-directory: ${{ inputs.lambda-layer/sample-apps/aws-sdk }}
44-
- name: Get terraform directory
44+
working-directory: ${{ inputs.layer_directory }}/packages/layer
45+
- name: Build Lambda Sample App
4546
shell: bash
46-
run: |
47-
echo TERRAFORM_DIRECTORY=lambda-layer/terraform/lambda |
48-
tee --append $GITHUB_ENV
49-
- uses: hashicorp/setup-terraform@v2
50-
- name: Initialize terraform
51-
shell: bash
52-
run: terraform init
53-
working-directory: ${{ inputs.terraform_directory }}
54-
- name: Get terraform Lambda function name
47+
run: npm install
48+
working-directory: ${{ inputs.layer_directory }}/sample-apps/aws-sdk
49+
- name: Upload Layer to S3
5550
shell: bash
5651
run: |
57-
echo TERRAFORM_LAMBDA_FUNCTION_NAME=AdotLambdaNodeJsSampleApp-${{ github.sha }}|
58-
tee --append $GITHUB_ENV
59-
- name: Apply terraform
52+
aws s3 cp ./build/layer.zip s3://${{ env.STAGING_S3_BUCKET }}/layer-${{ github.run_id }}.zip
53+
working-directory: ${{ inputs.layer_directory }}/packages/layer
54+
- name: Upload Sample App to S3
6055
shell: bash
61-
run: terraform apply -auto-approve
62-
working-directory: ${{ inputs.terraform_directory }}
63-
env:
64-
TF_VAR_sdk_layer_name: AWSOpenTelemetryDistroJs-${{ github.run_id }}
65-
TF_VAR_function_name: ${{ env.TERRAFORM_LAMBDA_FUNCTION_NAME }}
66-
TF_VAR_architecture: ${{ env.LAMBDA_FUNCTION_ARCH }}
67-
TF_VAR_configuration_source: ${{ matrix.confmap }}
68-
TF_VAR_runtime: ${{ matrix.runtime }}
69-
- name: Extract endpoint
70-
id: extract-endpoint
71-
shell: bash
72-
run: terraform output -raw api-gateway-url
73-
working-directory: ${{ inputs.terraform_directory }}
56+
run: |
57+
aws s3 cp ./build/function.zip s3://${{ env.STAGING_S3_BUCKET }}/function-${{ github.run_id }}.zip
58+
working-directory: ${{ inputs.layer_directory }}/sample-apps/aws-sdk
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
## SPDX-License-Identifier: Apache-2.0
3+
4+
# This is a reusable workflow for running the E2E test for Application Signals.
5+
# It is meant to be called from another workflow.
6+
# Read more about reusable workflows: https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview
7+
name: E2E Testing
8+
on:
9+
workflow_call:
10+
inputs:
11+
staging-instrumentation-name:
12+
required: true
13+
type: string
14+
adot-image-name:
15+
required: true
16+
type: string
17+
18+
permissions:
19+
id-token: write
20+
contents: read
21+
22+
concurrency:
23+
group: '${{ github.workflow }} @ ${{ inputs.aws-region }}'
24+
cancel-in-progress: false
25+
26+
27+
jobs:
28+
upload-main-build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Configure AWS Credentials
32+
uses: aws-actions/configure-aws-credentials@v4
33+
with:
34+
# role-to-assume: arn:aws:iam::252610625673:role/${{ secrets.STAGING_ARTIFACTS_ACCESS_ROLE_NAME }}
35+
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
36+
aws-region: us-west-1
37+
38+
- uses: actions/download-artifact@v3
39+
with:
40+
name: ${{ inputs.staging-instrumentation-name }}
41+
42+
- name: Upload main-build instrumentation to S3
43+
run: aws s3 cp ${{ inputs.staging-instrumentation-name }} s3://adot-autoinstrumentation-node-staging-min-sfo/${{ inputs.staging-instrumentation-name }}
44+
45+
# ec2-default:
46+
# needs: [ upload-main-build ]
47+
# uses: aws-observability/aws-application-signals-test-framework/.github/workflows/node-ec2-default-test.yml@main
48+
# secrets: inherit
49+
# with:
50+
# aws-region: us-east-1
51+
# staging-instrumentation-name: ${{ inputs.staging-instrumentation-name }}
52+
# caller-workflow-name: 'main-build'
53+
#
54+
# ec2-asg:
55+
# needs: [ upload-main-build ]
56+
# uses: aws-observability/aws-application-signals-test-framework/.github/workflows/node-ec2-asg-test.yml@main
57+
# secrets: inherit
58+
# with:
59+
# aws-region: us-east-1
60+
# staging-instrumentation-name: ${{ inputs.staging-instrumentation-name }}
61+
# caller-workflow-name: 'main-build'
62+
#
63+
# eks:
64+
# uses: aws-observability/aws-application-signals-test-framework/.github/workflows/node-eks-test.yml@main
65+
# secrets: inherit
66+
# with:
67+
# aws-region: us-east-1
68+
# test-cluster-name: 'e2e-node-adot-test'
69+
# adot-image-name: ${{ inputs.adot-image-name }}
70+
# caller-workflow-name: 'main-build'
71+
#
72+
# k8s:
73+
# uses: aws-observability/aws-application-signals-test-framework/.github/workflows/node-k8s-test.yml@main
74+
# secrets: inherit
75+
# with:
76+
# aws-region: us-east-1
77+
# adot-image-name: ${{ inputs.adot-image-name }}
78+
# caller-workflow-name: 'main-build'
79+
80+
lambda:
81+
uses: mxiamxia/aws-application-signals-test-framework/.github/workflows/node-lambda-test.yml@main
82+
with:
83+
aws-region: us-west-1
84+
caller-workflow-name: 'main-build'

.github/workflows/main-build.yml

Lines changed: 25 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ on:
1111

1212
# TODO: move the following into secrets, not expose any account id
1313
env:
14-
AWS_DEFAULT_REGION: us-east-1
15-
STAGING_ECR_REGISTRY: 637423224110.dkr.ecr.us-east-1.amazonaws.com
14+
AWS_DEFAULT_REGION: us-west-1
15+
# STAGING_ECR_REGISTRY: 637423224110.dkr.ecr.us-east-1.amazonaws.com
16+
STAGING_ECR_REGISTRY: 252610625673.dkr.ecr.us-west-1.amazonaws.com
1617
STAGING_ECR_REPOSITORY: aws-observability/adot-autoinstrumentation-node-staging
1718
STAGING_S3_BUCKET: ${{ secrets.STAGING_BUCKET_NAME }}
1819

@@ -65,17 +66,6 @@ jobs:
6566
package_name: aws-distro-opentelemetry-node-autoinstrumentation
6667
os: ubuntu-latest
6768

68-
- name: Build and Publish Lambda Staging Layer
69-
uses: ./.github/actions/lambda_artifacts_build
70-
with:
71-
aws-region: ${{ env.AWS_DEFAULT_REGION }}
72-
node_version: "20"
73-
iam-role: "abc"
74-
layer_directory: lambda-layer/packages/layer
75-
terraform_directory: lambda-layer/terraform/lambda
76-
sample_app_directory: lambda-layer/sample-apps/aws-sdk
77-
staging_s3_bucket: ${{ env.STAGING_S3_BUCKET }}
78-
7969
- name: Output Tarball File Name
8070
id: staging_tarball_output
8171
run: |
@@ -91,48 +81,33 @@ jobs:
9181
with:
9282
name: ${{ steps.staging_tarball_output.outputs.STAGING_TARBALL}}
9383
path: aws-distro-opentelemetry-node-autoinstrumentation/${{ steps.staging_tarball_output.outputs.STAGING_TARBALL}}
84+
85+
- name: Build and Publish Lambda Staging Layer
86+
uses: ./.github/actions/lambda_artifacts_build
87+
with:
88+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
89+
node_version: "20"
90+
layer_directory: lambda-layer
91+
terraform_directory: lambda-layer/terraform/lambda
92+
sample_app_directory: lambda-layer/sample-apps/aws-sdk
93+
staging_s3_bucket: ${{ env.STAGING_S3_BUCKET }}
94+
staging_tarball: ${{ steps.staging_tarball_output.outputs.STAGING_TARBALL}}
9495
# TODO - implement contract tests in NodeJS
9596
# - name: Set up and run contract tests with pytest
9697
# run: |
9798
# bash scripts/set-up-contract-tests.sh
9899
# pip install pytest
99100
# pytest contract-tests/tests
100101

101-
# TODO - implement E2E tests in NodeJS
102-
# application-signals-e2e-test:
103-
# name: "Application Signals E2E Test"
104-
# needs: [ build ]
105-
# uses: ./.github/workflows/application-signals-e2e-test.yml
106-
# secrets: inherit
107-
# permissions:
108-
# id-token: write
109-
# contents: read
110-
# with:
111-
# staging-wheel-name: ${{ needs.build.outputs.staging_wheel_file }}
112-
# adot-image-name: ${{ needs.build.outputs.staging_registry }}/aws-observability/adot-autoinstrumentation-python-staging:${{ needs.build.outputs.python_image_tag }}
113-
114-
# build-lambda-function-and-layer:
115-
# runs-on: ubuntu-latest
116-
# needs: [ build ]
117-
# outputs:
118-
# aws_default_region: ${{ steps.node_output.outputs.awsDefaultRegion}}
119-
# steps:
120-
# - name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
121-
# uses: actions/checkout@v4
102+
application-signals-e2e-test:
103+
name: "Application Signals E2E Test"
104+
needs: [ build ]
105+
uses: ./.github/workflows/application-signals-e2e-test.yml
106+
secrets: inherit
107+
permissions:
108+
id-token: write
109+
contents: read
110+
with:
111+
staging-instrumentation-name: ${{ needs.build.outputs.staging_tarball_file }}
112+
adot-image-name: ${{ needs.build.outputs.staging_registry }}/aws-observability/adot-autoinstrumentation-node-staging:${{ needs.build.outputs.node_image_tag }}
122113

123-
# - name: Get Node Distro Output
124-
# id: node_output
125-
# run: |
126-
# pkg_version=$(jq -r '.version' ./package.json)
127-
# echo "ADOT_NODE_VERSION=$pkg_version" >> $GITHUB_OUTPUT
128-
# shortsha="$(git rev-parse --short HEAD)"
129-
# echo "SHORT_SHA=$shortsha" >> $GITHUB_ENV
130-
# node_distro_tag=$pkg_version-$shortsha
131-
# echo "awsDefaultRegion=${{ env.AWS_DEFAULT_REGION }}" >> $GITHUB_OUTPUT
132-
# echo "node_image_tag=$node_distro_tag" >> $GITHUB_OUTPUT
133-
# echo "stagingRegistry=${{ env.STAGING_ECR_REGISTRY }}" >> $GITHUB_OUTPUT
134-
# echo "stagingRepository=${{ env.STAGING_ECR_REPOSITORY }}" >> $GITHUB_OUTPUT
135-
# echo "stagingImage=${{ env.STAGING_ECR_REGISTRY }}/${{ env.STAGING_ECR_REPOSITORY }}:$node_distro_tag" >> $GITHUB_OUTPUT
136-
# - name: Build Layer Artifact
137-
# - name: Build Lambda Function Artifact
138-
# - name: update to S3

0 commit comments

Comments
 (0)