Skip to content

Commit f7c326b

Browse files
committed
Test e2e build workflow
1 parent 4f0edba commit f7c326b

File tree

3 files changed

+115
-2
lines changed

3 files changed

+115
-2
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build and Push Staging AWSOpenTelemetryDistroJs Layer
2+
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.
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+
iam-role:
14+
required: true
15+
description: 'The role use to publish lambda layer'
16+
layer_directory:
17+
required: true
18+
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'
25+
staging_s3_bucket:
26+
required: true
27+
description: 'S3 bucket holds SDK artifact tarball'
28+
29+
runs:
30+
using: 'composite'
31+
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
37+
shell: bash
38+
run: npm install
39+
working-directory: ${{ inputs.layer_directory }}
40+
- name: Build lambda sample app
41+
shell: bash
42+
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
51+
shell: bash
52+
run: terraform init
53+
working-directory: ${{ inputs.terraform_directory }}
54+
- name: Get terraform Lambda function name
55+
shell: bash
56+
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
71+
shell: bash
72+
run: terraform output -raw api-gateway-url
73+
working-directory: ${{ inputs.terraform_directory }}

.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: true
10+
required: false
1111
description: "The package name"
1212
os:
13-
required: true
13+
required: false
1414
description: "The os"
1515
run_unit_tests:
1616
required: true

.github/workflows/main-build.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ on:
66
- main
77
- "release/v*"
88
- e2e-parallel
9+
- ci-workflow
10+
workflow_dispatch:
911

12+
# TODO: move the following into secrets, not expose any account id
1013
env:
1114
AWS_DEFAULT_REGION: us-east-1
1215
STAGING_ECR_REGISTRY: 637423224110.dkr.ecr.us-east-1.amazonaws.com
@@ -62,6 +65,17 @@ jobs:
6265
package_name: aws-distro-opentelemetry-node-autoinstrumentation
6366
os: ubuntu-latest
6467

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+
6579
- name: Output Tarball File Name
6680
id: staging_tarball_output
6781
run: |
@@ -96,3 +110,29 @@ jobs:
96110
# with:
97111
# staging-wheel-name: ${{ needs.build.outputs.staging_wheel_file }}
98112
# 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

0 commit comments

Comments
 (0)