Skip to content

Commit

Permalink
Add E2E EC2 Release Testing for Main Build (#713)
Browse files Browse the repository at this point in the history
* Add E2E EC2 Release Testing for Main Build

* Fix changes based on PR

* Change Terraform variable

* Update variable name

* Edit if statement for main build

---------

Co-authored-by: ADOT Patch workflow <adot-patch-workflow@github.com>
  • Loading branch information
harrryr and ADOT Patch workflow authored Jan 18, 2024
1 parent b907c0f commit 4be6798
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 15 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/appsignals-e2e-ec2-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ jobs:
- name: Set CW Agent RPM environment variable
run: |
if [ ${{ env.AWS_DEFAULT_REGION }} == "us-east-1" ]; then
echo APP_SIGNALS_CW_AGENT_RPM="https://amazoncloudwatch-agent-us-east-1.s3.amazonaws.com/amazon_linux/amd64/1.300031.0b313/amazon-cloudwatch-agent.rpm" >> $GITHUB_ENV
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
else
echo APP_SIGNALS_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
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
fi
- name: Generate testing id
Expand All @@ -57,6 +57,24 @@ jobs:
role-to-assume: ${{ secrets.E2E_TEST_ROLE_ARN }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}

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

- name: Upload main-build adot.jar to s3
if: inputs.caller-workflow-name == 'main-build'
run: aws s3 cp ./aws-opentelemetry-agent-*-SNAPSHOT.jar s3://main-build-adot-staging-jar/aws-opentelemetry-agent.jar

- name: Set Get ADOT.jar command environment variable
working-directory: testing/terraform/ec2
run: |
if [ ${{ inputs.caller-workflow-name }} == "main-build" ]; then
echo GET_ADOT_JAR_COMMAND="aws s3 cp s3://main-build-adot-staging-jar/aws-opentelemetry-agent.jar ./adot.jar" >> $GITHUB_ENV
else
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
fi
- name: Set up terraform
uses: hashicorp/setup-terraform@v3
with:
Expand All @@ -82,8 +100,8 @@ jobs:
-var="test_id=${{ env.TESTING_ID }}" \
-var="sample_app_jar=${{ env.SAMPLE_APP_FRONTEND_SERVICE_JAR }}" \
-var="sample_remote_app_jar=${{ env.SAMPLE_APP_REMOTE_SERVICE_JAR }}" \
-var="cw_agent_rpm=${{ env.APP_SIGNALS_CW_AGENT_RPM }}" \
-var="adot_jar=${{ env.APP_SIGNALS_ADOT_JAR }}" \
-var="get_cw_agent_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \
-var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \
|| deployment_failed=$?
if [ $deployment_failed -eq 1 ]; then
Expand Down Expand Up @@ -233,9 +251,7 @@ jobs:
--region ${{ env.AWS_DEFAULT_REGION }}
fi
# Clean up Procedures

- name: Terraform destroy
if: always()
continue-on-error: true
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ jobs:
arguments: contractTests -PlocalDocker=true

# AppSignals specific e2e tests
appsignals-e2e-test:
appsignals-e2e-eks-test:
concurrency:
group: e2e-adot-test
cancel-in-progress: false
Expand All @@ -237,6 +237,15 @@ jobs:
appsignals-adot-image-name: ${{ needs.build.outputs.staging-image }}
caller-workflow-name: 'main-build'

# AppSignals specific e2e tests for ec2
appsignals-e2e-ec2-test:
needs: [build, default-region-output]
uses: ./.github/workflows/appsignals-e2e-ec2-test.yml
secrets: inherit
with:
aws-region: ${{ needs.default-region-output.outputs.aws_default_region }}
caller-workflow-name: 'main-build'

publish-build-status:
needs: [ build, contract-tests ]
if: ${{ always() }}
Expand Down
8 changes: 4 additions & 4 deletions testing/terraform/ec2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ resource "null_resource" "main_service_setup" {
"echo $agent_config > amazon-cloudwatch-agent.json",

# Get and run CW agent rpm
"wget -O cw-agent.rpm ${var.cw_agent_rpm}",
"${var.get_cw_agent_rpm_command}",
"sudo rpm -U ./cw-agent.rpm",
"sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:./amazon-cloudwatch-agent.json",

# Get ADOT
"wget -O adot.jar ${var.adot_jar}",
"${var.get_adot_jar_command}",

# Get and run the sample application with configuration
"aws s3 cp ${var.sample_app_jar} ./main-service.jar",
Expand Down Expand Up @@ -158,12 +158,12 @@ resource "null_resource" "remote_service_setup" {
"echo $agent_config > amazon-cloudwatch-agent.json",

# Get and run CW agent rpm
"wget -O cw-agent.rpm ${var.cw_agent_rpm}",
"${var.get_cw_agent_rpm_command}",
"sudo rpm -U ./cw-agent.rpm",
"sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:./amazon-cloudwatch-agent.json",

# Get ADOT
"wget -O adot.jar ${var.adot_jar}",
"${var.get_adot_jar_command}",

# Get and run the sample application with configuration
"aws s3 cp ${var.sample_remote_app_jar} ./remote-service.jar",
Expand Down
8 changes: 4 additions & 4 deletions testing/terraform/ec2/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ variable "sample_remote_app_jar" {
default = "s3://<bucket-name>/<jar>"
}

variable "cw_agent_rpm" {
default = "s3://<bucket-name>/<jar>"
variable "get_cw_agent_rpm_command" {
default = "<command> s3://<bucket-name>/<jar>"
}

variable "adot_jar" {
default = "s3://<bucket-name>/<jar>"
variable "get_adot_jar_command" {
default = "<command> s3://<bucket-name>/<jar>"
}

0 comments on commit 4be6798

Please sign in to comment.