Skip to content

Commit 9d719bf

Browse files
authored
Update release testing for e2e tests (#770)
* Update release testing for e2e tests * Update E2E Test with latest artifact
1 parent 93870a5 commit 9d719bf

File tree

90 files changed

+115
-8114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+115
-8114
lines changed

.github/workflows/appsignals-e2e-ec2-canary-test.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/appsignals-e2e-ec2-test.yml

Lines changed: 45 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,20 @@ env:
2424
SAMPLE_APP_FRONTEND_SERVICE_JAR: ${{ secrets.APP_SIGNALS_E2E_FE_SA_JAR }}
2525
SAMPLE_APP_REMOTE_SERVICE_JAR: ${{ secrets.APP_SIGNALS_E2E_RE_SA_JAR }}
2626
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"
2729
METRIC_NAMESPACE: AppSignals
2830
LOG_GROUP_NAME: /aws/appsignals/generic
2931

3032
jobs:
3133
e2e-ec2-test:
3234
runs-on: ubuntu-latest
3335
steps:
34-
- uses: actions/checkout@v4
36+
- name: Get testing resources from aws-application-signals-test-framework
37+
uses: actions/checkout@v4
3538
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
5041

5142
- name: Generate testing id
5243
run: echo TESTING_ID="${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_ENV
@@ -58,135 +49,73 @@ jobs:
5849
aws-region: ${{ env.AWS_DEFAULT_REGION }}
5950

6051
- uses: actions/download-artifact@v3
61-
if: inputs.caller-workflow-name == 'main-build'
6252
with:
6353
name: aws-opentelemetry-agent.jar
6454

6555
- 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
7757

7858
- name: Set up terraform
7959
uses: hashicorp/setup-terraform@v3
8060
with:
8161
terraform_wrapper: false
8262

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
8565
run: |
8666
terraform init
8767
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 }}"
16575
16676
- name: Get the ec2 instance ami id
16777
run: |
16878
echo "EC2_INSTANCE_AMI=$(terraform output ec2_instance_ami)" >> $GITHUB_ENV
169-
working-directory: testing/terraform/ec2
79+
working-directory: terraform/ec2
17080

17181
- name: Get the sample app endpoint
17282
run: |
17383
echo "MAIN_SERVICE_ENDPOINT=$(terraform output sample_app_main_service_public_dns):8080" >> $GITHUB_ENV
17484
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
176102
177103
# This steps increases the speed of the validation by creating the telemetry data in advance
178104
- name: Call all test APIs
179105
continue-on-error: true
180106
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
185114

186115
# Validation for pulse telemetry data
187116
- name: Validate generated EMF logs
188117
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
190119
--testing-id ${{ env.TESTING_ID }}
191120
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
192121
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
@@ -203,7 +132,7 @@ jobs:
203132
- name: Validate generated metrics
204133
id: metric-validation
205134
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
207136
--testing-id ${{ env.TESTING_ID }}
208137
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
209138
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
@@ -220,7 +149,7 @@ jobs:
220149
- name: Validate generated traces
221150
id: trace-validation
222151
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
224153
--testing-id ${{ env.TESTING_ID }}
225154
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
226155
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
@@ -255,7 +184,7 @@ jobs:
255184
- name: Terraform destroy
256185
if: always()
257186
continue-on-error: true
258-
working-directory: testing/terraform/ec2
187+
working-directory: terraform/ec2
259188
run: |
260189
terraform destroy -auto-approve \
261190
-var="test_id=${{ env.TESTING_ID }}"

.github/workflows/appsignals-e2e-eks-canary-test.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)