diff --git a/.github/workflows/appsignals-e2e-ec2-test.yml b/.github/workflows/appsignals-e2e-ec2-test.yml index 4f1acfef68..428c8ad02e 100644 --- a/.github/workflows/appsignals-e2e-ec2-test.yml +++ b/.github/workflows/appsignals-e2e-ec2-test.yml @@ -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 @@ -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: @@ -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 @@ -233,9 +251,7 @@ jobs: --region ${{ env.AWS_DEFAULT_REGION }} fi - # Clean up Procedures - - name: Terraform destroy if: always() continue-on-error: true diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index 619e61c4f9..0cd60078ed 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -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 @@ -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() }} diff --git a/testing/terraform/ec2/main.tf b/testing/terraform/ec2/main.tf index cccd0ad4cc..55576e8ff2 100644 --- a/testing/terraform/ec2/main.tf +++ b/testing/terraform/ec2/main.tf @@ -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", @@ -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", diff --git a/testing/terraform/ec2/variables.tf b/testing/terraform/ec2/variables.tf index 9466cc17bc..8d128cf17d 100644 --- a/testing/terraform/ec2/variables.tf +++ b/testing/terraform/ec2/variables.tf @@ -33,10 +33,10 @@ variable "sample_remote_app_jar" { default = "s3:///" } -variable "cw_agent_rpm" { - default = "s3:///" +variable "get_cw_agent_rpm_command" { + default = " s3:///" } -variable "adot_jar" { - default = "s3:///" +variable "get_adot_jar_command" { + default = " s3:///" } \ No newline at end of file