Skip to content

Commit c7785a1

Browse files
committed
Add CPU Architecture Parameter for EC2 Tests
1 parent aef00ab commit c7785a1

16 files changed

+57
-21
lines changed

.github/workflows/java-ec2-asg-test.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ on:
1414
caller-workflow-name:
1515
required: true
1616
type: string
17+
cpu-architecture:
18+
required: false
19+
type: string
20+
default: "x86_64"
1721
outputs:
1822
job-started:
1923
value: ${{ jobs.java-ec2-asg.outputs.job-started }}
@@ -27,6 +31,7 @@ permissions:
2731
env:
2832
E2E_TEST_AWS_REGION: ${{ inputs.aws-region }}
2933
CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }}
34+
CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }}
3035
SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/main-service.jar
3136
SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/remote-service.jar
3237
E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }}
@@ -48,7 +53,7 @@ jobs:
4853
run: echo "job-started=true" >> $GITHUB_OUTPUT
4954

5055
- name: Generate testing id
51-
run: echo TESTING_ID="${{ github.job }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV
56+
run: echo TESTING_ID="${{ github.run_id }}-${{ github.run_number }}-${RANDOM}" >> $GITHUB_ENV
5257

5358
- uses: actions/checkout@v4
5459
with:
@@ -103,7 +108,11 @@ jobs:
103108
# Reusing the adot-main-build-staging-jar bucket to store the python wheel file
104109
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
105110
else
106-
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
111+
if [ "${{ env.CPU_ARCHITECTURE }}" = "x86_64" ]; then
112+
echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV
113+
else
114+
echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/amazon_linux/arm64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV
115+
fi
107116
fi
108117
109118
- name: Set up terraform
@@ -141,6 +150,7 @@ jobs:
141150
-var="sample_remote_app_jar=${{ env.SAMPLE_APP_REMOTE_SERVICE_JAR }}" \
142151
-var="get_cw_agent_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \
143152
-var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \
153+
-var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \
144154
|| deployment_failed=$?
145155
146156
if [ $deployment_failed -eq 1 ]; then

.github/workflows/java-ec2-canary.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
with:
3030
aws-region: ${{ matrix.aws-region }}
3131
caller-workflow-name: 'appsignals-e2e-ec2-canary-test'
32+
cpu-architecture: 'x86_64'
3233

3334
maven:
3435
uses: ./.github/workflows/java-ec2-default-retry.yml
@@ -37,3 +38,4 @@ jobs:
3738
aws-region: 'us-east-1'
3839
caller-workflow-name: 'appsignals-e2e-ec2-maven-canary-test'
3940
otel-source: 'maven'
41+
cpu-architecture: 'x86_64'

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ on:
1414
caller-workflow-name:
1515
required: true
1616
type: string
17+
cpu-architecture:
18+
required: false
19+
type: string
20+
default: "x86_64"
1721
otel-source:
1822
required: false
1923
type: string
@@ -31,6 +35,7 @@ jobs:
3135
aws-region: ${{ inputs.aws-region }}
3236
caller-workflow-name: ${{ inputs.caller-workflow-name }}
3337
otel-source: ${{ inputs.otel-source }}
38+
cpu-architecture: ${{ inputs.cpu-architecture }}
3439

3540
java-ec2-default-attempt-2:
3641
needs: [ java-ec2-default-attempt-1 ]
@@ -41,6 +46,7 @@ jobs:
4146
aws-region: ${{ inputs.aws-region }}
4247
caller-workflow-name: ${{ inputs.caller-workflow-name }}
4348
otel-source: ${{ inputs.otel-source }}
49+
cpu-architecture: ${{ inputs.cpu-architecture }}
4450

4551
publish-metric-attempt-1:
4652
needs: [ java-ec2-default-attempt-1, java-ec2-default-attempt-2 ]

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ on:
1414
caller-workflow-name:
1515
required: true
1616
type: string
17+
cpu-architecture:
18+
required: false
19+
type: string
20+
default: "x86_64"
1721
otel-source:
1822
required: false
1923
type: string
@@ -32,6 +36,7 @@ env:
3236
E2E_TEST_AWS_REGION: ${{ inputs.aws-region }}
3337
CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }}
3438
OTEL_SOURCE: ${{ inputs.otel-source }}
39+
CPU_ARCHITECTURE: ${{ inputs.cpu-architecture }}
3540
SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/main-service.jar
3641
SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/remote-service.jar
3742
E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }}
@@ -112,7 +117,11 @@ jobs:
112117
# Reusing the adot-main-build-staging-jar bucket to store the python wheel file
113118
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
114119
else
115-
echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV
120+
if [ "${{ env.CPU_ARCHITECTURE }}" = "x86_64" ]; then
121+
echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV
122+
else
123+
echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/amazon_linux/arm64/latest/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV
124+
fi
116125
fi
117126
118127
- name: Set up terraform
@@ -150,6 +159,7 @@ jobs:
150159
-var="sample_remote_app_jar=${{ env.SAMPLE_APP_REMOTE_SERVICE_JAR }}" \
151160
-var="get_cw_agent_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \
152161
-var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \
162+
-var="cpu_architecture=${{ env.CPU_ARCHITECTURE }}" \
153163
|| deployment_failed=$?
154164
155165
if [ $deployment_failed -eq 1 ]; then

terraform/java/ec2/asg/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ data "aws_ami" "ami" {
5353
most_recent = true
5454
filter {
5555
name = "name"
56-
values = ["al20*-ami-minimal-*-x86_64"]
56+
values = ["al20*-ami-minimal-*-${var.cpu_architecture}"]
5757
}
5858
filter {
5959
name = "state"
6060
values = ["available"]
6161
}
6262
filter {
6363
name = "architecture"
64-
values = ["x86_64"]
64+
values = [var.cpu_architecture]
6565
}
6666
filter {
6767
name = "image-type"
@@ -86,7 +86,7 @@ data "aws_ami" "ami" {
8686

8787
resource "aws_launch_configuration" "launch_configuration" {
8888
image_id = data.aws_ami.ami.id
89-
instance_type = "t3.micro"
89+
instance_type = var.cpu_architecture == "x86_64" ? "t3.micro" : "t4g.micro"
9090
key_name = local.ssh_key_name
9191
associate_public_ip_address = true
9292
iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE"
@@ -158,7 +158,7 @@ resource "aws_autoscaling_group" "asg" {
158158

159159
resource "aws_instance" "remote_service_instance" {
160160
ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier)
161-
instance_type = "t3.micro"
161+
instance_type = var.cpu_architecture == "x86_64" ? "t3.micro" : "t4g.micro"
162162
key_name = local.ssh_key_name
163163
iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE"
164164
vpc_security_group_ids = [aws_default_vpc.default.default_security_group_id]

terraform/java/ec2/asg/variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@ variable "get_adot_jar_command" {
4343

4444
variable "canary_type" {
4545
default = "java-ec2-asg"
46+
}
47+
48+
variable "cpu_architecture" {
49+
default = "x86_64"
4650
}

terraform/java/ec2/default/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ data "aws_ami" "ami" {
4646
most_recent = true
4747
filter {
4848
name = "name"
49-
values = ["al20*-ami-minimal-*-x86_64"]
49+
values = ["al20*-ami-minimal-*-${var.cpu_architecture}"]
5050
}
5151
filter {
5252
name = "state"
5353
values = ["available"]
5454
}
5555
filter {
5656
name = "architecture"
57-
values = ["x86_64"]
57+
values = [var.cpu_architecture]
5858
}
5959
filter {
6060
name = "image-type"
@@ -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.micro"
82+
instance_type = var.cpu_architecture == "x86_64" ? "t3.micro" : "t4g.micro"
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]
@@ -162,7 +162,7 @@ resource "null_resource" "main_service_setup" {
162162

163163
resource "aws_instance" "remote_service_instance" {
164164
ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier)
165-
instance_type = "t3.micro"
165+
instance_type = var.cpu_architecture == "x86_64" ? "t3.micro" : "t4g.micro"
166166
key_name = local.ssh_key_name
167167
iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE"
168168
vpc_security_group_ids = [aws_default_vpc.default.default_security_group_id]

terraform/java/ec2/default/variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@ variable "get_adot_jar_command" {
4343

4444
variable "canary_type" {
4545
default = "java-ec2-default"
46+
}
47+
48+
variable "cpu_architecture" {
49+
default = "x86_64"
4650
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"otel.resource.ec2.tag.aws:autoscaling:groupName": "^{{platformInfo}}$",
2525
"otel.resource.host.id": "^{{instanceId}}$",
2626
"otel.resource.host.image.id": "^{{instanceAmi}}$",
27-
"otel.resource.host.type": "^t3.micro$",
27+
"otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$",
2828
"aws.span.kind": "^LOCAL_ROOT$",
2929
"otel.resource.host.name": "^{{privateDnsName}}$"
3030
}

validator/src/main/resources/expected-data-template/java/ec2/asg/client-call-trace.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"otel.resource.ec2.tag.aws:autoscaling:groupName": "^{{platformInfo}}$",
1111
"otel.resource.host.id": "^{{instanceId}}$",
1212
"otel.resource.host.image.id": "^{{instanceAmi}}$",
13-
"otel.resource.host.type": "^t3.micro$",
13+
"otel.resource.host.type": "^([a-z0-9]+\\.[a-z0-9]+)$",
1414
"otel.resource.host.name": "^{{privateDnsName}}$"
1515
}
1616
},

0 commit comments

Comments
 (0)