Skip to content

Commit 6e2dadf

Browse files
committed
mend
1 parent f7c326b commit 6e2dadf

File tree

6 files changed

+129
-3555
lines changed

6 files changed

+129
-3555
lines changed
Lines changed: 23 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Build and Push Staging AWSOpenTelemetryDistroJs Layer
22
description: |
3-
This action assumes that the repo was checked out. Builds and pushes/loads tarball and image files. Also performs scan
4-
of the resultant image.
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 2 end tests.
55
66
inputs:
77
aws-region:
@@ -10,64 +10,43 @@ 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'
19-
terraform_directory:
20-
required: true
21-
description: 'The role use to publish lambda layer'
22-
sample_app_directory:
23-
required: true
24-
description: 'The role use to publish lambda layer'
2516
staging_s3_bucket:
2617
required: true
2718
description: 'S3 bucket holds SDK artifact tarball'
19+
staging_tarball:
20+
required: true
21+
description: 'tarball file for building'
2822

2923
runs:
3024
using: 'composite'
3125
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
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
3732
shell: bash
3833
run: npm install
3934
working-directory: ${{ inputs.layer_directory }}
40-
- name: Build lambda sample app
35+
- name: Build Lambda Layer
4136
shell: bash
4237
run: npm install
43-
working-directory: ${{ inputs.lambda-layer/sample-apps/aws-sdk }}
44-
- name: Get terraform directory
45-
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
38+
working-directory: ${{ inputs.layer_directory }}/packages/layer
39+
- name: Build Lambda Sample App
5140
shell: bash
52-
run: terraform init
53-
working-directory: ${{ inputs.terraform_directory }}
54-
- name: Get terraform Lambda function name
41+
run: npm install
42+
working-directory: ${{ inputs.layer_directory }}/sample-apps/aws-sdk
43+
- name: Upload Layer to S3
5544
shell: bash
5645
run: |
57-
echo TERRAFORM_LAMBDA_FUNCTION_NAME=AdotLambdaNodeJsSampleApp-${{ github.sha }}|
58-
tee --append $GITHUB_ENV
59-
- name: Apply terraform
60-
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
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
7149
shell: bash
72-
run: terraform output -raw api-gateway-url
73-
working-directory: ${{ inputs.terraform_directory }}
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/actions/set_up/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ inputs:
77
required: true
88
description: "The node version used in actions"
99
package_name:
10-
required: false
10+
required: true
1111
description: "The package name"
1212
os:
13-
required: false
13+
required: true
1414
description: "The os"
1515
run_unit_tests:
1616
required: true
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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::637423224110:role/${{ secrets.STAGING_ARTIFACTS_ACCESS_ROLE_NAME }}
35+
aws-region: us-east-1
36+
37+
- uses: actions/download-artifact@v3
38+
with:
39+
name: ${{ inputs.staging-instrumentation-name }}
40+
41+
- name: Upload main-build instrumentation to S3
42+
run: aws s3 cp ${{ inputs.staging-instrumentation-name }} s3://adot-autoinstrumentation-node-staging/${{ inputs.staging-instrumentation-name }}
43+
44+
ec2-default:
45+
needs: [ upload-main-build ]
46+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/node-ec2-default-test.yml@main
47+
secrets: inherit
48+
with:
49+
aws-region: us-east-1
50+
staging-instrumentation-name: ${{ inputs.staging-instrumentation-name }}
51+
caller-workflow-name: 'main-build'
52+
53+
ec2-asg:
54+
needs: [ upload-main-build ]
55+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/node-ec2-asg-test.yml@main
56+
secrets: inherit
57+
with:
58+
aws-region: us-east-1
59+
staging-instrumentation-name: ${{ inputs.staging-instrumentation-name }}
60+
caller-workflow-name: 'main-build'
61+
62+
eks:
63+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/node-eks-test.yml@main
64+
secrets: inherit
65+
with:
66+
aws-region: us-east-1
67+
test-cluster-name: 'e2e-node-adot-test'
68+
adot-image-name: ${{ inputs.adot-image-name }}
69+
caller-workflow-name: 'main-build'
70+
71+
k8s:
72+
uses: aws-observability/aws-application-signals-test-framework/.github/workflows/node-k8s-test.yml@main
73+
secrets: inherit
74+
with:
75+
aws-region: us-east-1
76+
adot-image-name: ${{ inputs.adot-image-name }}
77+
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: 20 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ on:
55
branches:
66
- main
77
- "release/v*"
8-
- e2e-parallel
9-
- ci-workflow
10-
workflow_dispatch:
118

12-
# TODO: move the following into secrets, not expose any account id
139
env:
1410
AWS_DEFAULT_REGION: us-east-1
1511
STAGING_ECR_REGISTRY: 637423224110.dkr.ecr.us-east-1.amazonaws.com
@@ -65,17 +61,6 @@ jobs:
6561
package_name: aws-distro-opentelemetry-node-autoinstrumentation
6662
os: ubuntu-latest
6763

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-
7964
- name: Output Tarball File Name
8065
id: staging_tarball_output
8166
run: |
@@ -91,48 +76,30 @@ jobs:
9176
with:
9277
name: ${{ steps.staging_tarball_output.outputs.STAGING_TARBALL}}
9378
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}}
9488
# TODO - implement contract tests in NodeJS
9589
# - name: Set up and run contract tests with pytest
9690
# run: |
9791
# bash scripts/set-up-contract-tests.sh
9892
# pip install pytest
9993
# pytest contract-tests/tests
10094

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
122-
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
95+
application-signals-e2e-test:
96+
name: "Application Signals E2E Test"
97+
needs: [ build ]
98+
uses: ./.github/workflows/application-signals-e2e-test.yml
99+
secrets: inherit
100+
permissions:
101+
id-token: write
102+
contents: read
103+
with:
104+
staging-instrumentation-name: ${{ needs.build.outputs.staging_tarball_file }}
105+
adot-image-name: ${{ needs.build.outputs.staging_registry }}/aws-observability/adot-autoinstrumentation-node-staging:${{ needs.build.outputs.node_image_tag }}

0 commit comments

Comments
 (0)