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
26
APP_SIGNALS_ADOT_JAR : " https://github.com/aws-observability/aws-otel-java-instrumentation/releases/latest/download/aws-opentelemetry-agent.jar"
27
+ 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"
28
+ GET_ADOT_JAR_COMMAND : " aws s3 cp s3://adot-main-build-staging-jar/aws-opentelemetry-agent.jar ./adot.jar"
27
29
METRIC_NAMESPACE : AppSignals
28
30
LOG_GROUP_NAME : /aws/appsignals/generic
29
31
30
32
jobs :
31
33
e2e-ec2-test :
32
34
runs-on : ubuntu-latest
33
35
steps :
34
- - uses : actions/checkout@v4
36
+ - name : Get testing resources from aws-application-signals-test-framework
37
+ uses : actions/checkout@v4
35
38
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
39
+ repository : aws-observability/aws-application-signals-test-framework
40
+ ref : main
50
41
51
42
- name : Generate testing id
52
43
run : echo TESTING_ID="${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_ENV
@@ -58,135 +49,73 @@ jobs:
58
49
aws-region : ${{ env.AWS_DEFAULT_REGION }}
59
50
60
51
- uses : actions/download-artifact@v3
61
- if : inputs.caller-workflow-name == 'main-build'
62
52
with :
63
53
name : aws-opentelemetry-agent.jar
64
54
65
55
- 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
56
+ run : aws s3 cp ./aws-opentelemetry-agent-*-SNAPSHOT.jar s3://adot-main-build-staging-jar/aws-opentelemetry-agent.jar
77
57
78
58
- name : Set up terraform
79
59
uses : hashicorp/setup-terraform@v3
80
60
with :
81
61
terraform_wrapper : false
82
62
83
- - name : Deploy sample app via terraform and wait for endpoint to come online
84
- working-directory : testing/ terraform/ec2
63
+ - name : Deploy sample app via terraform
64
+ working-directory : terraform/ec2
85
65
run : |
86
66
terraform init
87
67
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 }}
68
+ terraform apply -auto-approve \
69
+ -var="aws_region=${{ env.AWS_DEFAULT_REGION }}" \
70
+ -var="test_id=${{ env.TESTING_ID }}" \
71
+ -var="sample_app_jar=${{ env.SAMPLE_APP_FRONTEND_SERVICE_JAR }}" \
72
+ -var="sample_remote_app_jar=${{ env.SAMPLE_APP_REMOTE_SERVICE_JAR }}" \
73
+ -var="get_cw_agent_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \
74
+ -var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}"
165
75
166
76
- name : Get the ec2 instance ami id
167
77
run : |
168
78
echo "EC2_INSTANCE_AMI=$(terraform output ec2_instance_ami)" >> $GITHUB_ENV
169
- working-directory : testing/ terraform/ec2
79
+ working-directory : terraform/ec2
170
80
171
81
- name : Get the sample app endpoint
172
82
run : |
173
83
echo "MAIN_SERVICE_ENDPOINT=$(terraform output sample_app_main_service_public_dns):8080" >> $GITHUB_ENV
174
84
echo "REMOTE_SERVICE_IP=$(terraform output sample_app_remote_service_public_ip)" >> $GITHUB_ENV
175
- working-directory : testing/terraform/ec2
85
+ working-directory : terraform/ec2
86
+
87
+ - name : Wait for app endpoint to come online
88
+ id : endpoint-check
89
+ run : |
90
+ attempt_counter=0
91
+ max_attempts=30
92
+ until $(curl --output /dev/null --silent --head --fail http://${{ env.MAIN_SERVICE_ENDPOINT }}); do
93
+ if [ ${attempt_counter} -eq ${max_attempts} ];then
94
+ echo "Max attempts reached"
95
+ exit 1
96
+ fi
97
+
98
+ printf '.'
99
+ attempt_counter=$(($attempt_counter+1))
100
+ sleep 10
101
+ done
176
102
177
103
# This steps increases the speed of the validation by creating the telemetry data in advance
178
104
- name : Call all test APIs
179
105
continue-on-error : true
180
106
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/
107
+ curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/outgoing-http-call/; echo
108
+ curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call/; echo
109
+ curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}/; echo
110
+ curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call/; echo
111
+
112
+ - name : Build Gradle
113
+ run : ./gradlew
185
114
186
115
# Validation for pulse telemetry data
187
116
- name : Validate generated EMF logs
188
117
id : log-validation
189
- run : ./gradlew testing: validator:run --args='-c ec2/log-validation.yml
118
+ run : ./gradlew validator:run --args='-c ec2/log-validation.yml
190
119
--testing-id ${{ env.TESTING_ID }}
191
120
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
192
121
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
@@ -203,7 +132,7 @@ jobs:
203
132
- name : Validate generated metrics
204
133
id : metric-validation
205
134
if : (success() || steps.log-validation.outcome == 'failure') && !cancelled()
206
- run : ./gradlew testing: validator:run --args='-c ec2/metric-validation.yml
135
+ run : ./gradlew validator:run --args='-c ec2/metric-validation.yml
207
136
--testing-id ${{ env.TESTING_ID }}
208
137
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
209
138
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
@@ -220,7 +149,7 @@ jobs:
220
149
- name : Validate generated traces
221
150
id : trace-validation
222
151
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
152
+ run : ./gradlew validator:run --args='-c ec2/trace-validation.yml
224
153
--testing-id ${{ env.TESTING_ID }}
225
154
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
226
155
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
@@ -255,7 +184,7 @@ jobs:
255
184
- name : Terraform destroy
256
185
if : always()
257
186
continue-on-error : true
258
- working-directory : testing/ terraform/ec2
187
+ working-directory : terraform/ec2
259
188
run : |
260
189
terraform destroy -auto-approve \
261
190
-var="test_id=${{ env.TESTING_ID }}"
0 commit comments