-
Notifications
You must be signed in to change notification settings - Fork 7
105 lines (94 loc) · 4.46 KB
/
main-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# This workflow builds the aws-opentelemetry-js-distro JavaScript files, uploads to staging S3 bucket, and builds the project docker image that is pushed to a staging ECR repository
name: NodeJS Instrumentation Main Build
on:
push:
branches:
- main
- "release/v*"
env:
AWS_DEFAULT_REGION: us-east-1
STAGING_ECR_REGISTRY: 637423224110.dkr.ecr.us-east-1.amazonaws.com
STAGING_ECR_REPOSITORY: aws-observability/adot-autoinstrumentation-node-staging
STAGING_S3_BUCKET: ${{ secrets.STAGING_BUCKET_NAME }}
concurrency:
group: node-instrumentation-main-build
cancel-in-progress: false
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
outputs:
aws_default_region: ${{ steps.node_output.outputs.awsDefaultRegion}}
node_image_tag: ${{ steps.node_output.outputs.node_image_tag}}
staging_image: ${{ steps.node_output.outputs.stagingImage}}
staging_registry: ${{ steps.node_output.outputs.stagingRegistry}}
staging_repository: ${{ steps.node_output.outputs.stagingRepository}}
staging_tarball_file: ${{ steps.staging_tarball_output.outputs.STAGING_TARBALL}}
steps:
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Get Node Distro Output
id: node_output
run: |
pkg_version=$(jq -r '.version' ./package.json)
echo "ADOT_NODE_VERSION=$pkg_version" >> $GITHUB_OUTPUT
shortsha="$(git rev-parse --short HEAD)"
echo "SHORT_SHA=$shortsha" >> $GITHUB_ENV
node_distro_tag=$pkg_version-$shortsha
echo "awsDefaultRegion=${{ env.AWS_DEFAULT_REGION }}" >> $GITHUB_OUTPUT
echo "node_image_tag=$node_distro_tag" >> $GITHUB_OUTPUT
echo "stagingRegistry=${{ env.STAGING_ECR_REGISTRY }}" >> $GITHUB_OUTPUT
echo "stagingRepository=${{ env.STAGING_ECR_REPOSITORY }}" >> $GITHUB_OUTPUT
echo "stagingImage=${{ env.STAGING_ECR_REGISTRY }}/${{ env.STAGING_ECR_REPOSITORY }}:$node_distro_tag" >> $GITHUB_OUTPUT
- name: Build and Push Tarball and Image Files
uses: ./.github/actions/artifacts_build
with:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
image_uri_with_tag: ${{ steps.node_output.outputs.stagingImage }}
image_registry: ${{ env.STAGING_ECR_REGISTRY }}
snapshot-ecr-role: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
push_image: true
load_image: false
node_version: "20"
package_name: aws-distro-opentelemetry-node-autoinstrumentation
os: ubuntu-latest
- name: Output Tarball File Name
id: staging_tarball_output
run: |
staging_tarball="aws-aws-distro-opentelemetry-node-autoinstrumentation-${{ steps.node_output.outputs.ADOT_NODE_VERSION }}.tgz"
echo "STAGING_TARBALL=$staging_tarball" >> $GITHUB_OUTPUT
- name: Upload Tarball to S3
run: |
aws s3 cp aws-distro-opentelemetry-node-autoinstrumentation/${{ steps.staging_tarball_output.outputs.STAGING_TARBALL }} s3://${{ env.STAGING_S3_BUCKET }}
- name: Upload Tarball to GitHub Actions
uses: actions/upload-artifact@v3
with:
name: ${{ steps.staging_tarball_output.outputs.STAGING_TARBALL}}
path: aws-distro-opentelemetry-node-autoinstrumentation/${{ steps.staging_tarball_output.outputs.STAGING_TARBALL}}
- name: Build and Publish Lambda Staging Layer
uses: ./.github/actions/lambda_artifacts_build
with:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
node_version: "20"
layer_directory: lambda-layer
staging_s3_bucket: ${{ env.STAGING_S3_BUCKET }}
staging_tarball: ${{ steps.staging_tarball_output.outputs.STAGING_TARBALL}}
# TODO - implement contract tests in NodeJS
# - name: Set up and run contract tests with pytest
# run: |
# bash scripts/set-up-contract-tests.sh
# pip install pytest
# pytest contract-tests/tests
application-signals-e2e-test:
name: "Application Signals E2E Test"
needs: [ build ]
uses: ./.github/workflows/application-signals-e2e-test.yml
secrets: inherit
permissions:
id-token: write
contents: read
with:
staging-instrumentation-name: ${{ needs.build.outputs.staging_tarball_file }}
adot-image-name: ${{ needs.build.outputs.staging_registry }}/aws-observability/adot-autoinstrumentation-node-staging:${{ needs.build.outputs.node_image_tag }}