Skip to content

Commit b9cf50f

Browse files
committed
add workflow to run ec2 canary with different node versions
1 parent 5a9c747 commit b9cf50f

File tree

8 files changed

+94
-9
lines changed

8 files changed

+94
-9
lines changed

.github/workflows/node-ec2-default-retry.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ on:
1414
caller-workflow-name:
1515
required: true
1616
type: string
17+
node-version:
18+
description: "Currently support version 14, 16, 18, 20, 22"
19+
required: false
20+
type: string
21+
# 'none' means to use the node version come with the OS
22+
default: 'none'
23+
cpu-architecture:
24+
description: "Permitted values: x86_64 or arm64"
25+
required: false
26+
type: string
27+
default: "x86_64"
1728

1829
permissions:
1930
id-token: write
@@ -26,6 +37,8 @@ jobs:
2637
with:
2738
aws-region: ${{ inputs.aws-region }}
2839
caller-workflow-name: ${{ inputs.caller-workflow-name }}
40+
node-version: ${{ inputs.node-version }}
41+
cpu-architecture: ${{ inputs.cpu-architecture }}
2942

3043
node-ec2-default-attempt-2:
3144
needs: [ node-ec2-default-attempt-1 ]
@@ -35,6 +48,8 @@ jobs:
3548
with:
3649
aws-region: ${{ inputs.aws-region }}
3750
caller-workflow-name: ${{ inputs.caller-workflow-name }}
51+
node-version: ${{ inputs.node-version }}
52+
cpu-architecture: ${{ inputs.cpu-architecture }}
3853

3954
publish-metric-attempt-1:
4055
needs: [ node-ec2-default-attempt-1, node-ec2-default-attempt-2 ]

.github/workflows/node-ec2-default-test.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ on:
1414
caller-workflow-name:
1515
required: true
1616
type: string
17+
node-version:
18+
description: "Currently support version 14, 16, 18, 20, 22"
19+
required: false
20+
type: string
21+
# 'none' means to use the node version come with the OS
22+
default: 'none'
23+
cpu-architecture:
24+
description: "Permitted values: x86_64 or arm64"
25+
required: false
26+
type: string
27+
default: "x86_64"
1728
staging-instrumentation-name:
1829
required: false
1930
default: '@aws/aws-distro-opentelemetry-node-autoinstrumentation'
@@ -31,6 +42,8 @@ permissions:
3142
env:
3243
E2E_TEST_AWS_REGION: ${{ inputs.aws-region }}
3344
CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }}
45+
NODE_VERSION: ${{ inputs.node-version }}
46+
CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }}
3447
ADOT_INSTRUMENTATION_NAME: ${{ inputs.staging-instrumentation-name }}
3548
SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/node-sample-app.zip
3649
E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }}
@@ -52,7 +65,7 @@ jobs:
5265
run: echo "job-started=true" >> $GITHUB_OUTPUT
5366

5467
- name: Generate testing id
55-
run: echo TESTING_ID="${{ github.job }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV
68+
run: echo TESTING_ID="${{ github.job }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-${{ inputs.node-version }}-${{ inputs.cpu-architecture }}" >> $GITHUB_ENV
5669

5770
- uses: actions/checkout@v4
5871
with:
@@ -105,7 +118,11 @@ jobs:
105118
if [ "${{ github.event.repository.name }}" = "amazon-cloudwatch-agent" ]; then
106119
echo GET_CW_AGENT_RPM_COMMAND="aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ github.sha }}/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm ./cw-agent.rpm" >> $GITHUB_ENV
107120
else
108-
echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ env.E2E_TEST_AWS_REGION }}.s3.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV
121+
architecture="amd64"
122+
if [ "${{ inputs.cpu-architecture }}" = "arm64" ]; then
123+
architecture="arm64"
124+
fi
125+
echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ env.E2E_TEST_AWS_REGION }}.s3.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/amazon_linux/${architecture}/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV
109126
fi
110127
111128
- name: Set up terraform
@@ -142,6 +159,8 @@ jobs:
142159
-var="sample_app_zip=${{ env.SAMPLE_APP_ZIP }}" \
143160
-var="get_cw_agent_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \
144161
-var="get_adot_instrumentation_command=${{ env.GET_ADOT_INSTRUMENTATION_COMMAND }}" \
162+
-var="language_version=${{ env.NODE_VERSION }}" \
163+
-var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \
145164
|| deployment_failed=$?
146165
147166
if [ $deployment_failed -eq 1 ]; then
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
## SPDX-License-Identifier: Apache-2.0
3+
4+
## This workflow aims to run the Application Signals end-to-end tests as a canary to
5+
## test the artifacts for App Signals enablement. It will deploy a sample app and remote
6+
## service on two EC2 instances, call the APIs, and validate the generated telemetry,
7+
## including logs, metrics, and traces.
8+
name: Node EC2 Enablement Release Testing
9+
on:
10+
push:
11+
branches:
12+
- add-node-tests
13+
# workflow_dispatch: # be able to run the workflow on demand
14+
15+
permissions:
16+
id-token: write
17+
contents: read
18+
19+
jobs:
20+
test-multiple-node-versions:
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
# aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1',
25+
# 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1',
26+
# 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1',
27+
# 'us-east-1','us-east-2', 'us-west-1', 'us-west-2']
28+
node-version: [ '14', '16', '18', '20', '22' ]
29+
uses: ./.github/workflows/node-ec2-default-retry.yml
30+
secrets: inherit
31+
with:
32+
aws-region: 'us-east-1'
33+
node-version: ${{ matrix.node-version }}
34+
cpu-architecture: 'x86_64'
35+
caller-workflow-name: 'test-nodejs'
36+
37+
test-arm64-cpu-architecture:
38+
uses: ./.github/workflows/node-ec2-default-retry.yml
39+
secrets: inherit
40+
with:
41+
aws-region: 'us-east-1'
42+
cpu-architecture: 'arm64'
43+
caller-workflow-name: 'test-nodejs'
44+
45+
# to make sure existing tests are not affected by current changes
46+
test-without-node-version-and-cpu-architecture:
47+
uses: ./.github/workflows/node-ec2-default-retry.yml
48+
secrets: inherit
49+
with:
50+
aws-region: 'us-east-1'
51+
caller-workflow-name: 'test-nodejs'

terraform/node/ec2/default/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ data "aws_ami" "ami" {
7979

8080
resource "aws_instance" "main_service_instance" {
8181
ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier)
82-
instance_type = "t3.small"
82+
instance_type = var.cpu_architecture == "arm64" ? "t4g.small" : "t3.small"
8383
key_name = local.ssh_key_name
8484
iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE"
8585
vpc_security_group_ids = [aws_default_vpc.default.default_security_group_id]
@@ -190,7 +190,7 @@ resource "null_resource" "main_service_setup" {
190190

191191
resource "aws_instance" "remote_service_instance" {
192192
ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier)
193-
instance_type = "t3.small"
193+
instance_type = var.cpu_architecture == "arm64" ? "t4g.small" : "t3.small"
194194
key_name = local.ssh_key_name
195195
iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE"
196196
vpc_security_group_ids = [aws_default_vpc.default.default_security_group_id]

validator/src/main/resources/expected-data-template/node/ec2/default/aws-sdk-call-trace.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"EC2.InstanceId": "^{{instanceId}}$",
2020
"PlatformType": "^AWS::EC2$",
2121
"otel.resource.host.image.id": "^{{instanceAmi}}$",
22-
"otel.resource.host.type": "^t3.small$",
22+
"otel.resource.host.type": "^(t3.small|t4g.small)$",
2323
"aws.span.kind": "^LOCAL_ROOT$"
2424
}
2525
},

validator/src/main/resources/expected-data-template/node/ec2/default/client-call-trace.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"metadata": {
99
"default": {
1010
"otel.resource.host.image.id": "^{{instanceAmi}}$",
11-
"otel.resource.host.type": "^t3.small$"
11+
"otel.resource.host.type": "^(t3.small|t4g.small)$"
1212
}
1313
},
1414
"subsegments": [

validator/src/main/resources/expected-data-template/node/ec2/default/outgoing-http-call-trace.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"EC2.InstanceId": "^{{instanceId}}$",
2020
"PlatformType": "^AWS::EC2$",
2121
"otel.resource.host.image.id": "^{{instanceAmi}}$",
22-
"otel.resource.host.type": "^t3.small$",
22+
"otel.resource.host.type": "^(t3.small|t4g.small)$",
2323
"aws.span.kind": "^LOCAL_ROOT$"
2424
}
2525
},

validator/src/main/resources/expected-data-template/node/ec2/default/remote-service-trace.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"EC2.InstanceId": "^{{instanceId}}$",
2020
"PlatformType": "^AWS::EC2$",
2121
"otel.resource.host.image.id": "^{{instanceAmi}}$",
22-
"otel.resource.host.type": "^t3.small$",
22+
"otel.resource.host.type": "^(t3.small|t4g.small)$",
2323
"aws.span.kind": "^LOCAL_ROOT$"
2424
}
2525
},
@@ -71,7 +71,7 @@
7171
"EC2.InstanceId": "^i-[A-Za-z0-9]{17}$",
7272
"PlatformType": "^AWS::EC2$",
7373
"otel.resource.host.image.id": "^{{instanceAmi}}$",
74-
"otel.resource.host.type": "^t3.small$",
74+
"otel.resource.host.type": "^(t3.small|t4g.small)$",
7575
"aws.span.kind": "^LOCAL_ROOT$"
7676
}
7777
}

0 commit comments

Comments
 (0)