23
23
TEST_ACCOUNT : ${{ secrets.APP_SIGNALS_E2E_TEST_ACC }}
24
24
SAMPLE_APP_FRONTEND_SERVICE_JAR : ${{ secrets.APP_SIGNALS_E2E_FE_SA_JAR }}
25
25
SAMPLE_APP_REMOTE_SERVICE_JAR : ${{ secrets.APP_SIGNALS_E2E_RE_SA_JAR }}
26
- APP_SIGNALS_ADOT_JAR : " https://github.com/aws-observability/aws-otel-java-instrumentation/releases/latest/download/aws-opentelemetry-agent.jar"
26
+ GET_CW_AGENT_RPM_COMMAND : " wget -O cw-agent.rpm https://amazoncloudwatch-agent-us-east-1.s3.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm"
27
+ GET_ADOT_JAR_COMMAND : " aws s3 cp s3://adot-main-build-staging-jar/aws-opentelemetry-agent.jar ./adot.jar"
27
28
METRIC_NAMESPACE : AppSignals
28
29
LOG_GROUP_NAME : /aws/appsignals/generic
29
30
30
31
jobs :
31
32
e2e-ec2-test :
32
33
runs-on : ubuntu-latest
33
34
steps :
34
- - uses : actions/checkout@v4
35
+ - name : Get testing resources from aws-application-signals-test-framework
36
+ uses : actions/checkout@v4
35
37
with :
36
- fetch-depth : 0
37
-
38
- - uses : actions/setup-java@v4
39
- with :
40
- java-version : 17
41
- distribution : temurin
42
-
43
- - name : Set CW Agent RPM environment variable
44
- run : |
45
- if [ ${{ env.AWS_DEFAULT_REGION }} == "us-east-1" ]; then
46
- echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-us-east-1.s3.amazonaws.com/amazon_linux/amd64/1.300031.0b313/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV
47
- else
48
- echo GET_CW_AGENT_RPM_COMMAND="wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ env.AWS_DEFAULT_REGION }}.s3.${{ env.AWS_DEFAULT_REGION }}.amazonaws.com/amazon_linux/amd64/1.300031.0b313/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV
49
- fi
38
+ repository : aws-observability/aws-application-signals-test-framework
39
+ ref : adot-pending-release
50
40
51
41
- name : Generate testing id
52
42
run : echo TESTING_ID="${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_ENV
@@ -58,135 +48,73 @@ jobs:
58
48
aws-region : ${{ env.AWS_DEFAULT_REGION }}
59
49
60
50
- uses : actions/download-artifact@v3
61
- if : inputs.caller-workflow-name == 'main-build'
62
51
with :
63
52
name : aws-opentelemetry-agent.jar
64
53
65
54
- name : Upload main-build adot.jar to s3
66
- if : inputs.caller-workflow-name == 'main-build'
67
- run : aws s3 cp ./aws-opentelemetry-agent-*-SNAPSHOT.jar s3://main-build-adot-staging-jar/aws-opentelemetry-agent.jar
68
-
69
- - name : Set Get ADOT.jar command environment variable
70
- working-directory : testing/terraform/ec2
71
- run : |
72
- if [ ${{ inputs.caller-workflow-name }} == "main-build" ]; then
73
- echo GET_ADOT_JAR_COMMAND="aws s3 cp s3://main-build-adot-staging-jar/aws-opentelemetry-agent.jar ./adot.jar" >> $GITHUB_ENV
74
- else
75
- echo GET_ADOT_JAR_COMMAND="wget -O adot.jar https://github.com/aws-observability/aws-otel-java-instrumentation/releases/latest/download/aws-opentelemetry-agent.jar" >> $GITHUB_ENV
76
- fi
55
+ run : aws s3 cp ./aws-opentelemetry-agent-*-SNAPSHOT.jar s3://adot-main-build-staging-jar/aws-opentelemetry-agent.jar
77
56
78
57
- name : Set up terraform
79
58
uses : hashicorp/setup-terraform@v3
80
59
with :
81
60
terraform_wrapper : false
82
61
83
- - name : Deploy sample app via terraform and wait for endpoint to come online
84
- working-directory : testing/ terraform/ec2
62
+ - name : Deploy sample app via terraform
63
+ working-directory : terraform/ec2
85
64
run : |
86
65
terraform init
87
66
terraform validate
88
-
89
- # Attempt to deploy the sample app on an EC2 instance and wait for its endpoint to come online.
90
- # There may be occasional failures due to transitivity issues, so try up to 2 times.
91
- # deployment_failed of 0 indicates that both the terraform deployment and the endpoint are running, while 1 indicates
92
- # that it failed at some point
93
- retry_counter=0
94
- max_retry=2
95
- while [ $retry_counter -lt $max_retry ]; do
96
- echo "Attempt $retry_counter"
97
- deployment_failed=0
98
- terraform apply -auto-approve \
99
- -var="aws_region=${{ env.AWS_DEFAULT_REGION }}" \
100
- -var="test_id=${{ env.TESTING_ID }}" \
101
- -var="sample_app_jar=${{ env.SAMPLE_APP_FRONTEND_SERVICE_JAR }}" \
102
- -var="sample_remote_app_jar=${{ env.SAMPLE_APP_REMOTE_SERVICE_JAR }}" \
103
- -var="get_cw_agent_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \
104
- -var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \
105
- || deployment_failed=$?
106
-
107
- if [ $deployment_failed -eq 1 ]; then
108
- echo "Terraform deployment was unsuccessful. Will attempt to retry deployment."
109
- fi
110
-
111
- # If the deployment_failed is still 0, then the terraform deployment succeeded and now try to connect to the endpoint.
112
- # Attempts to connect will be made for up to 10 minutes
113
- if [ $deployment_failed -eq 0 ]; then
114
- echo "Attempting to connect to the endpoint"
115
- sample_app_endpoint=http://$(terraform output sample_app_main_service_public_dns):8080
116
- attempt_counter=0
117
- max_attempts=60
118
- until $(curl --output /dev/null --silent --head --fail $(echo "$sample_app_endpoint" | tr -d '"')); do
119
- if [ ${attempt_counter} -eq ${max_attempts} ];then
120
- echo "Failed to connect to endpoint. Will attempt to redeploy sample app."
121
- deployment_failed=1
122
- break
123
- fi
124
-
125
- printf '.'
126
- attempt_counter=$(($attempt_counter+1))
127
- sleep 10
128
- done
129
- fi
130
-
131
- # If the success is 1 then either the terraform deployment or the endpoint connection failed, so first destroy the
132
- # resources created from terraform and try again.
133
- if [ $deployment_failed -eq 1 ]; then
134
- echo "Destroying terraform"
135
- terraform destroy -auto-approve \
136
- -var="test_id=${{ env.TESTING_ID }}"
137
-
138
- retry_counter=$(($retry_counter+1))
139
- else
140
- # If deployment succeeded, then exit the loop
141
- break
142
- fi
143
-
144
- if [ $retry_counter -eq $max_retry ]; then
145
- echo "Max retry reached, failed to deploy terraform and connect to the endpoint. Exiting code"
146
- exit 1
147
- fi
148
- done
149
-
150
- # cache local patch outputs
151
- - name : Cache local Maven repository
152
- id : cache-local-maven-repo
153
- uses : actions/cache@v3
154
- with :
155
- path : |
156
- ~/.m2/repository/io/opentelemetry/
157
- key : ${{ runner.os }}-maven-local-${{ hashFiles('.github/patches/opentelemetry-java*.patch') }}
158
-
159
- - name : Publish patched dependencies to maven local
160
- uses : ./.github/actions/patch-dependencies
161
- if : steps.cache-local-maven-repo.outputs.cache-hit != 'true'
162
- with :
163
- gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
164
- gpg_password : ${{ secrets.GPG_PASSPHRASE }}
67
+ terraform apply -auto-approve \
68
+ -var="aws_region=${{ env.AWS_DEFAULT_REGION }}" \
69
+ -var="test_id=${{ env.TESTING_ID }}" \
70
+ -var="sample_app_jar=${{ env.SAMPLE_APP_FRONTEND_SERVICE_JAR }}" \
71
+ -var="sample_remote_app_jar=${{ env.SAMPLE_APP_REMOTE_SERVICE_JAR }}" \
72
+ -var="get_cw_agent_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \
73
+ -var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}"
165
74
166
75
- name : Get the ec2 instance ami id
167
76
run : |
168
77
echo "EC2_INSTANCE_AMI=$(terraform output ec2_instance_ami)" >> $GITHUB_ENV
169
- working-directory : testing/ terraform/ec2
78
+ working-directory : terraform/ec2
170
79
171
80
- name : Get the sample app endpoint
172
81
run : |
173
82
echo "MAIN_SERVICE_ENDPOINT=$(terraform output sample_app_main_service_public_dns):8080" >> $GITHUB_ENV
174
83
echo "REMOTE_SERVICE_IP=$(terraform output sample_app_remote_service_public_ip)" >> $GITHUB_ENV
175
- working-directory : testing/terraform/ec2
84
+ working-directory : terraform/ec2
85
+
86
+ - name : Wait for app endpoint to come online
87
+ id : endpoint-check
88
+ run : |
89
+ attempt_counter=0
90
+ max_attempts=30
91
+ until $(curl --output /dev/null --silent --head --fail http://${{ env.MAIN_SERVICE_ENDPOINT }}); do
92
+ if [ ${attempt_counter} -eq ${max_attempts} ];then
93
+ echo "Max attempts reached"
94
+ exit 1
95
+ fi
96
+
97
+ printf '.'
98
+ attempt_counter=$(($attempt_counter+1))
99
+ sleep 10
100
+ done
176
101
177
102
# This steps increases the speed of the validation by creating the telemetry data in advance
178
103
- name : Call all test APIs
179
104
continue-on-error : true
180
105
run : |
181
- curl -S -s -o /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/outgoing-http-call/
182
- curl -S -s -o /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call/
183
- curl -S -s -o /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}/
184
- curl -S -s -o /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call/
106
+ curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/outgoing-http-call/; echo
107
+ curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call/; echo
108
+ curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}/; echo
109
+ curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call/; echo
110
+
111
+ - name : Build Gradle
112
+ run : ./gradlew
185
113
186
114
# Validation for pulse telemetry data
187
115
- name : Validate generated EMF logs
188
116
id : log-validation
189
- run : ./gradlew testing: validator:run --args='-c ec2/log-validation.yml
117
+ run : ./gradlew validator:run --args='-c ec2/log-validation.yml
190
118
--testing-id ${{ env.TESTING_ID }}
191
119
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
192
120
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
@@ -196,14 +124,14 @@ jobs:
196
124
--log-group ${{ env.LOG_GROUP_NAME }}
197
125
--service-name sample-application-${{ env.TESTING_ID }}
198
126
--remote-service-name sample-remote-application-${{ env.TESTING_ID }}
199
- --request-body ip=${{ env.REMOTE_SERVICE_IP }}
127
+ --query-string ip=${{ env.REMOTE_SERVICE_IP }}
200
128
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
201
129
--rollup'
202
130
203
131
- name : Validate generated metrics
204
132
id : metric-validation
205
133
if : (success() || steps.log-validation.outcome == 'failure') && !cancelled()
206
- run : ./gradlew testing: validator:run --args='-c ec2/metric-validation.yml
134
+ run : ./gradlew validator:run --args='-c ec2/metric-validation.yml
207
135
--testing-id ${{ env.TESTING_ID }}
208
136
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
209
137
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
@@ -213,14 +141,14 @@ jobs:
213
141
--log-group ${{ env.LOG_GROUP_NAME }}
214
142
--service-name sample-application-${{ env.TESTING_ID }}
215
143
--remote-service-name sample-remote-application-${{ env.TESTING_ID }}
216
- --request-body ip=${{ env.REMOTE_SERVICE_IP }}
144
+ --query-string ip=${{ env.REMOTE_SERVICE_IP }}
217
145
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
218
146
--rollup'
219
147
220
148
- name : Validate generated traces
221
149
id : trace-validation
222
150
if : (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure') && !cancelled()
223
- run : ./gradlew testing: validator:run --args='-c ec2/trace-validation.yml
151
+ run : ./gradlew validator:run --args='-c ec2/trace-validation.yml
224
152
--testing-id ${{ env.TESTING_ID }}
225
153
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
226
154
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
@@ -230,7 +158,7 @@ jobs:
230
158
--log-group ${{ env.LOG_GROUP_NAME }}
231
159
--service-name sample-application-${{ env.TESTING_ID }}
232
160
--remote-service-name sample-remote-application-${{ env.TESTING_ID }}
233
- --request-body ip=${{ env.REMOTE_SERVICE_IP }}
161
+ --query-string ip=${{ env.REMOTE_SERVICE_IP }}
234
162
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
235
163
--rollup'
236
164
@@ -255,7 +183,7 @@ jobs:
255
183
- name : Terraform destroy
256
184
if : always()
257
185
continue-on-error : true
258
- working-directory : testing/ terraform/ec2
186
+ working-directory : terraform/ec2
259
187
run : |
260
188
terraform destroy -auto-approve \
261
189
-var="test_id=${{ env.TESTING_ID }}"
0 commit comments